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

Commit 737c3f06 authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Use AnimLib launches for the UMO over the lockscreen (Flexiglass)." into main

parents 3e560f6c e4d75ab7
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ class MediaControlInteractorTest : SysuiTestCase() {
                MediaData(
                    userId = USER_ID,
                    instanceId = InstanceId.fakeInstanceId(2),
                    artist = ARTIST
                    artist = ARTIST,
                )

            mediaDataFilter.onMediaDataLoaded(KEY, KEY, mediaData)
@@ -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
@@ -174,7 +181,7 @@ class MediaControlInteractorTest : SysuiTestCase() {
                mediaData.appUid,
                surface = SURFACE,
                cardinality = 2,
                rank = 1
                rank = 1,
            )
        verify(activityStarter)
            .postStartActivityDismissingKeyguard(eq(clickIntent), eq(activityController))
@@ -232,7 +239,7 @@ class MediaControlInteractorTest : SysuiTestCase() {
                eq(true),
                eq(dialogTransitionController),
                eq(null),
                eq(null)
                eq(null),
            )
    }

@@ -248,7 +255,7 @@ class MediaControlInteractorTest : SysuiTestCase() {
            .createBroadcastDialogWithController(
                eq(APP_NAME),
                eq(PACKAGE_NAME),
                eq(dialogTransitionController)
                eq(dialogTransitionController),
            )
    }

@@ -279,7 +286,7 @@ class MediaControlInteractorTest : SysuiTestCase() {
                anyInt(),
                anyInt(),
                anyInt(),
                anyBoolean()
                anyBoolean(),
            )
        verify(listener).onMediaDataRemoved(eq(KEY), eq(true))
    }
@@ -307,7 +314,7 @@ class MediaControlInteractorTest : SysuiTestCase() {
                mediaData.appUid,
                surface = SURFACE,
                cardinality = 2,
                rank = 1
                rank = 1,
            )
        verify(listener).onMediaDataRemoved(eq(KEY), eq(true))
    }
+21 −8
Original line number Diff line number Diff line
@@ -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),
@@ -135,7 +135,7 @@ constructor(

    fun startDeviceIntent(deviceIntent: PendingIntent) {
        if (deviceIntent.isActivity) {
            if (!launchOverLockscreen(deviceIntent)) {
            if (!launchOverLockscreen(expandable = null, deviceIntent)) {
                activityStarter.postStartActivityDismissingKeyguard(deviceIntent)
            }
        } else {
@@ -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(
@@ -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")
            }