Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt +11 −11 Original line number Diff line number Diff line Loading @@ -590,6 +590,17 @@ constructor( ?: mediaCarouselScrollHandler.scrollToPlayer(destIndex = mediaIndex) } } // Check postcondition: mediaContent should have the same number of children as there // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.e( TAG, "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}." ) } } // Returns true if new player is added Loading Loading @@ -665,17 +676,6 @@ constructor( updatePageIndicator() mediaCarouselScrollHandler.onPlayersChanged() mediaFrame.requiresRemeasuring = true // Check postcondition: mediaContent should have the same number of children as there // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.e( TAG, "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 packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt +5 −26 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -107,7 +106,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { @Captor lateinit var listener: ArgumentCaptor<MediaDataManager.Listener> @Captor lateinit var configListener: ArgumentCaptor<ConfigurationController.ConfigurationListener> @Captor lateinit var newConfig: ArgumentCaptor<Configuration> @Captor lateinit var visualStabilityCallback: ArgumentCaptor<OnReorderingAllowedListener> @Captor lateinit var keyguardCallback: ArgumentCaptor<KeyguardUpdateMonitorCallback> Loading Loading @@ -150,7 +148,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { MediaPlayerData.clear() } @Ignore("b/253229241") @Test fun testPlayerOrdering() { // Test values: key, data, last active time Loading Loading @@ -327,7 +324,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { } } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized() { testPlayerOrdering() Loading @@ -335,7 +331,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { // If smartspace is prioritized MediaPlayerData.addMediaRecommendation( SMARTSPACE_KEY, EMPTY_SMARTSPACE_MEDIA_DATA, EMPTY_SMARTSPACE_MEDIA_DATA.copy(isActive = true), panel, true, clock Loading @@ -345,7 +341,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized_updatingVisibleMediaPlayers() { testPlayerOrdering() Loading @@ -362,7 +357,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.visiblePlayerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_notPrioritized() { testPlayerOrdering() Loading @@ -370,7 +364,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { // If smartspace is not prioritized MediaPlayerData.addMediaRecommendation( SMARTSPACE_KEY, EMPTY_SMARTSPACE_MEDIA_DATA, EMPTY_SMARTSPACE_MEDIA_DATA.copy(isActive = true), panel, false, clock Loading @@ -381,7 +375,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(idx).isSsMediaRec) } @Ignore("b/253229241") @Test fun testPlayingExistingMediaPlayerFromCarousel_visibleMediaPlayersNotUpdated() { testPlayerOrdering() Loading Loading @@ -419,7 +412,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { ) } @Ignore("b/253229241") @Test fun testSwipeDismiss_logged() { mediaCarouselController.mediaCarouselScrollHandler.dismissCallback.invoke() Loading @@ -427,7 +419,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logSwipeDismiss() } @Ignore("b/253229241") @Test fun testSettingsButton_logged() { mediaCarouselController.settingsButton.callOnClick() Loading @@ -435,18 +426,16 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselSettings() } @Ignore("b/253229241") @Test fun testLocationChangeQs_logged() { mediaCarouselController.onDesiredLocationChanged( MediaHierarchyManager.LOCATION_QS, LOCATION_QS, mediaHostState, animate = false ) verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QS) verify(logger).logCarouselPosition(LOCATION_QS) } @Ignore("b/253229241") @Test fun testLocationChangeQqs_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -457,7 +446,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QQS) } @Ignore("b/253229241") @Test fun testLocationChangeLockscreen_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -468,7 +456,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_LOCKSCREEN) } @Ignore("b/253229241") @Test fun testLocationChangeDream_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -479,7 +466,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_DREAM_OVERLAY) } @Ignore("b/253229241") @Test fun testRecommendationRemoved_logged() { val packageName = "smartspace package" Loading @@ -493,7 +479,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logRecommendationRemoved(eq(packageName), eq(instanceId!!)) } @Ignore("b/253229241") @Test fun testMediaLoaded_ScrollToActivePlayer() { listener.value.onMediaDataLoaded( Loading Loading @@ -551,7 +536,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { ) } @Ignore("b/253229241") @Test fun testMediaLoadedFromRecommendationCard_ScrollToActivePlayer() { listener.value.onSmartspaceMediaDataLoaded( Loading Loading @@ -595,7 +579,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(playerIndex, 0) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileNotVisible_updateHostVisibility() { var result = false Loading @@ -607,7 +590,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileVisible_thenReorders_updateHostVisibility() { var result = false Loading @@ -621,7 +603,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testGetCurrentVisibleMediaContentIntent() { val clickIntent1 = mock(PendingIntent::class.java) Loading Loading @@ -668,7 +649,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(mediaCarouselController.getCurrentVisibleMediaContentIntent(), clickIntent2) } @Ignore("b/253229241") @Test fun testSetCurrentState_UpdatePageIndicatorAlphaWhenSquish() { val delta = 0.0001F Loading @@ -690,7 +670,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(pageIndicator).alpha = floatThat { abs(it - 1.0F) < delta } } @Ignore("b/253229241") @Test fun testOnConfigChanged_playersAreAddedBack() { listener.value.onMediaDataLoaded( Loading @@ -716,7 +695,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { val playersSize = MediaPlayerData.players().size configListener.value.onConfigChanged(capture(newConfig)) configListener.value.onConfigChanged(Configuration()) assertEquals(playersSize, MediaPlayerData.players().size) assertEquals( Loading Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt +11 −11 Original line number Diff line number Diff line Loading @@ -590,6 +590,17 @@ constructor( ?: mediaCarouselScrollHandler.scrollToPlayer(destIndex = mediaIndex) } } // Check postcondition: mediaContent should have the same number of children as there // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.e( TAG, "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}." ) } } // Returns true if new player is added Loading Loading @@ -665,17 +676,6 @@ constructor( updatePageIndicator() mediaCarouselScrollHandler.onPlayersChanged() mediaFrame.requiresRemeasuring = true // Check postcondition: mediaContent should have the same number of children as there // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { Log.e( TAG, "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
packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt +5 −26 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -107,7 +106,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { @Captor lateinit var listener: ArgumentCaptor<MediaDataManager.Listener> @Captor lateinit var configListener: ArgumentCaptor<ConfigurationController.ConfigurationListener> @Captor lateinit var newConfig: ArgumentCaptor<Configuration> @Captor lateinit var visualStabilityCallback: ArgumentCaptor<OnReorderingAllowedListener> @Captor lateinit var keyguardCallback: ArgumentCaptor<KeyguardUpdateMonitorCallback> Loading Loading @@ -150,7 +148,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { MediaPlayerData.clear() } @Ignore("b/253229241") @Test fun testPlayerOrdering() { // Test values: key, data, last active time Loading Loading @@ -327,7 +324,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { } } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized() { testPlayerOrdering() Loading @@ -335,7 +331,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { // If smartspace is prioritized MediaPlayerData.addMediaRecommendation( SMARTSPACE_KEY, EMPTY_SMARTSPACE_MEDIA_DATA, EMPTY_SMARTSPACE_MEDIA_DATA.copy(isActive = true), panel, true, clock Loading @@ -345,7 +341,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_prioritized_updatingVisibleMediaPlayers() { testPlayerOrdering() Loading @@ -362,7 +357,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.visiblePlayerKeys().elementAt(2).isSsMediaRec) } @Ignore("b/253229241") @Test fun testOrderWithSmartspace_notPrioritized() { testPlayerOrdering() Loading @@ -370,7 +364,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { // If smartspace is not prioritized MediaPlayerData.addMediaRecommendation( SMARTSPACE_KEY, EMPTY_SMARTSPACE_MEDIA_DATA, EMPTY_SMARTSPACE_MEDIA_DATA.copy(isActive = true), panel, false, clock Loading @@ -381,7 +375,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertTrue(MediaPlayerData.playerKeys().elementAt(idx).isSsMediaRec) } @Ignore("b/253229241") @Test fun testPlayingExistingMediaPlayerFromCarousel_visibleMediaPlayersNotUpdated() { testPlayerOrdering() Loading Loading @@ -419,7 +412,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { ) } @Ignore("b/253229241") @Test fun testSwipeDismiss_logged() { mediaCarouselController.mediaCarouselScrollHandler.dismissCallback.invoke() Loading @@ -427,7 +419,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logSwipeDismiss() } @Ignore("b/253229241") @Test fun testSettingsButton_logged() { mediaCarouselController.settingsButton.callOnClick() Loading @@ -435,18 +426,16 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselSettings() } @Ignore("b/253229241") @Test fun testLocationChangeQs_logged() { mediaCarouselController.onDesiredLocationChanged( MediaHierarchyManager.LOCATION_QS, LOCATION_QS, mediaHostState, animate = false ) verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QS) verify(logger).logCarouselPosition(LOCATION_QS) } @Ignore("b/253229241") @Test fun testLocationChangeQqs_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -457,7 +446,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_QQS) } @Ignore("b/253229241") @Test fun testLocationChangeLockscreen_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -468,7 +456,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_LOCKSCREEN) } @Ignore("b/253229241") @Test fun testLocationChangeDream_logged() { mediaCarouselController.onDesiredLocationChanged( Loading @@ -479,7 +466,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logCarouselPosition(MediaHierarchyManager.LOCATION_DREAM_OVERLAY) } @Ignore("b/253229241") @Test fun testRecommendationRemoved_logged() { val packageName = "smartspace package" Loading @@ -493,7 +479,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(logger).logRecommendationRemoved(eq(packageName), eq(instanceId!!)) } @Ignore("b/253229241") @Test fun testMediaLoaded_ScrollToActivePlayer() { listener.value.onMediaDataLoaded( Loading Loading @@ -551,7 +536,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { ) } @Ignore("b/253229241") @Test fun testMediaLoadedFromRecommendationCard_ScrollToActivePlayer() { listener.value.onSmartspaceMediaDataLoaded( Loading Loading @@ -595,7 +579,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(playerIndex, 0) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileNotVisible_updateHostVisibility() { var result = false Loading @@ -607,7 +590,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testRecommendationRemovedWhileVisible_thenReorders_updateHostVisibility() { var result = false Loading @@ -621,7 +603,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(true, result) } @Ignore("b/253229241") @Test fun testGetCurrentVisibleMediaContentIntent() { val clickIntent1 = mock(PendingIntent::class.java) Loading Loading @@ -668,7 +649,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { assertEquals(mediaCarouselController.getCurrentVisibleMediaContentIntent(), clickIntent2) } @Ignore("b/253229241") @Test fun testSetCurrentState_UpdatePageIndicatorAlphaWhenSquish() { val delta = 0.0001F Loading @@ -690,7 +670,6 @@ class MediaCarouselControllerTest : SysuiTestCase() { verify(pageIndicator).alpha = floatThat { abs(it - 1.0F) < delta } } @Ignore("b/253229241") @Test fun testOnConfigChanged_playersAreAddedBack() { listener.value.onMediaDataLoaded( Loading @@ -716,7 +695,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { val playersSize = MediaPlayerData.players().size configListener.value.onConfigChanged(capture(newConfig)) configListener.value.onConfigChanged(Configuration()) assertEquals(playersSize, MediaPlayerData.players().size) assertEquals( Loading