diff options
author | 2023-12-15 19:04:31 +0000 | |
---|---|---|
committer | 2023-12-15 19:04:31 +0000 | |
commit | ce1677886e18a7b37448d2fa7ebd769ff799b9ef (patch) | |
tree | 8c2208a3af1d57178c9f4730273d58a226302438 | |
parent | b067fdcf505f65137ecfb4ee5bb6d337cfbcd477 (diff) | |
parent | 104f53acdf069a17c62bfba9c81a709919eb9ee9 (diff) |
Merge "Update mock classes to reflect powerhal changes" into main
6 files changed, 43 insertions, 5 deletions
diff --git a/services/powermanager/tests/PowerHalWrapperAidlTest.cpp b/services/powermanager/tests/PowerHalWrapperAidlTest.cpp index 641ba9f44b..3d2cf293ed 100644 --- a/services/powermanager/tests/PowerHalWrapperAidlTest.cpp +++ b/services/powermanager/tests/PowerHalWrapperAidlTest.cpp @@ -29,9 +29,12 @@ #include <thread> using aidl::android::hardware::power::Boost; +using aidl::android::hardware::power::ChannelConfig; using aidl::android::hardware::power::IPower; using aidl::android::hardware::power::IPowerHintSession; using aidl::android::hardware::power::Mode; +using aidl::android::hardware::power::SessionConfig; +using aidl::android::hardware::power::SessionTag; using android::binder::Status; using namespace android; @@ -53,6 +56,14 @@ public: (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds, int64_t durationNanos, std::shared_ptr<IPowerHintSession>* session), (override)); + MOCK_METHOD(ndk::ScopedAStatus, createHintSessionWithConfig, + (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds, + int64_t durationNanos, SessionTag tag, SessionConfig* config, + std::shared_ptr<IPowerHintSession>* _aidl_return), + (override)); + MOCK_METHOD(ndk::ScopedAStatus, getSessionChannel, + (int32_t tgid, int32_t uid, ChannelConfig* _aidl_return), (override)); + MOCK_METHOD(ndk::ScopedAStatus, closeSessionChannel, (int32_t tgid, int32_t uid), (override)); MOCK_METHOD(ndk::ScopedAStatus, getHintSessionPreferredRate, (int64_t * rate), (override)); MOCK_METHOD(ndk::ScopedAStatus, getInterfaceVersion, (int32_t * version), (override)); MOCK_METHOD(ndk::ScopedAStatus, getInterfaceHash, (std::string * hash), (override)); diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp index dd228b4523..a0c943ba72 100644 --- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp +++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp @@ -31,10 +31,6 @@ #include <utils/Mutex.h> #include <utils/Trace.h> -#include <aidl/android/hardware/power/IPower.h> -#include <aidl/android/hardware/power/IPowerHintSession.h> -#include <aidl/android/hardware/power/WorkDuration.h> - #include <binder/IServiceManager.h> #include "../SurfaceFlingerProperties.h" diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.h b/services/surfaceflinger/DisplayHardware/PowerAdvisor.h index 0276e44986..bbe51cc09d 100644 --- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.h +++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.h @@ -25,9 +25,14 @@ #include <ui/FenceTime.h> #include <utils/Mutex.h> +// FMQ library in IPower does questionable conversions +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #include <aidl/android/hardware/power/IPower.h> -#include <compositionengine/impl/OutputCompositionState.h> #include <powermanager/PowerHalController.h> +#pragma clang diagnostic pop + +#include <compositionengine/impl/OutputCompositionState.h> #include <scheduler/Time.h> #include <ui/DisplayIdentification.h> #include "../Scheduler/OneShotTimer.h" diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPower.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPower.h index a088aabc11..ed1405b058 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPower.h +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPower.h @@ -18,12 +18,21 @@ #include "binder/Status.h" +// FMQ library in IPower does questionable conversions +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #include <aidl/android/hardware/power/IPower.h> +#pragma clang diagnostic pop + #include <gmock/gmock.h> using aidl::android::hardware::power::Boost; +using aidl::android::hardware::power::ChannelConfig; using aidl::android::hardware::power::IPower; using aidl::android::hardware::power::IPowerHintSession; +using aidl::android::hardware::power::SessionConfig; +using aidl::android::hardware::power::SessionTag; + using aidl::android::hardware::power::Mode; using android::binder::Status; @@ -42,6 +51,14 @@ public: int64_t durationNanos, std::shared_ptr<IPowerHintSession>* session), (override)); MOCK_METHOD(ndk::ScopedAStatus, getHintSessionPreferredRate, (int64_t * rate), (override)); + MOCK_METHOD(ndk::ScopedAStatus, createHintSessionWithConfig, + (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds, + int64_t durationNanos, SessionTag tag, SessionConfig* config, + std::shared_ptr<IPowerHintSession>* _aidl_return), + (override)); + MOCK_METHOD(ndk::ScopedAStatus, getSessionChannel, + (int32_t tgid, int32_t uid, ChannelConfig* _aidl_return), (override)); + MOCK_METHOD(ndk::ScopedAStatus, closeSessionChannel, (int32_t tgid, int32_t uid), (override)); MOCK_METHOD(ndk::ScopedAStatus, getInterfaceVersion, (int32_t * version), (override)); MOCK_METHOD(ndk::ScopedAStatus, getInterfaceHash, (std::string * hash), (override)); MOCK_METHOD(ndk::SpAIBinder, asBinder, (), (override)); diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPowerHintSession.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPowerHintSession.h index 364618d61a..27564b26de 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPowerHintSession.h +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockIPowerHintSession.h @@ -18,10 +18,15 @@ #include "binder/Status.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #include <aidl/android/hardware/power/IPower.h> +#pragma clang diagnostic pop + #include <gmock/gmock.h> using aidl::android::hardware::power::IPowerHintSession; +using aidl::android::hardware::power::SessionConfig; using aidl::android::hardware::power::SessionHint; using aidl::android::hardware::power::SessionMode; using android::binder::Status; @@ -47,6 +52,7 @@ public: MOCK_METHOD(ndk::ScopedAStatus, sendHint, (SessionHint), (override)); MOCK_METHOD(ndk::ScopedAStatus, setThreads, (const ::std::vector<int32_t>&), (override)); MOCK_METHOD(ndk::ScopedAStatus, setMode, (SessionMode, bool), (override)); + MOCK_METHOD(ndk::ScopedAStatus, getSessionConfig, (SessionConfig * _aidl_return), (override)); }; } // namespace android::Hwc2::mock diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerHalController.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerHalController.h index 68fe3c52d4..b17c8adf6c 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerHalController.h +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerHalController.h @@ -19,7 +19,10 @@ #include <gmock/gmock.h> #include <scheduler/Time.h> +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #include <powermanager/PowerHalController.h> +#pragma clang diagnostic pop namespace android { namespace hardware { |