diff options
Diffstat (limited to 'media/java/android/media/AudioRecord.java')
-rw-r--r-- | media/java/android/media/AudioRecord.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index 27cc220..c1ca2b0 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -903,6 +903,11 @@ public class AudioRecord mRecordingState = RECORDSTATE_RECORDING; } } + + if (getRecordingState() == RECORDSTATE_RECORDING && + getAudioSource() == MediaRecorder.AudioSource.HOTWORD) { + handleHotwordInput(true); + } } /** @@ -946,6 +951,10 @@ public class AudioRecord native_stop(); mRecordingState = RECORDSTATE_STOPPED; } + + if (getAudioSource() == MediaRecorder.AudioSource.HOTWORD) { + handleHotwordInput(false); + } } private final IBinder mICallBack = new Binder(); @@ -962,6 +971,16 @@ public class AudioRecord } } + private void handleHotwordInput(boolean listening) { + final IBinder b = ServiceManager.getService(android.content.Context.AUDIO_SERVICE); + final IAudioService ias = IAudioService.Stub.asInterface(b); + try { + ias.handleHotwordInput(listening); + } catch (RemoteException e) { + Log.e(TAG, "Error talking to AudioService when handling hotword input.", e); + } + } + //--------------------------------------------------------- // Audio data supply //-------------------- |