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

Commit e4004795 authored by wilsonshih's avatar wilsonshih
Browse files

Extends waiting condition for wake up transition.

While device is about to wake up, add the wait condition for dismiss
AOD, which can be a condition to release the sleep token.

Also consider the mUnknownAppVisibilityController in AR#isSyncFinished,
because the visibility can changed before all of unknown conditions
resolved.

Bug: 225127896
Test: start showWhenLocked + turnScreenOn activity while screen off,
finish activity, then start the activity again.

Change-Id: I6cb2df7385091b45b45d49197aaa259216786a79
parent e06bd586
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -4547,7 +4547,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                                    pmWakeReason)) + ")");
                                    pmWakeReason)) + ")");
        }
        }


        mActivityTaskManagerInternal.notifyWakingUp();
        mDefaultDisplayPolicy.setAwake(true);
        mDefaultDisplayPolicy.setAwake(true);


        // Since goToSleep performs these functions synchronously, we must
        // Since goToSleep performs these functions synchronously, we must
+4 −0
Original line number Original line Diff line number Diff line
@@ -9647,6 +9647,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @Override
    @Override
    boolean isSyncFinished() {
    boolean isSyncFinished() {
        if (!super.isSyncFinished()) return false;
        if (!super.isSyncFinished()) return false;
        if (mDisplayContent != null && mDisplayContent.mUnknownAppVisibilityController
                .isVisibilityUnknown(this)) {
            return false;
        }
        if (!isVisibleRequested()) return true;
        if (!isVisibleRequested()) return true;
        // Wait for attach. That is the earliest time where we know if there will be an associated
        // Wait for attach. That is the earliest time where we know if there will be an associated
        // display rotation. If we don't wait, the starting-window can finishDrawing first and
        // display rotation. If we don't wait, the starting-window can finishDrawing first and
+0 −3
Original line number Original line Diff line number Diff line
@@ -666,9 +666,6 @@ public abstract class ActivityTaskManagerInternal {
    public abstract boolean hasSystemAlertWindowPermission(int callingUid, int callingPid,
    public abstract boolean hasSystemAlertWindowPermission(int callingUid, int callingPid,
            String callingPackage);
            String callingPackage);


    /** Called when the device is waking up */
    public abstract void notifyWakingUp();

    /**
    /**
     * Registers a callback which can intercept activity starts.
     * Registers a callback which can intercept activity starts.
     * @throws IllegalArgumentException if duplicate ids are provided
     * @throws IllegalArgumentException if duplicate ids are provided
+0 −10
Original line number Original line Diff line number Diff line
@@ -64,7 +64,6 @@ import static android.provider.Settings.Global.HIDE_ERROR_DIALOGS;
import static android.provider.Settings.System.FONT_SCALE;
import static android.provider.Settings.System.FONT_SCALE;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.WindowManager.TRANSIT_WAKE;


import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS;
@@ -6627,15 +6626,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    callingPid, callingPackage);
                    callingPid, callingPackage);
        }
        }


        @Override
        public void notifyWakingUp() {
            synchronized (mGlobalLock) {
                // Start a transition for waking. This is needed for showWhenLocked activities.
                getTransitionController().requestTransitionIfNeeded(TRANSIT_WAKE, 0 /* flags */,
                        null /* trigger */, mRootWindowContainer.getDefaultDisplay());
            }
        }

        @Override
        @Override
        public void registerActivityStartInterceptor(
        public void registerActivityStartInterceptor(
                @ActivityInterceptorCallback.OrderedId int id,
                @ActivityInterceptorCallback.OrderedId int id,
+16 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.TRANSIT_WAKE;
import static android.view.WindowManagerGlobal.ADD_OKAY;
import static android.view.WindowManagerGlobal.ADD_OKAY;
import static android.view.WindowManagerPolicyConstants.ACTION_HDMI_PLUGGED;
import static android.view.WindowManagerPolicyConstants.ACTION_HDMI_PLUGGED;
import static android.view.WindowManagerPolicyConstants.ALT_BAR_BOTTOM;
import static android.view.WindowManagerPolicyConstants.ALT_BAR_BOTTOM;
@@ -780,7 +781,22 @@ public class DisplayPolicy {
    }
    }


    public void setAwake(boolean awake) {
    public void setAwake(boolean awake) {
        if (awake == mAwake) {
            return;
        }
        mAwake = awake;
        mAwake = awake;
        synchronized (mService.mGlobalLock) {
            if (!mDisplayContent.isDefaultDisplay) {
                return;
            }
            if (mAwake) {
                // Start a transition for waking. This is needed for showWhenLocked activities.
                mDisplayContent.mTransitionController.requestTransitionIfNeeded(TRANSIT_WAKE,
                        0 /* flags */, null /* trigger */, mDisplayContent);
            }
            mService.mAtmService.mKeyguardController.updateDeferWakeTransition(
                    mAwake /* waiting */);
        }
    }
    }


    public boolean isAwake() {
    public boolean isAwake() {
Loading