Added audio service API to set active assistants.
Added API to manage the currently active assistants UIDs. When an
assistant can become active the API can be called to set voice
interaction service and corresponging trusted hotword service as active.
If there are no assistant UIDs in the active list the audio policy
service uses the default policy, which is to find the latest active
assistant and allow that to continue listening. This is to continue
support for legacy devices where the management of the active assistant
should be preserve.
Bug: 189312611
Test: m -j, and run assistant
Change-Id: I18984f3dcb8bf63dd16b3ae86d96dfbce39ced03
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 0479958..4da4ea0 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -2024,6 +2024,16 @@
return Status::ok();
}
+Status AudioPolicyService::setActiveAssistantServicesUids(
+ const std::vector<int32_t>& activeUidsAidl) {
+ std::vector<uid_t> activeUids;
+ RETURN_IF_BINDER_ERROR(convertInt32VectorToUidVectorWithLimit(activeUidsAidl, activeUids));
+
+ Mutex::Autolock _l(mLock);
+ mUidPolicy->setActiveAssistantUids(activeUids);
+ return Status::ok();
+}
+
Status AudioPolicyService::setA11yServicesUids(const std::vector<int32_t>& uidsAidl)
{
std::vector<uid_t> uids;