Merge "API changes for audio recording notifications" into nyc-dev am: b74926232e
am: 6bc51e0e5c
* commit '6bc51e0e5cb318bc9c1c92a1f70a434614a741fc':
API changes for audio recording notifications
This commit is contained in:
@@ -2147,9 +2147,10 @@ public class AudioManager {
|
||||
}
|
||||
break;
|
||||
case MSSG_RECORDING_CONFIG_CHANGE:
|
||||
final AudioRecordingCallback cb = (AudioRecordingCallback) msg.obj;
|
||||
if (cb != null) {
|
||||
cb.onRecordConfigChanged();
|
||||
final RecordConfigChangeCallbackData cbData =
|
||||
(RecordConfigChangeCallbackData) msg.obj;
|
||||
if (cbData.mCb != null) {
|
||||
cbData.mCb.onRecordConfigChanged(cbData.mConfigs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -2734,8 +2735,10 @@ public class AudioManager {
|
||||
public static abstract class AudioRecordingCallback {
|
||||
/**
|
||||
* Called whenever the device recording configuration has changed.
|
||||
* @param configs array containing the results of
|
||||
* {@link AudioManager#getActiveRecordConfigurations()}.
|
||||
*/
|
||||
public void onRecordConfigChanged() {}
|
||||
public void onRecordConfigChanged(AudioRecordConfiguration[] configs) {}
|
||||
}
|
||||
|
||||
private static class AudioRecordingCallbackInfo {
|
||||
@@ -2747,6 +2750,17 @@ public class AudioManager {
|
||||
}
|
||||
}
|
||||
|
||||
private final static class RecordConfigChangeCallbackData {
|
||||
final AudioRecordingCallback mCb;
|
||||
final AudioRecordConfiguration[] mConfigs;
|
||||
|
||||
RecordConfigChangeCallbackData(AudioRecordingCallback cb,
|
||||
AudioRecordConfiguration[] configs) {
|
||||
mCb = cb;
|
||||
mConfigs = configs;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to be notified of audio recording changes through
|
||||
* {@link AudioRecordingCallback}
|
||||
@@ -2882,14 +2896,15 @@ public class AudioManager {
|
||||
|
||||
private final IRecordingConfigDispatcher mRecCb = new IRecordingConfigDispatcher.Stub() {
|
||||
|
||||
public void dispatchRecordingConfigChange() {
|
||||
public void dispatchRecordingConfigChange(AudioRecordConfiguration[] configs) {
|
||||
synchronized(mRecordCallbackLock) {
|
||||
if (mRecordCallbackList != null) {
|
||||
for (int i=0 ; i < mRecordCallbackList.size() ; i++) {
|
||||
final AudioRecordingCallbackInfo arci = mRecordCallbackList.get(i);
|
||||
if (arci.mHandler != null) {
|
||||
final Message m = arci.mHandler.obtainMessage(
|
||||
MSSG_RECORDING_CONFIG_CHANGE/*what*/, arci.mCb/*obj*/);
|
||||
MSSG_RECORDING_CONFIG_CHANGE/*what*/,
|
||||
new RecordConfigChangeCallbackData(arci.mCb, configs)/*obj*/);
|
||||
arci.mHandler.sendMessage(m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,13 @@
|
||||
|
||||
package android.media;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -53,6 +56,19 @@ public final class AudioRecordConfiguration implements Parcelable {
|
||||
mPatchHandle = patchHandle;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@IntDef({
|
||||
MediaRecorder.AudioSource.DEFAULT,
|
||||
MediaRecorder.AudioSource.VOICE_UPLINK,
|
||||
MediaRecorder.AudioSource.VOICE_DOWNLINK,
|
||||
MediaRecorder.AudioSource.VOICE_CALL,
|
||||
MediaRecorder.AudioSource.CAMCORDER,
|
||||
MediaRecorder.AudioSource.VOICE_RECOGNITION,
|
||||
MediaRecorder.AudioSource.VOICE_COMMUNICATION
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AudioSource {}
|
||||
|
||||
/**
|
||||
* Returns the audio source being used for the recording.
|
||||
* @return one of {@link MediaRecorder.AudioSource#MIC},
|
||||
@@ -63,7 +79,7 @@ public final class AudioRecordConfiguration implements Parcelable {
|
||||
* {@link MediaRecorder.AudioSource#VOICE_RECOGNITION},
|
||||
* {@link MediaRecorder.AudioSource#VOICE_COMMUNICATION}.
|
||||
*/
|
||||
public int getClientAudioSource() { return mClientSource; }
|
||||
public @AudioSource int getClientAudioSource() { return mClientSource; }
|
||||
|
||||
/**
|
||||
* Returns the session number of the recording, see {@link AudioRecord#getAudioSessionId()}.
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.media;
|
||||
|
||||
import android.media.AudioRecordConfiguration;
|
||||
|
||||
/**
|
||||
* AIDL for the RecordingActivity monitor in AudioService to signal audio recording updates.
|
||||
*
|
||||
@@ -23,6 +25,6 @@ package android.media;
|
||||
*/
|
||||
oneway interface IRecordingConfigDispatcher {
|
||||
|
||||
void dispatchRecordingConfigChange();
|
||||
void dispatchRecordingConfigChange(in AudioRecordConfiguration[] configs);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user