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

Commit 104fc0bc authored by Robin Lee's avatar Robin Lee Committed by Android (Google) Code Review
Browse files

Merge "Run keyguard occlusion update after transitions" into udc-dev

parents db510b73 140a0590
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -3573,15 +3573,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    @Override
    public int applyKeyguardOcclusionChange() {
        if (mKeyguardOccludedChanged) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded="
        if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded commit occluded="
                + mPendingKeyguardOccluded);

        // TODO(b/276433230): Explicitly save before/after for occlude state in each
        // Transition so we don't need to update SysUI every time.
        if (setKeyguardOccludedLw(mPendingKeyguardOccluded)) {
            return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER;
            }
        }
        } else {
            return 0;
        }
    }

    /**
     * Called when keyguard related app transition starts, or cancelled.
@@ -3858,6 +3860,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private boolean setKeyguardOccludedLw(boolean isOccluded) {
        if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
        mKeyguardOccludedChanged = false;
        mPendingKeyguardOccluded = isOccluded;
        mKeyguardDelegate.setOccluded(isOccluded, true /* notify */);
        return mKeyguardDelegate.isShowing();
    }
+8 −15
Original line number Diff line number Diff line
@@ -1056,6 +1056,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            dc.removeImeSurfaceImmediately();
            dc.handleCompleteDeferredRemoval();
        }
        validateKeyguardOcclusion();
        validateVisibility();

        mState = STATE_FINISHED;
@@ -1215,8 +1216,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            if (mRecentsDisplayId != INVALID_DISPLAY) break;
        }

        handleNonAppWindowsInTransition(mType, mFlags);

        // The callback is only populated for custom activity-level client animations
        sendRemoteCallback(mClientAnimationStartCallback);

@@ -1541,19 +1540,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
    }

    private void handleNonAppWindowsInTransition(
            @TransitionType int transit, @TransitionFlags int flags) {
        if ((flags & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0) {
            // If the occlusion changed but the transition isn't an occlude/unocclude transition,
            // then we have to notify KeyguardService directly. This can happen if there is
            // another ongoing transition when the app changes occlusion OR if the app dies or
            // is killed. Both of these are common during tests.
            if (transit != TRANSIT_KEYGUARD_OCCLUDE && transit != TRANSIT_KEYGUARD_UNOCCLUDE) {
                mController.mAtm.mWindowManager.mPolicy.applyKeyguardOcclusionChange();
            }
        }
    }

    private void reportStartReasonsToLogger() {
        // Record transition start in metrics logger. We just assume everything is "DRAWN"
        // at this point since splash-screen is a presentation (shell) detail.
@@ -2246,6 +2232,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        return mainWin.getAttrs().rotationAnimation;
    }

    private void validateKeyguardOcclusion() {
        if ((mFlags & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0) {
            mController.mStateValidators.add(
                mController.mAtm.mWindowManager.mPolicy::applyKeyguardOcclusionChange);
        }
    }

    private void validateVisibility() {
        for (int i = mTargets.size() - 1; i >= 0; --i) {
            if (reduceMode(mTargets.get(i).mReadyMode) != TRANSIT_CLOSE) {