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

Commit 7d43f225 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Generalize the condition to take task snapshot when entering AOD" into...

Merge "Generalize the condition to take task snapshot when entering AOD" into sc-dev am: 5b24daa4 am: 9bbc42a5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14963622

Change-Id: I72af82e00223a193258e19b49d0a0f8799313cb4
parents d7e5a98f 9bbc42a5
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import android.os.Trace;
import android.util.Slog;
import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;
import android.view.Display;

import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.server.inputmethod.InputMethodManagerInternal;
@@ -163,16 +164,27 @@ class KeyguardController {
                aodShowing ? 1 : 0,
                mKeyguardGoingAway ? 1 : 0,
                "setKeyguardShown");

        // Update the task snapshot if the screen will not be turned off. To make sure that the
        // unlocking animation can animate consistent content. The conditions are:
        // - Either AOD or keyguard changes to be showing. So if the states change individually,
        //   the later one can be skipped to avoid taking snapshot again. While it still accepts
        //   if both of them change to show at the same time.
        // - Keyguard was not going away. Because if it was, the closing transition is able to
        //   handle the snapshot.
        // - The display state is ON. Because if AOD is not on or pulsing, the display state will
        //   be OFF or DOZE (the path of screen off may have handled it).
        if (((aodShowing ^ keyguardShowing) || (aodShowing && aodChanged && keyguardChanged))
                && !mKeyguardGoingAway && Display.isOnState(
                        mRootWindowContainer.getDefaultDisplay().getDisplayInfo().state)) {
            mWindowManager.mTaskSnapshotController.snapshotForSleeping(DEFAULT_DISPLAY);
        }

        mKeyguardShowing = keyguardShowing;
        mAodShowing = aodShowing;
        if (aodChanged) {
            // Ensure the new state takes effect.
            mWindowManager.mWindowPlacerLocked.performSurfacePlacement();
            // If the device can enter AOD and keyguard at the same time, the screen will not be
            // turned off, so the snapshot needs to be refreshed when these states are changed.
            if (aodShowing && keyguardShowing && keyguardChanged) {
                mWindowManager.mTaskSnapshotController.snapshotForSleeping(DEFAULT_DISPLAY);
            }
        }

        if (keyguardChanged) {