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

Commit f4b12ac2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

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

    // Button IDs for QS controls
    static final int[] ACTION_IDS = {
@@ -267,6 +268,11 @@ public class MediaControlPanel {
        mViewHolder.getSeamless().setVisibility(seamlessVisibility);
        expandedSet.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) {
            iconView.setImageDrawable(null);
            deviceName.setText(null);
+5 −0
Original line number Diff line number Diff line
@@ -80,6 +80,11 @@ data class MediaData(
     * Action that should be performed to restart a non active session.
     */
    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.)
     */
+2 −2
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ class MediaDataManager(
            onMediaDataLoaded(packageName, null, MediaData(true, bgColor, appName,
                    null, desc.subtitle, desc.title, artworkIcon, listOf(mediaAction), listOf(0),
                    packageName, token, appIntent, device = null, active = false,
                    resumeAction = resumeAction, notificationKey = packageName,
                    resumeAction = resumeAction, resumption = true, notificationKey = packageName,
                    hasCheckedForResume = true))
        }
    }
@@ -542,7 +542,7 @@ class MediaDataManager(
            val data = mediaEntries.remove(key)!!
            val resumeAction = getResumeMediaAction(data.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)
            // Notify listeners of "new" controls
            val listenersCopy = listeners.toSet()
+11 −0
Original line number Diff line number Diff line
@@ -242,4 +242,15 @@ public class MediaControlPanelTest : SysuiTestCase() {
        assertThat(seamlessText.getText()).isEqualTo(context.getResources().getString(
                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 Diff line number Diff line
@@ -79,8 +79,8 @@ public class MediaDataCombineLatestTest extends SysuiTestCase {
        mManager.addListener(mListener);

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

Loading