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

Commit 946fe3d8 authored by Beverly's avatar Beverly Committed by android-build-merger
Browse files

Merge "Check if stream exists on volume changed." into oc-dr1-dev am: 6526347a

am: 856b8b9e

Change-Id: Idd9d5abf5741b7bc040fbe2817e6cf465cff7386
parents 35b402df 856b8b9e
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -913,11 +913,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa

        @Override
        public void onRemoteUpdate(Token token, String name, PlaybackInfo pi) {
            if (!mRemoteStreams.containsKey(token)) {
                mRemoteStreams.put(token, mNextStream);
                if (D.BUG) Log.d(TAG, "onRemoteUpdate: " + name + " is stream " + mNextStream);
                mNextStream++;
            }
            addStream(token, "onRemoteUpdate");
            final int stream = mRemoteStreams.get(token);
            boolean changed = mState.states.indexOfKey(stream) < 0;
            final StreamState ss = streamStateW(stream);
@@ -942,6 +938,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa

        @Override
        public void onRemoteVolumeChanged(Token token, int flags) {
            addStream(token, "onRemoteVolumeChanged");
            final int stream = mRemoteStreams.get(token);
            final boolean showUI = shouldShowUI(flags);
            boolean changed = updateActiveStreamW(stream);
@@ -958,6 +955,11 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa

        @Override
        public void onRemoteRemoved(Token token) {
            if (!mRemoteStreams.containsKey(token)) {
                if (D.BUG) Log.d(TAG, "onRemoteRemoved: stream doesn't exist, "
                        + "aborting remote removed for token:" +  token.toString());
                return;
            }
            final int stream = mRemoteStreams.get(token);
            mState.states.remove(stream);
            if (mState.activeStream == stream) {
@@ -983,6 +985,15 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
            }
            return null;
        }

        private void addStream(Token token, String triggeringMethod) {
            if (!mRemoteStreams.containsKey(token)) {
                mRemoteStreams.put(token, mNextStream);
                if (D.BUG) Log.d(TAG, triggeringMethod + ": added stream " +  mNextStream
                        + " from token + "+ token.toString());
                mNextStream++;
            }
        }
    }

    public interface UserActivityListener {