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

Commit 5c1b3be3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Disable output switcher in resumption controls" into rvc-dev am: f4b12ac2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11920146

Change-Id: I363ca7c778f050854900e8ba33fd8a4bb2ea015e
parents d29271dc f4b12ac2
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -57,6 +57,7 @@ import javax.inject.Inject;
 */
 */
public class MediaControlPanel {
public class MediaControlPanel {
    private static final String TAG = "MediaControlPanel";
    private static final String TAG = "MediaControlPanel";
    private static final float DISABLED_ALPHA = 0.38f;


    // Button IDs for QS controls
    // Button IDs for QS controls
    static final int[] ACTION_IDS = {
    static final int[] ACTION_IDS = {
@@ -267,6 +268,11 @@ public class MediaControlPanel {
        mViewHolder.getSeamless().setVisibility(seamlessVisibility);
        mViewHolder.getSeamless().setVisibility(seamlessVisibility);
        expandedSet.setVisibility(seamlessId, seamlessVisibility);
        expandedSet.setVisibility(seamlessId, seamlessVisibility);
        collapsedSet.setVisibility(seamlessId, seamlessVisibility);
        collapsedSet.setVisibility(seamlessId, seamlessVisibility);
        final float seamlessAlpha = data.getResumption() ? DISABLED_ALPHA : 1.0f;
        expandedSet.setAlpha(seamlessId, seamlessAlpha);
        collapsedSet.setAlpha(seamlessId, seamlessAlpha);
        // Disable clicking on output switcher for resumption controls.
        mViewHolder.getSeamless().setEnabled(!data.getResumption());
        if (showFallback) {
        if (showFallback) {
            iconView.setImageDrawable(null);
            iconView.setImageDrawable(null);
            deviceName.setText(null);
            deviceName.setText(null);
+5 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,11 @@ data class MediaData(
     * Action that should be performed to restart a non active session.
     * Action that should be performed to restart a non active session.
     */
     */
    var resumeAction: Runnable?,
    var resumeAction: Runnable?,
    /**
     * Indicates that this player is a resumption player (ie. It only shows a play actions which
     * will start the app and start playing).
     */
    var resumption: Boolean = false,
    /**
    /**
     * Notification key for cancelling a media player after a timeout (when not using resumption.)
     * Notification key for cancelling a media player after a timeout (when not using resumption.)
     */
     */
+2 −2
Original line number Original line Diff line number Diff line
@@ -323,7 +323,7 @@ class MediaDataManager(
            onMediaDataLoaded(packageName, null, MediaData(true, bgColor, appName,
            onMediaDataLoaded(packageName, null, MediaData(true, bgColor, appName,
                    null, desc.subtitle, desc.title, artworkIcon, listOf(mediaAction), listOf(0),
                    null, desc.subtitle, desc.title, artworkIcon, listOf(mediaAction), listOf(0),
                    packageName, token, appIntent, device = null, active = false,
                    packageName, token, appIntent, device = null, active = false,
                    resumeAction = resumeAction, notificationKey = packageName,
                    resumeAction = resumeAction, resumption = true, notificationKey = packageName,
                    hasCheckedForResume = true))
                    hasCheckedForResume = true))
        }
        }
    }
    }
@@ -542,7 +542,7 @@ class MediaDataManager(
            val data = mediaEntries.remove(key)!!
            val data = mediaEntries.remove(key)!!
            val resumeAction = getResumeMediaAction(data.resumeAction!!)
            val resumeAction = getResumeMediaAction(data.resumeAction!!)
            val updated = data.copy(token = null, actions = listOf(resumeAction),
            val updated = data.copy(token = null, actions = listOf(resumeAction),
                actionsToShowInCompact = listOf(0), active = false)
                    actionsToShowInCompact = listOf(0), active = false, resumption = true)
            mediaEntries.put(data.packageName, updated)
            mediaEntries.put(data.packageName, updated)
            // Notify listeners of "new" controls
            // Notify listeners of "new" controls
            val listenersCopy = listeners.toSet()
            val listenersCopy = listeners.toSet()
+11 −0
Original line number Original line Diff line number Diff line
@@ -242,4 +242,15 @@ public class MediaControlPanelTest : SysuiTestCase() {
        assertThat(seamlessText.getText()).isEqualTo(context.getResources().getString(
        assertThat(seamlessText.getText()).isEqualTo(context.getResources().getString(
                com.android.internal.R.string.ext_media_seamless_action))
                com.android.internal.R.string.ext_media_seamless_action))
    }
    }

    @Test
    fun bindDeviceResumptionPlayer() {
        player.attach(holder)
        val state = MediaData(true, BG_COLOR, APP, null, ARTIST, TITLE, null, emptyList(),
                emptyList(), PACKAGE, session.getSessionToken(), null, device, true, null,
                resumption = true)
        player.bind(state)
        assertThat(seamlessText.getText()).isEqualTo(DEVICE_NAME)
        assertThat(seamless.isEnabled()).isFalse()
    }
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -79,8 +79,8 @@ public class MediaDataCombineLatestTest extends SysuiTestCase {
        mManager.addListener(mListener);
        mManager.addListener(mListener);


        mMediaData = new MediaData(true, BG_COLOR, APP, null, ARTIST, TITLE, null,
        mMediaData = new MediaData(true, BG_COLOR, APP, null, ARTIST, TITLE, null,
                new ArrayList<>(), new ArrayList<>(), PACKAGE, null, null, null, true, null, KEY,
                new ArrayList<>(), new ArrayList<>(), PACKAGE, null, null, null, true, null, false,
                false);
                KEY, false);
        mDeviceData = new MediaDeviceData(true, null, DEVICE_NAME);
        mDeviceData = new MediaDeviceData(true, null, DEVICE_NAME);
    }
    }


Loading