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

Commit 7919bb8d authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Add unlock reason to alternate bouncer when starting activity" into main

parents 8704ecbb ce7fbc39
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() {
                /* animationController = */ notNull(),
                /* fillInIntent = */ refEq(fillInIntent),
                /* extraOptions = */ refEq(activityOptions.toBundle()),
                /* customMessage */ isNull(),
            )
    }

@@ -93,6 +94,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() {
                /* animationController = */ isNull(),
                /* fillInIntent = */ refEq(fillInIntent),
                /* extraOptions = */ refEq(activityOptions.toBundle()),
                /* customMessage */ isNull(),
            )
    }
}
+21 −0
Original line number Diff line number Diff line
@@ -153,6 +153,25 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
            .dismissWithAction(any(), eq(null), anyBoolean(), eq(null))
    }

    @Test
    fun startPendingIntentDismissingKeyguard_withCustomMessage_dismissWithAction() {
        val pendingIntent = mock(PendingIntent::class.java)
        `when`(pendingIntent.isActivity).thenReturn(true)
        `when`(keyguardStateController.isShowing).thenReturn(true)
        `when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true)
        val customMessage = "Custom unlock reason"

        underTest.startPendingIntentDismissingKeyguard(
            intent = pendingIntent,
            dismissShade = true,
            customMessage = customMessage
        )
        mainExecutor.runAllReady()

        verify(statusBarKeyguardViewManager)
            .dismissWithAction(any(), eq(null), anyBoolean(), eq(customMessage))
    }

    @Test
    fun startPendingIntentMaybeDismissingKeyguard_keyguardShowing_showOverLs_launchAnimator() {
        val pendingIntent = mock(PendingIntent::class.java)
@@ -466,6 +485,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
        animationController: ActivityTransitionAnimator.Controller?,
        fillInIntent: Intent? = null,
        extraOptions: Bundle? = null,
        customMessage: String? = null,
    ) {
        underTest.startPendingIntentDismissingKeyguard(
            intent = intent,
@@ -475,6 +495,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
            showOverLockscreen = true,
            fillInIntent = fillInIntent,
            extraOptions = extraOptions,
            customMessage = customMessage,
        )
    }

+13 −4
Original line number Diff line number Diff line
@@ -84,14 +84,17 @@ public interface ActivityStarter {
     * Similar to {@link #startPendingIntentMaybeDismissingKeyguard(PendingIntent, Runnable,
     * ActivityTransitionAnimator.Controller)}, but also specifies a fill-in intent and extra
     * option that could be used to populate the pending intent and launch the activity. This also
     * allows the caller to avoid dismissing the shade.
     * allows the caller to avoid dismissing the shade. An optional custom message can be set as
     * the unlock reason in the alternate bouncer.
     */
    void startPendingIntentMaybeDismissingKeyguard(PendingIntent intent,
            boolean dismissShade,
            @Nullable Runnable intentSentUiThreadCallback,
            @Nullable ActivityTransitionAnimator.Controller animationController,
            @Nullable Intent fillInIntent,
            @Nullable Bundle extraOptions);
            @Nullable Bundle extraOptions,
            @Nullable String customMessage
        );

    /**
     * The intent flag can be specified in startActivity().
@@ -134,14 +137,20 @@ public interface ActivityStarter {
    void dismissKeyguardThenExecute(OnDismissAction action, @Nullable Runnable cancel,
            boolean afterKeyguardGone);

    /** Authenticates if needed and dismisses keyguard to execute an action. */
    /**
     * Authenticates if needed and dismisses keyguard to execute an action.
     *
     * TODO(b/348431835) Display the custom message in the new alternate bouncer, when the
     * device_entry_udfps_refactor flag is enabled.
     */
    void dismissKeyguardThenExecute(OnDismissAction action, @Nullable Runnable cancel,
            boolean afterKeyguardGone, @Nullable String customMessage);

    /** Starts an activity and dismisses keyguard. */
    void startActivityDismissingKeyguard(Intent intent,
            boolean onlyProvisioned,
            boolean dismissShade);
            boolean dismissShade,
            @Nullable String customMessage);

    /** Starts an activity and dismisses keyguard. */
    void startActivityDismissingKeyguard(Intent intent,
+2 −0
Original line number Diff line number Diff line
@@ -1193,6 +1193,8 @@
    <string name="popup_on_dismiss_cta_tile_text">Long press to customize widgets</string>
    <!-- Text for the button to configure widgets after long press. [CHAR LIMIT=50] -->
    <string name="button_to_configure_widgets_text">Customize widgets</string>
    <!-- Text for unlock reason on the bouncer before customizing widgets. [CHAR LIMIT=NONE] -->
    <string name="unlock_reason_to_customize_widgets">Unlock to customize widgets</string>
    <!-- Description for the App icon of disabled widget. [CHAR LIMIT=NONE] -->
    <string name="icon_description_for_disabled_widget">App icon for disabled widget</string>
    <!-- Description for the App icon of a package that is currently being installed. [CHAR LIMIT=NONE] -->
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.systemui.communal.widgets.EditWidgetsActivity.Companion.EXTRA
import com.android.systemui.communal.widgets.EditWidgetsActivity.Companion.EXTRA_PRESELECTED_KEY
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.res.R
import javax.inject.Inject

interface EditWidgetsActivityStarter {
@@ -48,6 +49,7 @@ constructor(
                },
            /* onlyProvisioned = */ true,
            /* dismissShade = */ true,
            applicationContext.resources.getString(R.string.unlock_reason_to_customize_widgets),
        )
    }
}
Loading