summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
author Matt Buckley <mattbuckley@google.com> 2023-05-16 20:13:40 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-05-16 20:13:40 +0000
commit43e4541d71950ddd10edada2a55fc24a5d3d0f1d (patch)
tree0ad3a016c08558c5cec9a375eb3bea5037aec56b /native
parent471dc8d16143599047eaa24f113c9f0aa85ab7d3 (diff)
parentedea07ffe645256ca8b4158953dce001b072fbb3 (diff)
Merge "Revert^2 "Use "SessionHint" enum in ndk API"" into udc-dev am: edea07ffe6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21803447 Change-Id: I2d069509bf746165ebdd660958d682567f924d55 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'native')
-rw-r--r--native/android/performance_hint.cpp6
-rw-r--r--native/android/tests/performance_hint/PerformanceHintNativeTest.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp
index 27666caafac4..b3628fa3e5ce 100644
--- a/native/android/performance_hint.cpp
+++ b/native/android/performance_hint.cpp
@@ -69,7 +69,7 @@ public:
int updateTargetWorkDuration(int64_t targetDurationNanos);
int reportActualWorkDuration(int64_t actualDurationNanos);
- int sendHint(int32_t hint);
+ int sendHint(SessionHint hint);
int setThreads(const int32_t* threadIds, size_t size);
int getThreadIds(int32_t* const threadIds, size_t* size);
@@ -243,7 +243,7 @@ int APerformanceHintSession::reportActualWorkDuration(int64_t actualDurationNano
return 0;
}
-int APerformanceHintSession::sendHint(int32_t hint) {
+int APerformanceHintSession::sendHint(SessionHint hint) {
if (hint < 0 || hint >= static_cast<int32_t>(mLastHintSentTimestamp.size())) {
ALOGE("%s: invalid session hint %d", __FUNCTION__, hint);
return EINVAL;
@@ -335,7 +335,7 @@ void APerformanceHint_closeSession(APerformanceHintSession* session) {
delete session;
}
-int APerformanceHint_sendHint(void* session, int32_t hint) {
+int APerformanceHint_sendHint(void* session, SessionHint hint) {
return reinterpret_cast<APerformanceHintSession*>(session)->sendHint(hint);
}
diff --git a/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp b/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
index 321a7dddb144..791adfd33fcd 100644
--- a/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
+++ b/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
@@ -127,7 +127,7 @@ TEST_F(PerformanceHintTest, TestSession) {
result = APerformanceHint_reportActualWorkDuration(session, -1L);
EXPECT_EQ(EINVAL, result);
- int hintId = 2;
+ SessionHint hintId = SessionHint::CPU_LOAD_RESET;
EXPECT_CALL(*iSession, sendHint(Eq(hintId))).Times(Exactly(1));
result = APerformanceHint_sendHint(session, hintId);
EXPECT_EQ(0, result);
@@ -140,7 +140,7 @@ TEST_F(PerformanceHintTest, TestSession) {
result = APerformanceHint_sendHint(session, hintId);
EXPECT_EQ(0, result);
- result = APerformanceHint_sendHint(session, -1);
+ result = APerformanceHint_sendHint(session, static_cast<SessionHint>(-1));
EXPECT_EQ(EINVAL, result);
EXPECT_CALL(*iSession, close()).Times(Exactly(1));