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/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index 13b7610..32c77c7 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -1920,6 +1920,15 @@
return statusTFromBinderStatus(aps->setAssistantServicesUids(uidsAidl));
}
+status_t AudioSystem::setActiveAssistantServicesUids(const std::vector<uid_t>& activeUids) {
+ const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ if (aps == 0) return PERMISSION_DENIED;
+
+ std::vector<int32_t> activeUidsAidl = VALUE_OR_RETURN_STATUS(
+ convertContainer<std::vector<int32_t>>(activeUids, legacy2aidl_uid_t_int32_t));
+ return statusTFromBinderStatus(aps->setActiveAssistantServicesUids(activeUidsAidl));
+}
+
status_t AudioSystem::setA11yServicesUids(const std::vector<uid_t>& uids) {
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return PERMISSION_DENIED;