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

Commit 8c3c9a94 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

am: c3896619

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

Change-Id: Ic239c5b6a468eab3faa91201ef207d95e409b51b
parents baa0d55f c3896619
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line 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.
        // Top system windows are not requesting an orientation. Start searching from apps.
        return getAppSpecifiedOrientation();
        return getAppSpecifiedOrientation();
    }
    }
@@ -3556,9 +3548,10 @@ public class WindowManagerService extends IWindowManager.Stub
        int lastOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
        int lastOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
        boolean findingBehind = false;
        boolean findingBehind = false;
        boolean lastFullscreen = false;
        boolean lastFullscreen = false;
        // TODO: Multi window.
        DisplayContent displayContent = getDefaultDisplayContentLocked();
        DisplayContent displayContent = getDefaultDisplayContentLocked();
        final ArrayList<Task> tasks = displayContent.getTasks();
        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) {
        for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) {
            AppTokenList tokens = tasks.get(taskNdx).mAppTokens;
            AppTokenList tokens = tasks.get(taskNdx).mAppTokens;
            final int firstToken = tokens.size() - 1;
            final int firstToken = tokens.size() - 1;
@@ -3593,6 +3586,11 @@ public class WindowManagerService extends IWindowManager.Stub
                    continue;
                    continue;
                }
                }


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

                if (tokenNdx == 0) {
                if (tokenNdx == 0) {
                    // Last token in this task.
                    // Last token in this task.
                    lastOrientation = atoken.requestedOrientation;
                    lastOrientation = atoken.requestedOrientation;
@@ -3620,8 +3618,10 @@ public class WindowManagerService extends IWindowManager.Stub
        if (DEBUG_ORIENTATION) Slog.v(TAG_WM,
        if (DEBUG_ORIENTATION) Slog.v(TAG_WM,
                "No app is requesting an orientation, return " + mForcedAppOrientation);
                "No app is requesting an orientation, return " + mForcedAppOrientation);
        // The next app has not been requested to be visible, so we keep the current orientation
        // The next app has not been requested to be visible, so we keep the current orientation
        // to prevent freezing/unfreezing the display too early.
        // to prevent freezing/unfreezing the display too early unless we are in multi-window, in
        return mForcedAppOrientation;
        // 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
    @Override