Add thread management API to PowerHintSession.
Previously the list of threads of a PowerHintSession was only determined
when the PowerHintSession was created. This means newly forked threads
from existing threads of the PowerHintSession will not get the benefit
and the clients have to create new PowerHintSession for that.
This patch adds a new method to allow clients to update the threads of
the PowerHintSession.
Additionally, this patch also removes the oneway annotation at the
interface level of IPowerHintSession, all existing methods are converted
to oneway methods and setThreads is a bidirectional method. This also
allows to do meaningful VTS validation.
Bug: b/244216750
Test: atest VtsHalPowerTargetTest
Change-Id: If499d6dad20c9d7f6fbda1b5dc9d528396f1f6c1
diff --git a/power/aidl/default/PowerHintSession.cpp b/power/aidl/default/PowerHintSession.cpp
index aa95be4..f395800 100644
--- a/power/aidl/default/PowerHintSession.cpp
+++ b/power/aidl/default/PowerHintSession.cpp
@@ -51,4 +51,12 @@
return ScopedAStatus::ok();
}
+ScopedAStatus PowerHintSession::setThreads(const std::vector<int32_t>& threadIds) {
+ if (threadIds.size() == 0) {
+ LOG(ERROR) << "Error: threadIds.size() shouldn't be " << threadIds.size();
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ return ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::power::impl::example