Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt +10 −2 Original line number Diff line number Diff line Loading @@ -610,7 +610,11 @@ constructor( // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.wtf(TAG, "Size of players list and number of views in carousel are out of sync") throw IllegalStateException( "Size of players list and number of views in carousel are out of sync. " + "Players size is ${MediaPlayerData.players().size}. " + "View count is ${mediaContent.childCount}." ) } return existingPlayer == null } Loading Loading @@ -667,7 +671,11 @@ constructor( // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.wtf(TAG, "Size of players list and number of views in carousel are out of sync") throw IllegalStateException( "Size of players list and number of views in carousel are out of sync. " + "Players size is ${MediaPlayerData.players().size}. " + "View count is ${mediaContent.childCount}." ) } } Loading packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt +20 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import javax.inject.Provider import junit.framework.Assert.assertEquals import junit.framework.Assert.assertTrue import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -119,6 +120,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { MediaPlayerData.clear() } @Ignore("b/253229241") @Test fun testPlayerOrdering() { // Test values: key, data, last active time Loading Loading @@ -295,6 +297,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { } } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized() { testPlayerOrdering() Loading @@ -312,6 +315,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized_updatingVisibleMediaPlayers() { testPlayerOrdering() Loading @@ -328,6 +332,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.visiblePlayerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_notPrioritized() { testPlayerOrdering() Loading @@ -346,6 +351,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(idx).isSsMediaRec) } @Ignore("b/253229241") @Test fun testPlayingExistingMediaPlayerFromCarousel_visibleMediaPlayersNotUpdated() { testPlayerOrdering() Loading Loading @@ -382,6 +388,8 @@ class MediaCarouselControllerTest : SysuiTestCase() { MediaPlayerData.playerKeys().elementAt(0) ) } @Ignore("b/253229241") @Test fun testSwipeDismiss_logged() { mediaCarouselController.mediaCarouselScrollHandler.dismissCallback.invoke() Loading @@ -389,6 +397,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logSwipeDismiss() } @Ignore("b/253229241") @Test fun testSettingsButton_logged() { mediaCarouselController.settingsButton.callOnClick() Loading @@ -396,6 +405,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselSettings() } @Ignore("b/253229241") @Test fun testLocationChangeQs_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -406,6 +416,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QS) } @Ignore("b/253229241") @Test fun testLocationChangeQqs_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -416,6 +427,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QQS) } @Ignore("b/253229241") @Test fun testLocationChangeLockscreen_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -426,6 +438,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_LOCKSCREEN) } @Ignore("b/253229241") @Test fun testLocationChangeDream_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -436,6 +449,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_DREAM_OVERLAY) } @Ignore("b/253229241") @Test fun testRecommendationRemoved_logged() { val packageName = "smartspace package" Loading @@ -449,6 +463,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logRecommendationRemoved(eq(packageName), eq(instanceId!!)) } @Ignore("b/253229241") @Test fun testMediaLoaded_ScrollToActivePlayer() { listener.value.onMediaDataLoaded( Loading Loading @@ -506,6 +521,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { ) } @Ignore("b/253229241") @Test fun testMediaLoadedFromRecommendationCard_ScrollToActivePlayer() { listener.value.onSmartspaceMediaDataLoaded( Loading Loading @@ -549,6 +565,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(playerIndex, 0) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileNotVisible_updateHostVisibility() { var result = false Loading @@ -560,6 +577,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileVisible_thenReorders_updateHostVisibility() { var result = false Loading @@ -573,6 +591,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testGetCurrentVisibleMediaContentIntent() { val clickIntent1 = mock(PendingIntent::class.java) Loading Loading @@ -619,6 +638,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(mediaCarouselController.getCurrentVisibleMediaContentIntent(), clickIntent2) } @Ignore("b/253229241") @Test fun testSetCurrentState_UpdatePageIndicatorAlphaWhenSquish() { val delta = 0.0001F Loading Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt +10 −2 Original line number Diff line number Diff line Loading @@ -610,7 +610,11 @@ constructor( // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.wtf(TAG, "Size of players list and number of views in carousel are out of sync") throw IllegalStateException( "Size of players list and number of views in carousel are out of sync. " + "Players size is ${MediaPlayerData.players().size}. " + "View count is ${mediaContent.childCount}." ) } return existingPlayer == null } Loading Loading @@ -667,7 +671,11 @@ constructor( // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.wtf(TAG, "Size of players list and number of views in carousel are out of sync") throw IllegalStateException( "Size of players list and number of views in carousel are out of sync. " + "Players size is ${MediaPlayerData.players().size}. " + "View count is ${mediaContent.childCount}." ) } } Loading
packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt +20 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import javax.inject.Provider import junit.framework.Assert.assertEquals import junit.framework.Assert.assertTrue import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -119,6 +120,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { MediaPlayerData.clear() } @Ignore("b/253229241") @Test fun testPlayerOrdering() { // Test values: key, data, last active time Loading Loading @@ -295,6 +297,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { } } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized() { testPlayerOrdering() Loading @@ -312,6 +315,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized_updatingVisibleMediaPlayers() { testPlayerOrdering() Loading @@ -328,6 +332,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.visiblePlayerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_notPrioritized() { testPlayerOrdering() Loading @@ -346,6 +351,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(idx).isSsMediaRec) } @Ignore("b/253229241") @Test fun testPlayingExistingMediaPlayerFromCarousel_visibleMediaPlayersNotUpdated() { testPlayerOrdering() Loading Loading @@ -382,6 +388,8 @@ class MediaCarouselControllerTest : SysuiTestCase() { MediaPlayerData.playerKeys().elementAt(0) ) } @Ignore("b/253229241") @Test fun testSwipeDismiss_logged() { mediaCarouselController.mediaCarouselScrollHandler.dismissCallback.invoke() Loading @@ -389,6 +397,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logSwipeDismiss() } @Ignore("b/253229241") @Test fun testSettingsButton_logged() { mediaCarouselController.settingsButton.callOnClick() Loading @@ -396,6 +405,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselSettings() } @Ignore("b/253229241") @Test fun testLocationChangeQs_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -406,6 +416,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QS) } @Ignore("b/253229241") @Test fun testLocationChangeQqs_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -416,6 +427,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QQS) } @Ignore("b/253229241") @Test fun testLocationChangeLockscreen_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -426,6 +438,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_LOCKSCREEN) } @Ignore("b/253229241") @Test fun testLocationChangeDream_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -436,6 +449,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_DREAM_OVERLAY) } @Ignore("b/253229241") @Test fun testRecommendationRemoved_logged() { val packageName = "smartspace package" Loading @@ -449,6 +463,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logRecommendationRemoved(eq(packageName), eq(instanceId!!)) } @Ignore("b/253229241") @Test fun testMediaLoaded_ScrollToActivePlayer() { listener.value.onMediaDataLoaded( Loading Loading @@ -506,6 +521,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { ) } @Ignore("b/253229241") @Test fun testMediaLoadedFromRecommendationCard_ScrollToActivePlayer() { listener.value.onSmartspaceMediaDataLoaded( Loading Loading @@ -549,6 +565,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(playerIndex, 0) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileNotVisible_updateHostVisibility() { var result = false Loading @@ -560,6 +577,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileVisible_thenReorders_updateHostVisibility() { var result = false Loading @@ -573,6 +591,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testGetCurrentVisibleMediaContentIntent() { val clickIntent1 = mock(PendingIntent::class.java) Loading Loading @@ -619,6 +638,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(mediaCarouselController.getCurrentVisibleMediaContentIntent(), clickIntent2) } @Ignore("b/253229241") @Test fun testSetCurrentState_UpdatePageIndicatorAlphaWhenSquish() { val delta = 0.0001F Loading