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

Commit ec57d424 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Generalize the condition to take task snapshot when entering AOD

There is no guarantee that AOD or keyguard will show together
or individually (depends on SystemUI). So this change allows to
take snapshot for both cases.

Bug: 182571838
Test: 1. Enable "Always show time and info".
      2. Open any app and go to home.
      3. Launch the app again and make some changes to its content.
      4. Press power key to enter dozing.
      5. Unlock and check if the animation has the latest content.

Change-Id: Ib60b00e96632d38fac308b8851cd59b71142f321
parent 7dfe7b74
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) {