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

Commit 0e2e1e8b authored by Louis Chang's avatar Louis Chang Committed by Evelyn Torres
Browse files

Avoid app pinning requests if the Task is already locked

Bug: 378514614
Test: LockTaskControllerTest
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b4945cf98c97121821c178713a613a6a6e830c3a)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a3240bf2ba1587b808b4314dd2e32c624b57c8da)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:326c70b0fd73c3769a252b83e1b3c18069f28b87)
Merged-In: Ic5d2125d39e5e98301d79c8f5aa8986a44e06794
Change-Id: Ic5d2125d39e5e98301d79c8f5aa8986a44e06794
parent dcc699a8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -621,6 +621,10 @@ public class LockTaskController {
        if (!isSystemCaller) {
            task.mLockTaskUid = callingUid;
            if (task.mLockTaskAuth == LOCK_TASK_AUTH_PINNABLE) {
                if (mLockTaskModeTasks.contains(task)) {
                    Slog.i(TAG_LOCKTASK, "Already locked.");
                    return;
                }
                // startLockTask() called by app, but app is not part of lock task allowlist. Show
                // app pinning request. We will come back here with isSystemCaller true.
                ProtoLog.w(WM_DEBUG_LOCKTASK, "Mode default, asking user");
+5 −0
Original line number Diff line number Diff line
@@ -238,6 +238,11 @@ public class LockTaskControllerTest {
        verifyLockTaskStarted(STATUS_BAR_MASK_PINNED, DISABLE2_NONE);
        // THEN screen pinning toast should be shown
        verify(mStatusBarService).showPinningEnterExitToast(eq(true /* entering */));

        // WHEN the app calls startLockTaskMode while the Task is already locked
        mLockTaskController.startLockTaskMode(tr, false, TEST_UID);
        // THEN a pinning request should NOT be shown
        verify(mStatusBarManagerInternal, never()).showScreenPinningRequest(anyInt());
    }

    @Test