diff options
| author | Ahaan Ugale <augale@google.com> | 2021-05-21 02:18:45 -0700 |
|---|---|---|
| committer | Ahaan Ugale <augale@google.com> | 2021-06-04 07:20:27 +0000 |
| commit | a64d628182dc3e5cf3bceec52d7f5aa53e268216 (patch) | |
| tree | df23b0551506f88def32532f27d6c20c496e35f8 /core/java | |
| parent | 1028eb2f62cc0fd4529039e6bc19d80d1759706b (diff) | |
Allow HotwordDetectionService access to audioflinger.
HotwordDetectionService is an isolated service which ordinarily cannot
access audioflinger due to selinux restrictions on isolated processes.
To bypass those restrictions, the audioflinger binder is passed from
the system server to the HotwordDetectionService. This follows the
existing pattern of providing access to the ContentCapture service.
In T we *may* instead solve this at the selinux layer. For now, this
simpler approach is used.
Bug: 190011174
Test: manual - sample app can read audio (with a few other wip changes)
Test: atest CtsVoiceInteractionTestCases
Change-Id: I5493a5c3addf68f2ae80d64b6971a8576484eb8e
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/service/voice/HotwordDetectionService.java | 6 | ||||
| -rw-r--r-- | core/java/android/service/voice/IHotwordDetectionService.aidl | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/service/voice/HotwordDetectionService.java b/core/java/android/service/voice/HotwordDetectionService.java index deb6c01a3088..b66d93d6316e 100644 --- a/core/java/android/service/voice/HotwordDetectionService.java +++ b/core/java/android/service/voice/HotwordDetectionService.java @@ -31,6 +31,7 @@ import android.content.Context; import android.content.Intent; import android.hardware.soundtrigger.SoundTrigger; import android.media.AudioFormat; +import android.media.AudioSystem; import android.os.Bundle; import android.os.IBinder; import android.os.IRemoteCallback; @@ -187,6 +188,11 @@ public abstract class HotwordDetectionService extends Service { } @Override + public void updateAudioFlinger(IBinder audioFlinger) { + AudioSystem.setAudioFlingerBinder(audioFlinger); + } + + @Override public void updateContentCaptureManager(IContentCaptureManager manager, ContentCaptureOptions options) { mContentCaptureManager = new ContentCaptureManager( diff --git a/core/java/android/service/voice/IHotwordDetectionService.aidl b/core/java/android/service/voice/IHotwordDetectionService.aidl index 72dd45aeeb0f..d7ed67812e87 100644 --- a/core/java/android/service/voice/IHotwordDetectionService.aidl +++ b/core/java/android/service/voice/IHotwordDetectionService.aidl @@ -19,6 +19,7 @@ package android.service.voice; import android.content.ContentCaptureOptions; import android.hardware.soundtrigger.SoundTrigger; import android.media.AudioFormat; +import android.os.IBinder; import android.os.IRemoteCallback; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; @@ -50,6 +51,8 @@ oneway interface IHotwordDetectionService { in SharedMemory sharedMemory, in IRemoteCallback callback); + void updateAudioFlinger(in IBinder audioFlinger); + void updateContentCaptureManager( in IContentCaptureManager contentCaptureManager, in ContentCaptureOptions options); |
