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

Commit 4c9ba52a authored by Chong Zhang's avatar Chong Zhang
Browse files

Fixes for dim bounds and touch bounds

- Change dimming and touch related usage to use task's "max visible
  bounds", which is the app within a task that's covering the maximum
  visible area looking down from top. This solves the problem where
  an app pops up a dialog window. We should dimming (and allow touch)
  the entire task area, not just the dialog's visible area.

- Fix initial bounds used in drag moving/resizing, this should be
  visible bounds of the app main window, not the original task bounds.

- Fix touch region set up for freeform apps, even when task is not
  full screen, we should get the max visible bounds first (as freeform
  app could have dialogs too).

bug: 25494928
bug: 25487005
bug: 25613403

Change-Id: Ib1c6a1665fb83ded2fcb0a7ea92cf1def5372edd
parent f9ca3993
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class DimLayer {
        /** Returns the display info. of the dim layer user. */
        DisplayInfo getDisplayInfo();
        /** Gets the bounds of the dim layer user. */
        void getBounds(Rect outBounds);
        void getDimBounds(Rect outBounds);
        String toShortString();
    }
    /** The user of this dim layer. */
+7 −8
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class DimLayerController {

    /** Updates the dim layer bounds, recreating it if needed. */
    void updateDimLayer(DimLayer.DimLayerUser dimLayerUser) {
        DimLayerState state = getOrCreateDimLayerState(dimLayerUser, false);
        DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
        final boolean previousFullscreen = state.dimLayer != null
                && state.dimLayer == mSharedFullScreenDimLayer;
        DimLayer newDimLayer;
@@ -63,7 +63,7 @@ class DimLayerController {
                    // Create new full screen dim layer.
                    newDimLayer = new DimLayer(mDisplayContent.mService, dimLayerUser, displayId);
                }
                dimLayerUser.getBounds(mTmpBounds);
                dimLayerUser.getDimBounds(mTmpBounds);
                newDimLayer.setBounds(mTmpBounds);
                mSharedFullScreenDimLayer = newDimLayer;
            } else if (state.dimLayer != null) {
@@ -73,14 +73,13 @@ class DimLayerController {
            newDimLayer = (state.dimLayer == null || previousFullscreen)
                    ? new DimLayer(mDisplayContent.mService, dimLayerUser, displayId)
                    : state.dimLayer;
            dimLayerUser.getBounds(mTmpBounds);
            dimLayerUser.getDimBounds(mTmpBounds);
            newDimLayer.setBounds(mTmpBounds);
        }
        state.dimLayer = newDimLayer;
    }

    private DimLayerState getOrCreateDimLayerState(
            DimLayer.DimLayerUser dimLayerUser, boolean aboveApp) {
    private DimLayerState getOrCreateDimLayerState(DimLayer.DimLayerUser dimLayerUser) {
        if (DEBUG_DIM_LAYER) Slog.v(TAG, "getOrCreateDimLayerState, dimLayerUser="
                + dimLayerUser.toShortString());
        DimLayerState state = mState.get(dimLayerUser);
@@ -88,7 +87,6 @@ class DimLayerController {
            state = new DimLayerState();
            mState.put(dimLayerUser, state);
        }
        state.dimAbove = aboveApp;
        return state;
    }

@@ -127,7 +125,8 @@ class DimLayerController {
            WindowStateAnimator newWinAnimator, boolean aboveApp) {
        // Only set dim params on the highest dimmed layer.
        // Don't turn on for an unshown surface, or for any layer but the highest dimmed layer.
        DimLayerState state = getOrCreateDimLayerState(dimLayerUser, aboveApp);
        DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
        state.dimAbove = aboveApp;
        if (DEBUG_DIM_LAYER) Slog.v(TAG, "startDimmingIfNeeded,"
                + " dimLayerUser=" + dimLayerUser.toShortString()
                + " newWinAnimator=" + newWinAnimator
@@ -161,7 +160,7 @@ class DimLayerController {
                + " state.dimLayer.isDimming=" + state.dimLayer.isDimming());
        if (!state.continueDimming && state.dimLayer.isDimming()) {
            state.animator = null;
            dimLayerUser.getBounds(mTmpBounds);
            dimLayerUser.getDimBounds(mTmpBounds);
            state.dimLayer.setBounds(mTmpBounds);
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ class DisplayContent {
                // windows frames when the app window is the IME target.
                final WindowState win = task.getTopAppMainWindow();
                if (win != null) {
                    win.getVisibleBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
                    win.getVisibleBounds(mTmpRect);
                    if (mTmpRect.contains(x, y)) {
                        return task.mTaskId;
                    }
@@ -332,7 +332,7 @@ class DisplayContent {
                // start at (0,0) after it's adjusted for the status bar.)
                final WindowState win = task.getTopAppMainWindow();
                if (win != null) {
                    win.getVisibleBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
                    win.getVisibleBounds(mTmpRect);
                    mTmpRect.inset(-delta, -delta);
                    if (mTmpRect.contains(x, y)) {
                        mTmpRect.inset(delta, delta);
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ public class DockedStackDividerController {
            frame.set(mLastRect);
            return;
        } else {
            stack.getBounds(mTmpRect);
            stack.getDimBounds(mTmpRect);
        }
        int side = stack.getDockSide();
        switch (side) {
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ class DragState {
                continue;
            }

            child.getVisibleBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
            child.getVisibleBounds(mTmpRect);
            if (!mTmpRect.contains(x, y)) {
                // outside of this window's activity stack == don't tell about drags
                continue;
Loading