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

Commit ba4fd6c3 authored by Vadim Caen's avatar Vadim Caen
Browse files

Further cleanup for rotation code

Remove the CUSTOM_SCREEN_ROTATION constant and unused method parameters

Test: presubmit
Bug: n/a
Change-Id: Ib1566b206bdcb77949891c6b972b810c85206c0a
parent 1234469c
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -119,14 +119,12 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_STACK_CRAWLS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.CUSTOM_SCREEN_ROTATION;
import static com.android.server.wm.WindowManagerService.H.REPORT_FOCUS_CHANGE;
import static com.android.server.wm.WindowManagerService.H.REPORT_HARD_KEYBOARD_STATUS_CHANGE;
import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS;
import static com.android.server.wm.WindowManagerService.H.UPDATE_DOCKED_STACK_DIVIDER;
import static com.android.server.wm.WindowManagerService.H.WINDOW_HIDE_TIMEOUT;
import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD;
import static com.android.server.wm.WindowManagerService.MAX_ANIMATION_DURATION;
import static com.android.server.wm.WindowManagerService.SEAMLESS_ROTATION_TIMEOUT_DURATION;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_PLACING_SURFACES;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_REMOVING_FOCUS;
@@ -1534,13 +1532,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo

        // NOTE: We disable the rotation in the emulator because
        //       it doesn't support hardware OpenGL emulation yet.
        if (CUSTOM_SCREEN_ROTATION && screenRotationAnimation != null
                && screenRotationAnimation.hasScreenshot()) {
            if (screenRotationAnimation.setRotation(getPendingTransaction(), rotation,
                    MAX_ANIMATION_DURATION, mWmService.getTransitionAnimationScaleLocked(),
                    mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight)) {
                mWmService.scheduleAnimationLocked();
            }
        if (screenRotationAnimation != null && screenRotationAnimation.hasScreenshot()) {
            screenRotationAnimation.setRotation(getPendingTransaction(), rotation);
        }

        forAllWindows(w -> {
+2 −11
Original line number Diff line number Diff line
@@ -286,20 +286,11 @@ class ScreenRotationAnimation {
        setSnapshotTransform(t, mSnapshotInitialMatrix, 1.0f);
    }

    public boolean setRotation(SurfaceControl.Transaction t, int rotation,
            long maxAnimationDuration, float animationScale, int finalWidth, int finalHeight) {
        setRotation(t, rotation);

        // Don't start animation yet.
        return false;
    }

    /**
     * Returns true if animating.
     */
    private boolean startAnimation(SurfaceControl.Transaction t, long maxAnimationDuration,
            float animationScale, int finalWidth, int finalHeight, boolean dismissing,
            int exitAnim, int enterAnim) {
            float animationScale, int finalWidth, int finalHeight, int exitAnim, int enterAnim) {
        if (mSurfaceControl == null) {
            // Can't do animation.
            return false;
@@ -420,7 +411,7 @@ class ScreenRotationAnimation {
        }
        if (!mStarted) {
            startAnimation(t, maxAnimationDuration, animationScale, finalWidth, finalHeight,
                    true, exitAnim, enterAnim);
                    exitAnim, enterAnim);
        }
        if (!mStarted) {
            return false;
+17 −25
Original line number Diff line number Diff line
@@ -336,11 +336,6 @@ public class WindowManagerService extends IWindowManager.Stub

    /** Amount of time to allow a last ANR message to exist before freeing the memory. */
    static final int LAST_ANR_LIFETIME_DURATION_MSECS = 2 * 60 * 60 * 1000; // Two hours
    /**
     * If true, the window manager will do its own custom freezing and general
     * management of the screen during rotation.
     */
    static final boolean CUSTOM_SCREEN_ROTATION = true;

    // Maximum number of milliseconds to wait for input devices to be enumerated before
    // proceding with safe mode detection.
@@ -5395,7 +5390,6 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        mLatencyTracker.onActionStart(ACTION_ROTATE_SCREEN);
        if (CUSTOM_SCREEN_ROTATION) {
        mExitAnimId = exitAnim;
        mEnterAnimId = enterAnim;
        ScreenRotationAnimation screenRotationAnimation =
@@ -5414,7 +5408,6 @@ public class WindowManagerService extends IWindowManager.Stub
        mAnimator.setScreenRotationAnimationLocked(mFrozenDisplayId,
                screenRotationAnimation);
    }
    }

    void stopFreezingDisplayLocked() {
        if (!mDisplayFrozen) {
@@ -5466,8 +5459,7 @@ public class WindowManagerService extends IWindowManager.Stub

        ScreenRotationAnimation screenRotationAnimation =
                mAnimator.getScreenRotationAnimationLocked(displayId);
        if (CUSTOM_SCREEN_ROTATION && screenRotationAnimation != null
                && screenRotationAnimation.hasScreenshot()) {
        if (screenRotationAnimation != null && screenRotationAnimation.hasScreenshot()) {
            if (DEBUG_ORIENTATION) Slog.i(TAG_WM, "**** Dismissing screen rotation animation");
            DisplayInfo displayInfo = displayContent.getDisplayInfo();
            // Get rotation animation again, with new top window
@@ -5511,7 +5503,7 @@ public class WindowManagerService extends IWindowManager.Stub

        mScreenFrozenLock.release();

        if (updateRotation && displayContent != null && updateRotation) {
        if (updateRotation && displayContent != null) {
            if (DEBUG_ORIENTATION) Slog.d(TAG_WM, "Performing post-rotate rotation");
            configChanged |= displayContent.updateRotationUnchecked();
        }