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

Commit 562d2e96 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Take snapshot when device becomes dozing and pulsing" into sc-dev am: 8b1c1ac7

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

Change-Id: I1d3f9a70b9dda583da0f1a7fa4db21558a695b04
parents 3abddab6 8b1c1ac7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -167,6 +167,11 @@ class KeyguardController {
        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) {
+22 −14
Original line number Diff line number Diff line
@@ -635,26 +635,34 @@ class TaskSnapshotController {
        mHandler.post(() -> {
            try {
                synchronized (mService.mGlobalLock) {
                    snapshotForSleeping(displayId);
                }
            } finally {
                listener.onScreenOff();
            }
        });
    }

    /** Called when the device is going to sleep (e.g. screen off, AOD without screen off). */
    void snapshotForSleeping(int displayId) {
        if (shouldDisableSnapshots()) {
            return;
        }
        mTmpTasks.clear();
        mService.mRoot.getDisplayContent(displayId).forAllTasks(task -> {
                        // Since RecentsAnimation will handle task snapshot while switching apps
                        // with the best capture timing (e.g. IME window capture), No need
                        // additional task capture while task is controlled by RecentsAnimation.
            // Since RecentsAnimation will handle task snapshot while switching apps with the best
            // capture timing (e.g. IME window capture), No need additional task capture while task
            // is controlled by RecentsAnimation.
            if (task.isVisible() && !task.isAnimatingByRecents()) {
                mTmpTasks.add(task);
            }
        });
                    // Allow taking snapshot of home when turning screen off to reduce the delay of
                    // waking from secure lock to home.
                    final boolean allowSnapshotHome = displayId == Display.DEFAULT_DISPLAY &&
                            mService.mPolicy.isKeyguardSecure(mService.mCurrentUserId);
        // Allow taking snapshot of home when turning screen off to reduce the delay of waking from
        // secure lock to home.
        final boolean allowSnapshotHome = displayId == Display.DEFAULT_DISPLAY
                && mService.mPolicy.isKeyguardSecure(mService.mCurrentUserId);
        snapshotTasks(mTmpTasks, allowSnapshotHome);
    }
            } finally {
                listener.onScreenOff();
            }
        });
    }

    /**
     * @return The {@link Appearance} flags for the top fullscreen opaque window in the given