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

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

Merge "Respect android:turnScreenOn on non-default displays" into main

parents a8214163 96b2363a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -6459,7 +6459,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        returningOptions = null;
        returningOptions = null;


        if (canTurnScreenOn()) {
        if (canTurnScreenOn()) {
            mTaskSupervisor.wakeUp("turnScreenOnFlag");
            mTaskSupervisor.wakeUp(getDisplayId(), "turnScreenOnFlag");
        } else {
        } else {
            // If the screen is going to turn on because the caller explicitly requested it and
            // If the screen is going to turn on because the caller explicitly requested it and
            // the keyguard is not showing don't attempt to sleep. Otherwise the Activity will
            // the keyguard is not showing don't attempt to sleep. Otherwise the Activity will
+2 −1
Original line number Original line Diff line number Diff line
@@ -2397,7 +2397,8 @@ class ActivityStarter {
        // This is moving an existing task to front. But since dream activity has a higher z-order
        // This is moving an existing task to front. But since dream activity has a higher z-order
        // to cover normal activities, it needs the awakening event to be dismissed.
        // to cover normal activities, it needs the awakening event to be dismissed.
        if (mService.isDreaming() && targetTaskTop.canTurnScreenOn()) {
        if (mService.isDreaming() && targetTaskTop.canTurnScreenOn()) {
            targetTaskTop.mTaskSupervisor.wakeUp("recycleTask#turnScreenOnFlag");
            targetTaskTop.mTaskSupervisor.wakeUp(
                    targetTaskTop.getDisplayId(), "recycleTask#turnScreenOnFlag");
        }
        }


        mLastStartActivityRecord = targetTaskTop;
        mLastStartActivityRecord = targetTaskTop;
+2 −2
Original line number Original line Diff line number Diff line
@@ -2525,9 +2525,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        }
        }
    }
    }


    void wakeUp(String reason) {
    void wakeUp(int displayId, String reason) {
        mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_APPLICATION,
        mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_APPLICATION,
                "android.server.am:TURN_ON:" + reason);
                "android.server.am:TURN_ON:" + reason, displayId);
    }
    }


    /** Starts a batch of visibility updates. */
    /** Starts a batch of visibility updates. */
+3 −3
Original line number Original line Diff line number Diff line
@@ -329,7 +329,7 @@ class KeyguardController {
        // If the client has requested to dismiss the keyguard and the Activity has the flag to
        // If the client has requested to dismiss the keyguard and the Activity has the flag to
        // turn the screen on, wakeup the screen if it's the top Activity.
        // turn the screen on, wakeup the screen if it's the top Activity.
        if (activityRecord.getTurnScreenOnFlag() && activityRecord.isTopRunningActivity()) {
        if (activityRecord.getTurnScreenOnFlag() && activityRecord.isTopRunningActivity()) {
            mTaskSupervisor.wakeUp("dismissKeyguard");
            mTaskSupervisor.wakeUp(activityRecord.getDisplayId(), "dismissKeyguard");
        }
        }


        mWindowManager.dismissKeyguard(callback, message);
        mWindowManager.dismissKeyguard(callback, message);
@@ -765,9 +765,9 @@ class KeyguardController {
            }
            }


            if (mTopTurnScreenOnActivity != null
            if (mTopTurnScreenOnActivity != null
                    && !mService.mWindowManager.mPowerManager.isInteractive()
                    && !mService.mWindowManager.mPowerManager.isInteractive(display.getDisplayId())
                    && (mRequestDismissKeyguard || mOccluded)) {
                    && (mRequestDismissKeyguard || mOccluded)) {
                controller.mTaskSupervisor.wakeUp("handleTurnScreenOn");
                controller.mTaskSupervisor.wakeUp(display.getDisplayId(), "handleTurnScreenOn");
                mTopTurnScreenOnActivity.setCurrentLaunchCanTurnScreenOn(false);
                mTopTurnScreenOnActivity.setCurrentLaunchCanTurnScreenOn(false);
            }
            }


+4 −2
Original line number Original line Diff line number Diff line
@@ -3421,9 +3421,11 @@ public class WindowManagerService extends IWindowManager.Stub
            throw new SecurityException("Requires CONTROL_KEYGUARD permission");
            throw new SecurityException("Requires CONTROL_KEYGUARD permission");
        }
        }
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final DisplayContent defaultDisplayContent = getDefaultDisplayContentLocked();
            if (!dreamHandlesConfirmKeys()
            if (!dreamHandlesConfirmKeys()
                    && getDefaultDisplayContentLocked().getDisplayPolicy().isShowingDreamLw()) {
                    && defaultDisplayContent.getDisplayPolicy().isShowingDreamLw()) {
                mAtmService.mTaskSupervisor.wakeUp("leaveDream");
                mAtmService.mTaskSupervisor.wakeUp(
                        defaultDisplayContent.getDisplayId(), "leaveDream");
            }
            }
            mPolicy.dismissKeyguardLw(callback, message);
            mPolicy.dismissKeyguardLw(callback, message);
        }
        }
Loading