Make sendHint private in platform
* Convert PerformanceHintManager sendHint to a private API
* Have HWUI depend on private implementation
Bug: b/261640114
Test: atest PerformanceHintNativeTestCases
Test: atest FrameworksCoreTests:android.os.PerformanceHintManagerTest
Change-Id: Ic65eef1fbd1c26040e86ddf3cf7c59581fee4374
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index 9b0f020..4e6a0c5 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -330,7 +330,6 @@
APerformanceHint_updateTargetWorkDuration; # introduced=Tiramisu
APerformanceHint_reportActualWorkDuration; # introduced=Tiramisu
APerformanceHint_closeSession; # introduced=Tiramisu
- APerformanceHint_sendHint; # introduced=UpsideDownCake
local:
*;
};
@@ -338,6 +337,7 @@
LIBANDROID_PLATFORM {
global:
APerformanceHint_setIHintManagerForTesting;
+ APerformanceHint_sendHint;
extern "C++" {
ASurfaceControl_registerSurfaceStatsListener*;
ASurfaceControl_unregisterSurfaceStatsListener*;
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp
index 40eb507..95b7513 100644
--- a/native/android/performance_hint.cpp
+++ b/native/android/performance_hint.cpp
@@ -263,14 +263,14 @@
return session->reportActualWorkDuration(actualDurationNanos);
}
-int APerformanceHint_sendHint(APerformanceHintSession* session, int32_t hint) {
- return session->sendHint(hint);
-}
-
void APerformanceHint_closeSession(APerformanceHintSession* session) {
delete session;
}
+int APerformanceHint_sendHint(void* session, int32_t hint) {
+ return reinterpret_cast<APerformanceHintSession*>(session)->sendHint(hint);
+}
+
void APerformanceHint_setIHintManagerForTesting(void* iManager) {
delete gHintManagerForTesting;
gHintManagerForTesting = nullptr;