Loading packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java +6 −0 Original line number Diff line number Diff line Loading @@ -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 = { Loading Loading @@ -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); Loading packages/SystemUI/src/com/android/systemui/media/MediaData.kt +5 −0 Original line number Diff line number Diff line Loading @@ -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.) */ Loading packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +2 −2 Original line number Diff line number Diff line Loading @@ -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)) } } Loading Loading @@ -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() Loading packages/SystemUI/tests/src/com/android/systemui/media/MediaControlPanelTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -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() } } packages/SystemUI/tests/src/com/android/systemui/media/MediaDataCombineLatestTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading
packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java +6 −0 Original line number Diff line number Diff line Loading @@ -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 = { Loading Loading @@ -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); Loading
packages/SystemUI/src/com/android/systemui/media/MediaData.kt +5 −0 Original line number Diff line number Diff line Loading @@ -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.) */ Loading
packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +2 −2 Original line number Diff line number Diff line Loading @@ -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)) } } Loading Loading @@ -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() Loading
packages/SystemUI/tests/src/com/android/systemui/media/MediaControlPanelTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -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() } }
packages/SystemUI/tests/src/com/android/systemui/media/MediaDataCombineLatestTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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