Merge "AudioService: implement de-registration (release) of recorders" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ef70c3781
@@ -3774,7 +3774,7 @@ public class AudioManager {
|
||||
/** @hide */
|
||||
public static final int RECORD_CONFIG_EVENT_UPDATE = 2;
|
||||
/** @hide */
|
||||
public static final int RECORD_CONFIG_EVENT_DEATH = 3;
|
||||
public static final int RECORD_CONFIG_EVENT_RELEASE = 3;
|
||||
/**
|
||||
* keep in sync with frameworks/native/include/audiomanager/AudioManager.h
|
||||
*/
|
||||
|
||||
@@ -64,6 +64,8 @@ interface IAudioService {
|
||||
|
||||
oneway void recorderEvent(in int riid, in int event);
|
||||
|
||||
oneway void releaseRecorder(in int riid);
|
||||
|
||||
// Java-only methods below.
|
||||
|
||||
oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags,
|
||||
|
||||
@@ -7071,6 +7071,13 @@ public class AudioService extends IAudioService.Stub
|
||||
mRecordMonitor.recorderEvent(riid, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop tracking the recorder
|
||||
*/
|
||||
public void releaseRecorder(int riid) {
|
||||
mRecordMonitor.releaseRecorder(riid);
|
||||
}
|
||||
|
||||
public void disableRingtoneSync(final int userId) {
|
||||
final int callingUserId = UserHandle.getCallingUserId();
|
||||
if (callingUserId != userId) {
|
||||
|
||||
@@ -176,8 +176,11 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
|
||||
dispatchCallbacks(updateSnapshot(configEvent, riid, null));
|
||||
}
|
||||
|
||||
void unregisterRecorder(int riid) {
|
||||
dispatchCallbacks(updateSnapshot(AudioManager.RECORD_CONFIG_EVENT_DEATH, riid, null));
|
||||
/**
|
||||
* Stop tracking the recorder
|
||||
*/
|
||||
public void releaseRecorder(int riid) {
|
||||
dispatchCallbacks(updateSnapshot(AudioManager.RECORD_CONFIG_EVENT_RELEASE, riid, null));
|
||||
}
|
||||
|
||||
private void dispatchCallbacks(List<AudioRecordingConfiguration> configs) {
|
||||
@@ -246,7 +249,7 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
|
||||
if (state.isActiveConfiguration()) {
|
||||
configChanged = true;
|
||||
sEventLogger.log(new RecordingEvent(
|
||||
AudioManager.RECORD_CONFIG_EVENT_DEATH,
|
||||
AudioManager.RECORD_CONFIG_EVENT_RELEASE,
|
||||
state.getRiid(), state.getConfig()));
|
||||
}
|
||||
it.remove();
|
||||
@@ -396,7 +399,7 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
|
||||
switch (event) {
|
||||
case AudioManager.RECORD_CONFIG_EVENT_START:
|
||||
configChanged = state.setActive(true);
|
||||
if (config != null) { // ??? Can remove ???
|
||||
if (config != null) {
|
||||
configChanged = state.setConfig(config) || configChanged;
|
||||
}
|
||||
break;
|
||||
@@ -412,7 +415,7 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
|
||||
mRecordStates.remove(stateIndex);
|
||||
}
|
||||
break;
|
||||
case AudioManager.RECORD_CONFIG_EVENT_DEATH:
|
||||
case AudioManager.RECORD_CONFIG_EVENT_RELEASE:
|
||||
configChanged = state.isActiveConfiguration();
|
||||
mRecordStates.remove(stateIndex);
|
||||
break;
|
||||
@@ -504,7 +507,7 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
|
||||
}
|
||||
|
||||
public void binderDied() {
|
||||
sMonitor.unregisterRecorder(mRiid);
|
||||
sMonitor.releaseRecorder(mRiid);
|
||||
}
|
||||
|
||||
boolean init() {
|
||||
@@ -553,8 +556,8 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
|
||||
return "update";
|
||||
case AudioManager.RECORD_CONFIG_EVENT_STOP:
|
||||
return "stop";
|
||||
case AudioManager.RECORD_CONFIG_EVENT_DEATH:
|
||||
return "death";
|
||||
case AudioManager.RECORD_CONFIG_EVENT_RELEASE:
|
||||
return "release";
|
||||
default:
|
||||
return "unknown (" + recEvent + ")";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user