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

Commit 5d5127bf authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Fixed bug with wrong task bounds when device is rotated 180°"

parents e36c8078 e1fe4d1e
Loading
Loading
Loading
Loading
+16 −10
Original line number Original line Diff line number Diff line
@@ -523,19 +523,25 @@ class Task implements DimLayer.DimLayerUser {
            return;
            return;
        }
        }


        // Device rotation changed. We don't want the task to move around on the screen when
        // Device rotation changed.
        // this happens, so update the task bounds so it stays in the same place.
        // - Reset the bounds to the pre-scroll bounds as whatever scrolling was done is no longer
        // valid.
        // - Rotate the bounds and notify activity manager if the task can be resized independently
        // from its stack. The stack will take care of task rotation for the other case.
        mTmpRect2.set(mPreScrollBounds);
        mTmpRect2.set(mPreScrollBounds);

        if (!StackId.isTaskResizeAllowed(mStack.mStackId)) {
            setBounds(mTmpRect2, mOverrideConfig);
            return;
        }

        displayContent.rotateBounds(mRotation, newRotation, mTmpRect2);
        displayContent.rotateBounds(mRotation, newRotation, mTmpRect2);
        if (setBounds(mTmpRect2, mOverrideConfig) != BOUNDS_CHANGE_NONE) {
        if (setBounds(mTmpRect2, mOverrideConfig) != BOUNDS_CHANGE_NONE) {
            // Post message to inform activity manager of the bounds change simulating
            // Post message to inform activity manager of the bounds change simulating a one-way
            // a one-way call. We do this to prevent a deadlock between window manager
            // call. We do this to prevent a deadlock between window manager lock and activity
            // lock and activity manager lock been held. Only tasks within the freeform stack
            // manager lock been held.
            // are resizeable independently of their stack resizing.
            mService.mH.obtainMessage(RESIZE_TASK, mTaskId,
            if (mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
                    RESIZE_MODE_SYSTEM_SCREEN_ROTATION, mPreScrollBounds).sendToTarget();
                mService.mH.sendMessage(mService.mH.obtainMessage(
                        RESIZE_TASK, mTaskId, RESIZE_MODE_SYSTEM_SCREEN_ROTATION, mPreScrollBounds));
            }
        }
        }
    }
    }