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

Commit 8ee72851 authored by Andrii Kulian's avatar Andrii Kulian
Browse files

Move rotation tracking to DisplayContent

This CL moves rotation tracking from WindowManagerService to
DisplayContent. This way displays can be rotated independently and
rotation of the main display won't affect rotation of secondary
ones.

Bug: 34242678
Test: android.server.cts.ActivityManagerDisplayTests
Test: testRotationNotAffectingSecondaryScreen
Change-Id: Ic46aaa523482b31ff5ec77f0c2908ceda1156fc0
parent 83c4712a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class ShellUiAutomatorBridge extends UiAutomatorBridge {
                IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
        int ret = -1;
        try {
            ret = wm.getRotation();
            ret = wm.getDefaultDisplayRotation();
        } catch (RemoteException e) {
            Log.e(LOG_TAG, "Error getting screen rotation", e);
            throw new RuntimeException(e);
+1 −1
Original line number Diff line number Diff line
@@ -367,7 +367,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
            if (mWindowManager.isRotationFrozen()) {
                // Calling out with a lock held is fine since if the system
                // process is gone the client calling in will be killed.
                mInitialFrozenRotation = mWindowManager.getRotation();
                mInitialFrozenRotation = mWindowManager.getDefaultDisplayRotation();
            }
        } catch (RemoteException re) {
            /* ignore */
+5 −3
Original line number Diff line number Diff line
@@ -201,10 +201,12 @@ interface IWindowManager
    void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);

    /**
     * Retrieve the current screen orientation, constants as per
     * {@link android.view.Surface}.
     * Retrieve the current orientation of the primary screen.
     * @return Constant as per {@link android.view.Surface.Rotation}.
     *
     * @see android.view.Display#DEFAULT_DISPLAY
     */
    int getRotation();
    int getDefaultDisplayRotation();

    /**
     * Watch the rotation of the screen.  Returns the current rotation,
+1 −1
Original line number Diff line number Diff line
@@ -1806,7 +1806,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mWakeGestureListener = new MyWakeGestureListener(mContext, mHandler);
        mOrientationListener = new MyOrientationListener(mContext, mHandler);
        try {
            mOrientationListener.setCurrentRotation(windowManager.getRotation());
            mOrientationListener.setCurrentRotation(windowManager.getDefaultDisplayRotation());
        } catch (RemoteException ex) { }
        mSettingsObserver = new SettingsObserver(mHandler);
        mSettingsObserver.observe();
+5 −4
Original line number Diff line number Diff line
@@ -156,9 +156,9 @@ final class AccessibilityController {
        }
    }

    public void onRotationChangedLocked(DisplayContent displayContent, int rotation) {
    public void onRotationChangedLocked(DisplayContent displayContent) {
        if (mDisplayMagnifier != null) {
            mDisplayMagnifier.onRotationChangedLocked(displayContent, rotation);
            mDisplayMagnifier.onRotationChangedLocked(displayContent);
        }
        if (mWindowsForAccessibilityObserver != null) {
            mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
@@ -312,9 +312,10 @@ final class AccessibilityController {
            mWindowManagerService.scheduleAnimationLocked();
        }

        public void onRotationChangedLocked(DisplayContent displayContent, int rotation) {
        public void onRotationChangedLocked(DisplayContent displayContent) {
            if (DEBUG_ROTATION) {
                Slog.i(LOG_TAG, "Rotaton: " + Surface.rotationToString(rotation)
                final int rotation = displayContent.getRotation();
                Slog.i(LOG_TAG, "Rotation: " + Surface.rotationToString(rotation)
                        + " displayId: " + displayContent.getDisplayId());
            }
            mMagnifedViewport.onRotationChangedLocked();
Loading