RecordingActivityMonitor: remove spam from death events

Release death handler when its recorder is removed from tracking
to avoid logspam of "Unexpected event" messages.

Bug: 136279123
Test: atest android.media.cts.AudioRecordingConfigurationTest
      adb shell logcat | grep "Unexpected event"

Change-Id: I085ee545a07c7d3ada05c575878998a0e76a135b
This commit is contained in:
Mikhail Naganov
2019-07-01 09:09:45 -07:00
parent 2c36755079
commit 27c6887a9b

View File

@@ -86,6 +86,12 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
return mIsActive && mConfig != null;
}
void release() {
if (mDeathHandler != null) {
mDeathHandler.release();
}
}
// returns true if status of an active recording has changed
boolean setActive(boolean active) {
if (mIsActive == active) return false;
@@ -417,6 +423,7 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
break;
case AudioManager.RECORD_CONFIG_EVENT_RELEASE:
configChanged = state.isActiveConfiguration();
state.release();
mRecordStates.remove(stateIndex);
break;
default:
@@ -519,6 +526,10 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
return false;
}
}
void release() {
mRecorderToken.unlinkToDeath(this, 0);
}
}
/**