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

Commit 0ec6392b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Reintroduce a timeout on going-away transition" into main

parents b5ce9747 f14e16fd
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -64,6 +64,14 @@ flag {
  is_fixed_read_only: true
}

flag {
  name: "keyguard_going_away_timeout"
  namespace: "windowing_frontend"
  description: "Allow a maximum of 10 seconds with keyguardGoingAway=true before force-resetting"
  bug: "343598832"
  is_fixed_read_only: true
}

flag {
  name: "close_to_square_config_includes_status_bar"
  namespace: "windowing_frontend"
+34 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ class KeyguardController {

    private static final int DEFER_WAKE_TRANSITION_TIMEOUT_MS = 5000;

    private static final int GOING_AWAY_TIMEOUT_MS = 10500;

    private final ActivityTaskSupervisor mTaskSupervisor;
    private WindowManagerService mWindowManager;

@@ -233,6 +235,7 @@ class KeyguardController {
                dc.mWallpaperController.adjustWallpaperWindows();
                dc.executeAppTransition();
            }
            scheduleGoingAwayTimeout(displayId);
        }

        // Update the sleep token first such that ensureActivitiesVisible has correct sleep token
@@ -287,6 +290,8 @@ class KeyguardController {
            mRootWindowContainer.ensureActivitiesVisible();
            mRootWindowContainer.addStartingWindowsForVisibleActivities();
            mWindowManager.executeAppTransition();

            scheduleGoingAwayTimeout(displayId);
        } finally {
            mService.continueWindowLayout();
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
@@ -602,6 +607,34 @@ class KeyguardController {
        }
    }

    /**
     * Called when the default display's mKeyguardGoingAway has been left as {@code true} for too
     * long. Send an explicit message to the KeyguardService asking it to wrap up.
     */
    private final Runnable mGoingAwayTimeout = () -> {
        synchronized (mWindowManager.mGlobalLock) {
            KeyguardDisplayState state = getDisplayState(DEFAULT_DISPLAY);
            if (!state.mKeyguardGoingAway) {
                return;
            }
            state.mKeyguardGoingAway = false;
            state.writeEventLog("goingAwayTimeout");
            mWindowManager.mPolicy.startKeyguardExitAnimation(0);
        }
    };

    private void scheduleGoingAwayTimeout(int displayId) {
        if (displayId != DEFAULT_DISPLAY) {
            return;
        }
        if (getDisplayState(displayId).mKeyguardGoingAway) {
            if (!mWindowManager.mH.hasCallbacks(mGoingAwayTimeout)) {
                mWindowManager.mH.postDelayed(mGoingAwayTimeout, GOING_AWAY_TIMEOUT_MS);
            }
        } else {
            mWindowManager.mH.removeCallbacks(mGoingAwayTimeout);
        }
    }

    /** Represents Keyguard state per individual display. */
    private static class KeyguardDisplayState {
@@ -721,6 +754,7 @@ class KeyguardController {
            if (!lastKeyguardGoingAway && mKeyguardGoingAway) {
                writeEventLog("dismissIfInsecure");
                controller.handleDismissInsecureKeyguard(display);
                controller.scheduleGoingAwayTimeout(mDisplayId);
                hasChange = true;
            } else if (lastOccluded != mOccluded) {
                controller.handleOccludedChanged(mDisplayId, mTopOccludesActivity);