From 6c18e6da2aa9758eb7c9a639f44a15a45723f65b Mon Sep 17 00:00:00 2001 From: Matt Buckley Date: Wed, 7 Feb 2024 23:39:50 +0000 Subject: Update PowerHAL wrapper support checking behavior - Updates support checks to check status for UNKNOWN_TRANSACTION - Adds PowerHintSessionWrapper class to check support on session methods - Ensures that wrapper methods check the HAL version number for support - Adds macros to cache returned wrapper call support status Bug: 324255931 Test: atest libpowermanager_test Test: atest libsurfaceflinger_unittest:PowerAdvisorTest Change-Id: I4b329e6b55c53198bb064a34e792be6336e66e27 --- include/powermanager/PowerHalController.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'include/powermanager/PowerHalController.h') diff --git a/include/powermanager/PowerHalController.h b/include/powermanager/PowerHalController.h index c50bc4a188..7e0bd5bedc 100644 --- a/include/powermanager/PowerHalController.h +++ b/include/powermanager/PowerHalController.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace android { @@ -38,6 +39,7 @@ public: virtual std::unique_ptr connect(); virtual void reset(); + virtual int32_t getAidlVersion(); }; // ------------------------------------------------------------------------------------------------- @@ -59,14 +61,13 @@ public: int32_t durationMs) override; virtual HalResult setMode(aidl::android::hardware::power::Mode mode, bool enabled) override; - virtual HalResult> - createHintSession(int32_t tgid, int32_t uid, const std::vector& threadIds, - int64_t durationNanos) override; - virtual HalResult> - createHintSessionWithConfig(int32_t tgid, int32_t uid, const std::vector& threadIds, - int64_t durationNanos, - aidl::android::hardware::power::SessionTag tag, - aidl::android::hardware::power::SessionConfig* config) override; + virtual HalResult> createHintSession( + int32_t tgid, int32_t uid, const std::vector& threadIds, + int64_t durationNanos) override; + virtual HalResult> createHintSessionWithConfig( + int32_t tgid, int32_t uid, const std::vector& threadIds, int64_t durationNanos, + aidl::android::hardware::power::SessionTag tag, + aidl::android::hardware::power::SessionConfig* config) override; virtual HalResult getHintSessionPreferredRate() override; virtual HalResult getSessionChannel( int tgid, int uid) override; -- cgit v1.2.3-59-g8ed1b