AudioPlaybackConfiguration release/death: notify listeners

When a player dies or is released, dispatch an update to the
  AudioPlaybackConfiguration listeners.

Bug: 70195346
Test: atest AudioPlaybackConfiguration#testCallbackMediaPlayerRelease
Change-Id: Id0b62abb32879d3166da26f20a334d0447183ac0
This commit is contained in:
Jean-Michel Trivi
2018-04-23 17:22:55 -07:00
parent ed9f3ef958
commit 2a28126af9

View File

@@ -267,6 +267,7 @@ public final class PlaybackActivityMonitor
public void releasePlayer(int piid, int binderUid) {
if (DEBUG) { Log.v(TAG, "releasePlayer() for piid=" + piid); }
boolean change = false;
synchronized(mPlayerLock) {
final AudioPlaybackConfiguration apc = mPlayers.get(new Integer(piid));
if (checkConfigurationCaller(piid, apc, binderUid)) {
@@ -275,9 +276,12 @@ public final class PlaybackActivityMonitor
mPlayers.remove(new Integer(piid));
mDuckingManager.removeReleased(apc);
checkVolumeForPrivilegedAlarm(apc, AudioPlaybackConfiguration.PLAYER_STATE_RELEASED);
apc.handleStateEvent(AudioPlaybackConfiguration.PLAYER_STATE_RELEASED);
change = apc.handleStateEvent(AudioPlaybackConfiguration.PLAYER_STATE_RELEASED);
}
}
if (change) {
dispatchPlaybackChange(true /*iplayerreleased*/);
}
}
// Implementation of AudioPlaybackConfiguration.PlayerDeathMonitor