Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a28126a authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

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
parent ed9f3ef9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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