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

Commit dae1d7be authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Reduce unnecessary invocation of updateKeepClearAreas

The one in performSurfacePlacementNoTrace should be enough.

- The calculation relies on bounds and window frames. The changes of
  focus, insets control won't affect the result.
- If display size changes, performSurfacePlacement is guaranteed to
  be called (remove the invocation in onDisplayChanged).
- Add missing Region.recycle.

Bug: 159103089
Test: atest KeepClearRectsTests
Change-Id: I45571944cc0dc8e425daa506bd0752081df571e8
parent 944de4f9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2951,7 +2951,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    void onDisplayChanged(DisplayContent dc) {
        super.onDisplayChanged(dc);
        updateSystemGestureExclusionLimit();
        updateKeepClearAreas();
    }

    void updateSystemGestureExclusionLimit() {
@@ -4030,7 +4029,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }

        adjustForImeIfNeeded();
        updateKeepClearAreas();

        // We may need to schedule some toast windows to be removed. The toasts for an app that
        // does not have input focus are removed within a timeout to prevent apps to redress
@@ -6151,6 +6149,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                    Region touchableRegion = Region.obtain();
                    w.getEffectiveTouchableRegion(touchableRegion);
                    RegionUtils.forEachRect(touchableRegion, rect -> outUnrestricted.add(rect));
                    touchableRegion.recycle();
                }
            }

+0 −1
Original line number Diff line number Diff line
@@ -224,7 +224,6 @@ class InsetsStateController {
        if (changed) {
            notifyInsetsChanged();
            mDisplayContent.updateSystemGestureExclusion();
            mDisplayContent.updateKeepClearAreas();
            mDisplayContent.getDisplayPolicy().updateSystemBarAttributes();
        }
    }