diff --git a/Android.mk b/Android.mk index 5a6e19b..7e3c79b 100644 --- a/Android.mk +++ b/Android.mk @@ -108,7 +108,11 @@ LOCAL_INIT_RC := android.hardware.power-service.rc LOCAL_MODULE_TAGS := optional LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-variable LOCAL_VENDOR_MODULE := true +ifeq ($(PLATFORM_SDK_VERSION), 34) +LOCAL_VINTF_FRAGMENTS := /vintf/sdk34/power.xml +else LOCAL_VINTF_FRAGMENTS := power.xml +endif include $(BUILD_EXECUTABLE) endif diff --git a/PowerHintSession.cpp b/PowerHintSession.cpp index 3fec48c..c4e9074 100644 --- a/PowerHintSession.cpp +++ b/PowerHintSession.cpp @@ -31,6 +31,7 @@ ndk::ScopedAStatus PowerHintSessionImpl::resume(){ ndk::ScopedAStatus PowerHintSessionImpl::close(){ return ndk::ScopedAStatus::ok(); } +#if (PLATFORM_SDK_VERSION >= 34) ndk::ScopedAStatus PowerHintSessionImpl::sendHint(aidl::android::hardware::power::SessionHint hint){ return ndk::ScopedAStatus::ok(); } @@ -41,3 +42,4 @@ ndk::ScopedAStatus PowerHintSessionImpl::setThreads(const std::vector& } return ndk::ScopedAStatus::ok(); } +#endif diff --git a/PowerHintSession.h b/PowerHintSession.h index bdf7428..a56713a 100644 --- a/PowerHintSession.h +++ b/PowerHintSession.h @@ -7,8 +7,10 @@ #define __POWERHINTSESSION__ #include -#include #include +#if (PLATFORM_SDK_VERSION >= 34) +#include +#endif std::shared_ptr setPowerHintSession(); int64_t getSessionPreferredRate(); @@ -21,7 +23,9 @@ public: ndk::ScopedAStatus pause() override; ndk::ScopedAStatus resume() override; ndk::ScopedAStatus close() override; + #if (PLATFORM_SDK_VERSION >= 34) ndk::ScopedAStatus sendHint(aidl::android::hardware::power::SessionHint hint) override; ndk::ScopedAStatus setThreads(const std::vector& threadIds) override; + #endif }; #endif /* __POWERHINTSESSION__ */ \ No newline at end of file diff --git a/power.xml b/power.xml index b6aa04b..b8c6cba 100644 --- a/power.xml +++ b/power.xml @@ -32,7 +32,7 @@ SPDX-License-Identifier: BSD-3-Clause-Clear android.hardware.power - 4 + 3 IPower/default \ No newline at end of file diff --git a/vintf/sdk34/power.xml b/vintf/sdk34/power.xml new file mode 100644 index 0000000..1e08685 --- /dev/null +++ b/vintf/sdk34/power.xml @@ -0,0 +1,11 @@ + + + + android.hardware.power + 4 + IPower/default + + \ No newline at end of file