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

Commit c3896619 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by android-build-merger
Browse files

Don\'t allow any app to specify rotation unless in home task

am: 0f6a6c4b

* commit '0f6a6c4b':
  Don't allow any app to specify rotation unless in home task

Change-Id: Id53a86c7c4878e90021d0d82172a1fbb49cc13fe
parents 03da19d4 0f6a6c4b
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -3540,14 +3540,6 @@ public class WindowManagerService extends IWindowManager.Stub
            }
        }

        if ((isStackVisibleLocked(DOCKED_STACK_ID)
                && !mStackIdToStack.get(DOCKED_STACK_ID).isAdjustedForMinimizedDock())
                || isStackVisibleLocked(FREEFORM_WORKSPACE_STACK_ID)) {
            // We don't let app affect the system orientation when in freeform or docked mode since
            // they don't occupy the entire display and their request can conflict with other apps.
            return SCREEN_ORIENTATION_UNSPECIFIED;
        }

        // Top system windows are not requesting an orientation. Start searching from apps.
        return getAppSpecifiedOrientation();
    }
@@ -3556,9 +3548,10 @@ public class WindowManagerService extends IWindowManager.Stub
        int lastOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
        boolean findingBehind = false;
        boolean lastFullscreen = false;
        // TODO: Multi window.
        DisplayContent displayContent = getDefaultDisplayContentLocked();
        final ArrayList<Task> tasks = displayContent.getTasks();
        final boolean inMultiWindow = isStackVisibleLocked(DOCKED_STACK_ID)
                || isStackVisibleLocked(FREEFORM_WORKSPACE_STACK_ID);
        for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) {
            AppTokenList tokens = tasks.get(taskNdx).mAppTokens;
            final int firstToken = tokens.size() - 1;
@@ -3593,6 +3586,11 @@ public class WindowManagerService extends IWindowManager.Stub
                    continue;
                }

                // No app except the home app may specify the screen orientation in multi-window.
                if (inMultiWindow && !atoken.mTask.isHomeTask()) {
                    continue;
                }

                if (tokenNdx == 0) {
                    // Last token in this task.
                    lastOrientation = atoken.requestedOrientation;
@@ -3620,8 +3618,10 @@ public class WindowManagerService extends IWindowManager.Stub
        if (DEBUG_ORIENTATION) Slog.v(TAG_WM,
                "No app is requesting an orientation, return " + mForcedAppOrientation);
        // The next app has not been requested to be visible, so we keep the current orientation
        // to prevent freezing/unfreezing the display too early.
        return mForcedAppOrientation;
        // to prevent freezing/unfreezing the display too early unless we are in multi-window, in
        // which we don't let the app customize the orientation unless it was the home task that
        // is handled above.
        return inMultiWindow ? SCREEN_ORIENTATION_UNSPECIFIED : mForcedAppOrientation;
    }

    @Override