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

Commit 4cc6b39f authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Apply power mode when unlocking" into main

parents 2df19e5a f7f5fa1e
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -3617,6 +3617,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        final long token = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
                boolean isPowerModePreApplied = false;
                if (mPowerModeReasons == 0) {
                    startPowerMode(POWER_MODE_REASON_START_ACTIVITY);
                    isPowerModePreApplied = true;
                }
                // Keyguard asked us to clear the home task snapshot before going away, so do that.
                if ((flags & KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT) != 0) {
                    mActivityClientController.invalidateHomeTaskSnapshot(null /* token */);
@@ -3625,9 +3630,19 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    mDemoteTopAppReasons |= DEMOTE_TOP_REASON_DURING_UNLOCKING;
                }

                mRootWindowContainer.forAllDisplays(displayContent -> {
                    mKeyguardController.keyguardGoingAway(displayContent.getDisplayId(), flags);
                });
                boolean foundResumed = false;
                for (int i = mRootWindowContainer.getChildCount() - 1; i >= 0; i--) {
                    final DisplayContent dc = mRootWindowContainer.getChildAt(i);
                    final boolean wasNoResumed = dc.mFocusedApp == null
                            || !dc.mFocusedApp.isState(RESUMED);
                    mKeyguardController.keyguardGoingAway(dc.mDisplayId, flags);
                    if (wasNoResumed && dc.mFocusedApp != null && dc.mFocusedApp.isState(RESUMED)) {
                        foundResumed = true;
                    }
                }
                if (isPowerModePreApplied && !foundResumed) {
                    endPowerMode(POWER_MODE_REASON_START_ACTIVITY);
                }
            }
            WallpaperManagerInternal wallpaperManagerInternal = getWallpaperManagerInternal();
            if (wallpaperManagerInternal != null) {