Allow DEFAULT_INPUT_METHOD to capture audio during RTT call
The UID of the current InputMethodService (DEFAULT_INPUT_METHOD) is
pushed from AudioService to AudioPolicyService via AudioSystem.
Allow capture audio if:
- the UID is the current InputMethodService's UID,
- AND a RTT call is active,
- AND the source is AUDIO_SOURCE_VOICE_RECOGNITION.
Bug: 147037345
Test: use voice input with Gboard 9.1.4 during a simulated RTT call.
Change-Id: Ib32ec25e962833eddd0320742e177e3c1e0e5c05
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index b961209..ff2608c 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -1479,6 +1479,14 @@
return aps->setA11yServicesUids(uids);
}
+status_t AudioSystem::setCurrentImeUid(uid_t uid)
+{
+ const sp <IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ if (aps == 0) return PERMISSION_DENIED;
+
+ return aps->setCurrentImeUid(uid);
+}
+
bool AudioSystem::isHapticPlaybackSupported()
{
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();