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

Commit 3cf3e56a authored by Jeff Chang's avatar Jeff Chang
Browse files

Fix a potential crash when calculate system gesture exclusion

When calculate the exclude region during the swipe gesture. There is a
chance to meet index out of bounds exception when traverse all windows
to assemble the gesture exclusion rects. We add a WM lock to protect
the window state correctly.

Bug: 135298121
Test: atest DisplayPolicyTests
      atest DisplayContentTests

Change-Id: Ib71134d97e43ac91ce6713dd3dbf30280c44c574
parent 64fbab54
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -478,8 +478,10 @@ public class DisplayPolicy {

                    @Override
                    public void onSwipeFromRight() {
                        final Region excludedRegion =
                                mDisplayContent.calculateSystemGestureExclusion();
                        final Region excludedRegion;
                        synchronized (mLock) {
                            excludedRegion = mDisplayContent.calculateSystemGestureExclusion();
                        }
                        final boolean sideAllowed = mNavigationBarAlwaysShowOnSideGesture
                                || mNavigationBarPosition == NAV_BAR_RIGHT;
                        if (mNavigationBar != null && sideAllowed
@@ -490,8 +492,10 @@ public class DisplayPolicy {

                    @Override
                    public void onSwipeFromLeft() {
                        final Region excludedRegion =
                                mDisplayContent.calculateSystemGestureExclusion();
                        final Region excludedRegion;
                        synchronized (mLock) {
                            excludedRegion = mDisplayContent.calculateSystemGestureExclusion();
                        }
                        final boolean sideAllowed = mNavigationBarAlwaysShowOnSideGesture
                                || mNavigationBarPosition == NAV_BAR_LEFT;
                        if (mNavigationBar != null && sideAllowed