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

Commit f3adccfe authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Merge "Revert "Only allow AM to update display orientation based on app...

Merge "Revert "Only allow AM to update display orientation based on app containers"" into oc-dev am: 91f241b3
am: e12aa87c

Change-Id: I5e1ac1d20fcff8d2edfe47f0fd6719f0e28e95cc
parents 2a8ff264 e12aa87c
Loading
Loading
Loading
Loading
+4 −18
Original line number Original line Diff line number Diff line
@@ -1503,16 +1503,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        return mImeWindowsContainers.forAllWindows(callback, traverseTopToBottom);
        return mImeWindowsContainers.forAllWindows(callback, traverseTopToBottom);
    }
    }


    /**
    @Override
     * Returns the orientation that this display should be in factoring in its children containers.
    int getOrientation() {
     *
     * @param includeAppContainers True if then app containers (stacks, tasks, ...) should be
     *                             factored in when determining the orientation. If false only
     *                             non-app/system containers will be used to determine the returned
     *                             orientation.
     * @return The orientation the display should be in.
     */
    int getOrientation(boolean includeAppContainers) {
        final WindowManagerPolicy policy = mService.mPolicy;
        final WindowManagerPolicy policy = mService.mPolicy;


        if (mService.mDisplayFrozen) {
        if (mService.mDisplayFrozen) {
@@ -1541,14 +1533,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            }
            }
        }
        }


        // Top system windows are not requesting an orientation. Get orientation from app containers
        // Top system windows are not requesting an orientation. Start searching from apps.
        // if allowed. Otherwise, return the last orientation.
        return mTaskStackContainers.getOrientation();
        return includeAppContainers ? mTaskStackContainers.getOrientation() : mLastOrientation;
    }

    @Override
    int getOrientation() {
        return getOrientation(true /* includeAppContainers */);
    }
    }


    void updateDisplayInfo() {
    void updateDisplayInfo() {
+6 −23
Original line number Original line Diff line number Diff line
@@ -2373,7 +2373,7 @@ public class WindowManagerService extends IWindowManager.Stub
        try {
        try {
            synchronized(mWindowMap) {
            synchronized(mWindowMap) {
                config = updateOrientationFromAppTokensLocked(currentConfig, freezeThisOneIfNeeded,
                config = updateOrientationFromAppTokensLocked(currentConfig, freezeThisOneIfNeeded,
                        displayId, true /* includeAppContainers */);
                        displayId);
            }
            }
        } finally {
        } finally {
            Binder.restoreCallingIdentity(ident);
            Binder.restoreCallingIdentity(ident);
@@ -2383,13 +2383,13 @@ public class WindowManagerService extends IWindowManager.Stub
    }
    }


    private Configuration updateOrientationFromAppTokensLocked(Configuration currentConfig,
    private Configuration updateOrientationFromAppTokensLocked(Configuration currentConfig,
            IBinder freezeThisOneIfNeeded, int displayId, boolean includeAppContainers) {
            IBinder freezeThisOneIfNeeded, int displayId) {
        if (!mDisplayReady) {
        if (!mDisplayReady) {
            return null;
            return null;
        }
        }
        Configuration config = null;
        Configuration config = null;


        if (updateOrientationFromAppTokensLocked(false, displayId, includeAppContainers)) {
        if (updateOrientationFromAppTokensLocked(false, displayId)) {
            // If we changed the orientation but mOrientationChangeComplete is already true,
            // If we changed the orientation but mOrientationChangeComplete is already true,
            // we used seamless rotation, and we don't need to freeze the screen.
            // we used seamless rotation, and we don't need to freeze the screen.
            if (freezeThisOneIfNeeded != null && !mRoot.mOrientationChangeComplete) {
            if (freezeThisOneIfNeeded != null && !mRoot.mOrientationChangeComplete) {
@@ -2427,11 +2427,6 @@ public class WindowManagerService extends IWindowManager.Stub
        return config;
        return config;
    }
    }


    boolean updateOrientationFromAppTokensLocked(boolean inTransaction, int displayId) {
        return updateOrientationFromAppTokensLocked(inTransaction, displayId,
                false /* includeAppContainers */);
    }

    /**
    /**
     * Determine the new desired orientation of the display, returning a non-null new Configuration
     * Determine the new desired orientation of the display, returning a non-null new Configuration
     * if it has changed from the current orientation.  IF TRUE IS RETURNED SOMEONE MUST CALL
     * if it has changed from the current orientation.  IF TRUE IS RETURNED SOMEONE MUST CALL
@@ -2442,25 +2437,13 @@ public class WindowManagerService extends IWindowManager.Stub
     * The orientation is computed from non-application windows first. If none of the
     * The orientation is computed from non-application windows first. If none of the
     * non-application windows specify orientation, the orientation is computed from application
     * non-application windows specify orientation, the orientation is computed from application
     * tokens.
     * tokens.
     *
     * @param inTransaction True if we are currently in a surface transaction.
     * @param displayId Id of the display to update orientation for.
     * @param includeAppContainers True if then app containers (stacks, tasks, ...) should be
     *                             factored in when determining the orientation. If false only
     *                             non-app/system containers will be used to determine the returned
     *                             orientation.
     *                             NOTE: Only call originating from activity manager are expected to
     *                             set this to true as it needs to synchronize several app states
     *                             like visibility with the update of display orientation.
     * @return True if the display orientation was updated.
     * @see android.view.IWindowManager#updateOrientationFromAppTokens(Configuration, IBinder, int)
     * @see android.view.IWindowManager#updateOrientationFromAppTokens(Configuration, IBinder, int)
     */
     */
    private boolean updateOrientationFromAppTokensLocked(boolean inTransaction, int displayId,
    boolean updateOrientationFromAppTokensLocked(boolean inTransaction, int displayId) {
            boolean includeAppContainers) {
        long ident = Binder.clearCallingIdentity();
        final long ident = Binder.clearCallingIdentity();
        try {
        try {
            final DisplayContent dc = mRoot.getDisplayContent(displayId);
            final DisplayContent dc = mRoot.getDisplayContent(displayId);
            final int req = dc.getOrientation(includeAppContainers);
            final int req = dc.getOrientation();
            if (req != dc.getLastOrientation()) {
            if (req != dc.getLastOrientation()) {
                dc.setLastOrientation(req);
                dc.setLastOrientation(req);
                //send a message to Policy indicating orientation change to take
                //send a message to Policy indicating orientation change to take