Loading packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/interactor/MediaControlInteractorTest.kt +14 −7 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ class MediaControlInteractorTest : SysuiTestCase() { MediaData( userId = USER_ID, instanceId = InstanceId.fakeInstanceId(2), artist = ARTIST artist = ARTIST, ) mediaDataFilter.onMediaDataLoaded(KEY, KEY, mediaData) Loading @@ -145,10 +145,17 @@ class MediaControlInteractorTest : SysuiTestCase() { val clickIntent = mock<PendingIntent> { whenever(it.isActivity).thenReturn(true) } val expandable = mock<Expandable>() val activityController = mock<ActivityTransitionAnimator.Controller>() whenever(expandable.activityTransitionController(any())).thenReturn(activityController) underTest.startClickIntent(expandable, clickIntent, SMARTSPACE_CARD_CLICK_EVENT, 1) verify(clickIntent).send(any<Bundle>()) verify(activityStarter) .startPendingIntentMaybeDismissingKeyguard( eq(clickIntent), eq(null), eq(activityController), ) } @Test Loading @@ -174,7 +181,7 @@ class MediaControlInteractorTest : SysuiTestCase() { mediaData.appUid, surface = SURFACE, cardinality = 2, rank = 1 rank = 1, ) verify(activityStarter) .postStartActivityDismissingKeyguard(eq(clickIntent), eq(activityController)) Loading Loading @@ -232,7 +239,7 @@ class MediaControlInteractorTest : SysuiTestCase() { eq(true), eq(dialogTransitionController), eq(null), eq(null) eq(null), ) } Loading @@ -248,7 +255,7 @@ class MediaControlInteractorTest : SysuiTestCase() { .createBroadcastDialogWithController( eq(APP_NAME), eq(PACKAGE_NAME), eq(dialogTransitionController) eq(dialogTransitionController), ) } Loading Loading @@ -279,7 +286,7 @@ class MediaControlInteractorTest : SysuiTestCase() { anyInt(), anyInt(), anyInt(), anyBoolean() anyBoolean(), ) verify(listener).onMediaDataRemoved(eq(KEY), eq(true)) } Loading Loading @@ -307,7 +314,7 @@ class MediaControlInteractorTest : SysuiTestCase() { mediaData.appUid, surface = SURFACE, cardinality = 2, rank = 1 rank = 1, ) verify(listener).onMediaDataRemoved(eq(KEY), eq(true)) } Loading packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/interactor/MediaControlInteractor.kt +21 −8 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ constructor( location: Int, ) { logSmartspaceUserEvent(eventId, location) if (!launchOverLockscreen(clickIntent)) { if (!launchOverLockscreen(expandable, clickIntent)) { activityStarter.postStartActivityDismissingKeyguard( clickIntent, expandable.activityTransitionController(Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER), Loading @@ -135,7 +135,7 @@ constructor( fun startDeviceIntent(deviceIntent: PendingIntent) { if (deviceIntent.isActivity) { if (!launchOverLockscreen(deviceIntent)) { if (!launchOverLockscreen(expandable = null, deviceIntent)) { activityStarter.postStartActivityDismissingKeyguard(deviceIntent) } } else { Loading @@ -143,7 +143,10 @@ constructor( } } private fun launchOverLockscreen(pendingIntent: PendingIntent): Boolean { private fun launchOverLockscreen( expandable: Expandable?, pendingIntent: PendingIntent, ): Boolean { val showOverLockscreen = keyguardStateController.isShowing && activityIntentHelper.wouldPendingShowOverLockscreen( Loading @@ -152,11 +155,21 @@ constructor( ) if (showOverLockscreen) { try { if (expandable != null) { activityStarter.startPendingIntentMaybeDismissingKeyguard( pendingIntent, /* intentSentUiThreadCallback = */ null, expandable.activityTransitionController( Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER ), ) } else { val options = BroadcastOptions.makeBasic() options.isInteractive = true options.pendingIntentBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED pendingIntent.send(options.toBundle()) } } catch (e: PendingIntent.CanceledException) { Log.e(TAG, "pending intent of $instanceId was canceled") } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/interactor/MediaControlInteractorTest.kt +14 −7 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ class MediaControlInteractorTest : SysuiTestCase() { MediaData( userId = USER_ID, instanceId = InstanceId.fakeInstanceId(2), artist = ARTIST artist = ARTIST, ) mediaDataFilter.onMediaDataLoaded(KEY, KEY, mediaData) Loading @@ -145,10 +145,17 @@ class MediaControlInteractorTest : SysuiTestCase() { val clickIntent = mock<PendingIntent> { whenever(it.isActivity).thenReturn(true) } val expandable = mock<Expandable>() val activityController = mock<ActivityTransitionAnimator.Controller>() whenever(expandable.activityTransitionController(any())).thenReturn(activityController) underTest.startClickIntent(expandable, clickIntent, SMARTSPACE_CARD_CLICK_EVENT, 1) verify(clickIntent).send(any<Bundle>()) verify(activityStarter) .startPendingIntentMaybeDismissingKeyguard( eq(clickIntent), eq(null), eq(activityController), ) } @Test Loading @@ -174,7 +181,7 @@ class MediaControlInteractorTest : SysuiTestCase() { mediaData.appUid, surface = SURFACE, cardinality = 2, rank = 1 rank = 1, ) verify(activityStarter) .postStartActivityDismissingKeyguard(eq(clickIntent), eq(activityController)) Loading Loading @@ -232,7 +239,7 @@ class MediaControlInteractorTest : SysuiTestCase() { eq(true), eq(dialogTransitionController), eq(null), eq(null) eq(null), ) } Loading @@ -248,7 +255,7 @@ class MediaControlInteractorTest : SysuiTestCase() { .createBroadcastDialogWithController( eq(APP_NAME), eq(PACKAGE_NAME), eq(dialogTransitionController) eq(dialogTransitionController), ) } Loading Loading @@ -279,7 +286,7 @@ class MediaControlInteractorTest : SysuiTestCase() { anyInt(), anyInt(), anyInt(), anyBoolean() anyBoolean(), ) verify(listener).onMediaDataRemoved(eq(KEY), eq(true)) } Loading Loading @@ -307,7 +314,7 @@ class MediaControlInteractorTest : SysuiTestCase() { mediaData.appUid, surface = SURFACE, cardinality = 2, rank = 1 rank = 1, ) verify(listener).onMediaDataRemoved(eq(KEY), eq(true)) } Loading
packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/interactor/MediaControlInteractor.kt +21 −8 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ constructor( location: Int, ) { logSmartspaceUserEvent(eventId, location) if (!launchOverLockscreen(clickIntent)) { if (!launchOverLockscreen(expandable, clickIntent)) { activityStarter.postStartActivityDismissingKeyguard( clickIntent, expandable.activityTransitionController(Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER), Loading @@ -135,7 +135,7 @@ constructor( fun startDeviceIntent(deviceIntent: PendingIntent) { if (deviceIntent.isActivity) { if (!launchOverLockscreen(deviceIntent)) { if (!launchOverLockscreen(expandable = null, deviceIntent)) { activityStarter.postStartActivityDismissingKeyguard(deviceIntent) } } else { Loading @@ -143,7 +143,10 @@ constructor( } } private fun launchOverLockscreen(pendingIntent: PendingIntent): Boolean { private fun launchOverLockscreen( expandable: Expandable?, pendingIntent: PendingIntent, ): Boolean { val showOverLockscreen = keyguardStateController.isShowing && activityIntentHelper.wouldPendingShowOverLockscreen( Loading @@ -152,11 +155,21 @@ constructor( ) if (showOverLockscreen) { try { if (expandable != null) { activityStarter.startPendingIntentMaybeDismissingKeyguard( pendingIntent, /* intentSentUiThreadCallback = */ null, expandable.activityTransitionController( Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER ), ) } else { val options = BroadcastOptions.makeBasic() options.isInteractive = true options.pendingIntentBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED pendingIntent.send(options.toBundle()) } } catch (e: PendingIntent.CanceledException) { Log.e(TAG, "pending intent of $instanceId was canceled") } Loading