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

Commit efc7570b authored by Robert Carr's avatar Robert Carr
Browse files

Prevent freezing the display while rotating seamlessly.

Following recent changes we are now receiving WindowManagerService#reconfigureDisplayLocked
during rotation. This is interpreted as another change in display
configuration that requires screen freezing and we continue on to startFreezingDisplayLocked.
This triggers the screenshot based freezing, but we were already trying to seamlessly rotate.
It seems a sensible solution to just disable screenshot based freezing while seamlessly as
we now disable screenshot based freezing while already using it.

Bug: 72038766
Test: Manual. go/wm-smoke.
Change-Id: I705518be11302cfaa95207e3b3d0c7e93e54ebbf
parent ae606b44
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1041,9 +1041,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            // to their rotated state independently and without a freeze required.
            screenRotationAnimation = null;

            // We have to reset this in case a window was removed before it
            // finished seamless rotation.
            mService.mSeamlessRotationCount = 0;
            mService.startSeamlessRotation();
        }

        // We need to update our screen size information to match the new rotation. If the rotation
+26 −6
Original line number Diff line number Diff line
@@ -667,11 +667,18 @@ public class WindowManagerService extends IWindowManager.Stub
    WindowManagerInternal.OnHardKeyboardStatusChangeListener mHardKeyboardStatusChangeListener;
    SettingsObserver mSettingsObserver;

    // A count of the windows which are 'seamlessly rotated', e.g. a surface
    // at an old orientation is being transformed. We freeze orientation updates
    // while any windows are seamlessly rotated, so we need to track when this
    // hits zero so we can apply deferred orientation updates.
    int mSeamlessRotationCount = 0;
    /**
     * A count of the windows which are 'seamlessly rotated', e.g. a surface
     * at an old orientation is being transformed. We freeze orientation updates
     * while any windows are seamlessly rotated, so we need to track when this
     * hits zero so we can apply deferred orientation updates.
     */
    private int mSeamlessRotationCount = 0;
    /**
     * True in the interval from starting seamless rotation until the last rotated
     * window draws in the new orientation.
     */
    private boolean mRotatingSeamlessly = false;

    private final class SettingsObserver extends ContentObserver {
        private final Uri mDisplayInversionEnabledUri =
@@ -5657,7 +5664,7 @@ public class WindowManagerService extends IWindowManager.Stub

    void startFreezingDisplayLocked(int exitAnim, int enterAnim,
            DisplayContent displayContent) {
        if (mDisplayFrozen) {
        if (mDisplayFrozen || mRotatingSeamlessly) {
            return;
        }

@@ -7026,6 +7033,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (DEBUG_ORIENTATION) {
                Slog.i(TAG, "Performing post-rotate rotation after seamless rotation");
            }
            finishSeamlessRotation();

            final DisplayContent displayContent = w.getDisplayContent();
            if (displayContent.updateRotationUnchecked()) {
@@ -7439,6 +7447,18 @@ public class WindowManagerService extends IWindowManager.Stub
                .sendToTarget();
    }

    void startSeamlessRotation() {
        // We are careful to reset this in case a window was removed before it finished
        // seamless rotation.
        mSeamlessRotationCount = 0;

        mRotatingSeamlessly = true;
    }

    void finishSeamlessRotation() {
        mRotatingSeamlessly = false;
    }

    /**
     * Called when the state of lock task mode changes. This should be used to disable immersive
     * mode confirmation.