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

Commit 9640b7d7 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Automerger Merge Worker
Browse files

Merge "setTurnScreenOn can only used as wakeup" into sc-v2-dev am: 275b1136 am: 4da98356

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

Change-Id: Id515bc39ed132e76855f9657255530012ff83347
parents 471056c7 4da98356
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager.ServiceNotFoundException;
@@ -8474,9 +8473,7 @@ public class Activity extends ContextThemeWrapper
     * the activity is visible after the screen is turned on when the lockscreen is up. In addition,
     * if this flag is set and the activity calls {@link
     * KeyguardManager#requestDismissKeyguard(Activity, KeyguardManager.KeyguardDismissCallback)}
     * the screen will turn on. If the screen is off and device is not secured, this flag can turn
     * screen on and dismiss keyguard to make this activity visible and resume, which can be used to
     * replace {@link PowerManager#ACQUIRE_CAUSES_WAKEUP}
     * the screen will turn on.
     *
     * @param turnScreenOn {@code true} to turn on the screen; {@code false} otherwise.
     *
+7 −32
Original line number Diff line number Diff line
@@ -194,8 +194,7 @@ class KeyguardController {

        if (keyguardChanged) {
            // Irrelevant to AOD.
            dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */,
                    false /* turningScreenOn */);
            dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */);
            mKeyguardGoingAway = false;
            if (keyguardShowing) {
                mDismissalRequested = false;
@@ -396,6 +395,8 @@ class KeyguardController {
                mService.continueWindowLayout();
            }
        }
        dismissMultiWindowModeForTaskIfNeeded(topActivity != null
                ? topActivity.getRootTask() : null);
    }

    /**
@@ -421,21 +422,6 @@ class KeyguardController {
        }
    }

    /**
     * Called when somebody wants to turn screen on.
     */
    private void handleTurnScreenOn(int displayId) {
        if (displayId != DEFAULT_DISPLAY) {
            return;
        }

        mTaskSupervisor.wakeUp("handleTurnScreenOn");
        if (mKeyguardShowing && canDismissKeyguard()) {
            mWindowManager.dismissKeyguard(null /* callback */, null /* message */);
            mDismissalRequested = true;
        }
    }

    boolean isDisplayOccluded(int displayId) {
        return getDisplayState(displayId).mOccluded;
    }
@@ -449,11 +435,9 @@ class KeyguardController {
    }

    private void dismissMultiWindowModeForTaskIfNeeded(
            @Nullable Task currentTaskControllingOcclusion, boolean turningScreenOn) {
        // If turningScreenOn is true, it means that the visibility state has changed from
        // currentTaskControllingOcclusion and we should update windowing mode.
            @Nullable Task currentTaskControllingOcclusion) {
        // TODO(b/113840485): Handle docked stack for individual display.
        if (!turningScreenOn && (!mKeyguardShowing || !isDisplayOccluded(DEFAULT_DISPLAY))) {
        if (!mKeyguardShowing || !isDisplayOccluded(DEFAULT_DISPLAY)) {
            return;
        }

@@ -592,26 +576,17 @@ class KeyguardController {
                    && controller.mWindowManager.isKeyguardSecure(
                    controller.mService.getCurrentUserId());

            boolean occludingChange = false;
            boolean turningScreenOn = false;
            if (mTopTurnScreenOnActivity != lastTurnScreenOnActivity
                    && mTopTurnScreenOnActivity != null
                    && !mService.mWindowManager.mPowerManager.isInteractive()
                    && (mRequestDismissKeyguard || occludedByActivity
                        || controller.canDismissKeyguard())) {
                turningScreenOn = true;
                controller.handleTurnScreenOn(mDisplayId);
                    && (mRequestDismissKeyguard || occludedByActivity)) {
                controller.mTaskSupervisor.wakeUp("handleTurnScreenOn");
                mTopTurnScreenOnActivity.setCurrentLaunchCanTurnScreenOn(false);
            }

            if (lastOccluded != mOccluded) {
                occludingChange = true;
                controller.handleOccludedChanged(mDisplayId, mTopOccludesActivity);
            }

            if (occludingChange || turningScreenOn) {
                controller.dismissMultiWindowModeForTaskIfNeeded(task, turningScreenOn);
            }
        }

        /**