summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Chang <chengjeff@google.com> 2019-06-18 11:51:25 +0800
committer Jeff Chang <chengjeff@google.com> 2019-06-20 17:03:14 +0000
commit1c459ef9e77aca63d33fadd60efebc89dce1e291 (patch)
tree8306114123b8d092321f53e26656dacd742d839f
parent6e4e9817b80ad8776ad58c4b3af8348e12c72505 (diff)
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 (cherry picked from commit 3cf3e56ad98995fc62797bfaa6cc462f901865c7)
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 7badc7a43774..5c006941f1e6 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -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