audioservice: add RTT mode observer
Enable audio capture by the Assistant when RTT is ON during a call
similarly to when an accessibility service is in the foreground.
Also remove log when permission checked for hotword
and audio output capture fail as those checks are now done
systematically.
Also do not check permission to bypass interruption policy if
bypass flags are not set.
Bug: 132976361
Test: use voice input during a call with RTT enabled.
Change-Id: Iff45b0816dac889262ec29ea115f74dea4dc6b6d
diff --git a/media/libaudioclient/IAudioPolicyService.cpp b/media/libaudioclient/IAudioPolicyService.cpp
index c548457..64f0aca 100644
--- a/media/libaudioclient/IAudioPolicyService.cpp
+++ b/media/libaudioclient/IAudioPolicyService.cpp
@@ -104,6 +104,7 @@
GET_VOLUME_GROUP_FOR_ATTRIBUTES,
SET_ALLOWED_CAPTURE_POLICY,
MOVE_EFFECTS_TO_IO,
+ SET_RTT_ENABLED
};
#define MAX_ITEMS_PER_LIST 1024
@@ -1271,6 +1272,18 @@
volumeGroup = static_cast<volume_group_t>(reply.readInt32());
return NO_ERROR;
}
+
+ virtual status_t setRttEnabled(bool enabled)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
+ data.writeInt32(static_cast<int32_t>(enabled));
+ status_t status = remote()->transact(SET_RTT_ENABLED, data, &reply);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return static_cast<status_t>(reply.readInt32());
+ }
};
IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService");
@@ -1332,7 +1345,8 @@
case REMOVE_UID_DEVICE_AFFINITY:
case GET_OFFLOAD_FORMATS_A2DP:
case LIST_AUDIO_VOLUME_GROUPS:
- case GET_VOLUME_GROUP_FOR_ATTRIBUTES: {
+ case GET_VOLUME_GROUP_FOR_ATTRIBUTES:
+ case SET_RTT_ENABLED: {
if (!isServiceUid(IPCThreadState::self()->getCallingUid())) {
ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
__func__, code, IPCThreadState::self()->getCallingPid(),
@@ -2347,6 +2361,14 @@
return NO_ERROR;
}
+ case SET_RTT_ENABLED: {
+ CHECK_INTERFACE(IAudioPolicyService, data, reply);
+ bool enabled = static_cast<bool>(data.readInt32());
+ status_t status = setRttEnabled(enabled);
+ reply->writeInt32(status);
+ return NO_ERROR;
+ }
+
default:
return BBinder::onTransact(code, data, reply, flags);
}