summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-09-04 18:02:20 -0700
committerSteve Kondik <steve@cyngn.com>2015-10-28 13:30:32 -0700
commitb09f7797429af5c0034d1a6c52c2a47a35b0e428 (patch)
tree90d7b719101a9df1d88da2801ccf3144f20b997b /media
parent66ed04e967adb4bb5545ecf06ce692c6e5b790ea (diff)
downloadframeworks_base-b09f7797429af5c0034d1a6c52c2a47a35b0e428.zip
frameworks_base-b09f7797429af5c0034d1a6c52c2a47a35b0e428.tar.gz
frameworks_base-b09f7797429af5c0034d1a6c52c2a47a35b0e428.tar.bz2
Add broadcast and query API for AudioSource.HOTWORD.
- When the AudioSource.HOTWORD input becomes active or is released, send a Broadcast with the package name and the new state of the audio input to any applications that hold CAPTURE_AUDIO_OUTPUT. - Store the package name of the application that controls the hOTWORD input or set it to null if the input is not in use. - Add a new method to AudioService to retrieve the package name of the application that currently controls the HOTWORD input. Change-Id: I2f11888f3711d23b6287a4de7b81d361734a8f3b
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioRecord.java19
-rw-r--r--media/java/android/media/IAudioService.aidl5
2 files changed, 24 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
//--------------------
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 0b98e1b..cdcd83c 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -227,4 +227,9 @@ interface IAudioService {
void addMediaPlayerAndUpdateRemoteController(String packageName);
void removeMediaPlayerAndUpdateRemoteController(String packageName);
+
+ void handleHotwordInput(boolean listening);
+
+ String getCurrentHotwordInputPackageName();
+
}