diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 023fbaddfb831..bb737ca4eff17 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -47,6 +47,9 @@
48dp
48dp
+
+ 12dp
0px
-
- 12dp
-
16dp
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 9844d8e5a67ad..b7a154d67c108 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -140,7 +140,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
mHeadsUpInset = mStatusBarHeight + resources.getDimensionPixelSize(
R.dimen.heads_up_status_bar_padding);
mDisplayCutoutTouchableRegionSize = resources.getDimensionPixelSize(
- R.dimen.display_cutout_touchable_region_size);
+ com.android.internal.R.dimen.display_cutout_touchable_region_size);
}
@Override
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 6605f3c605edc..02321a6e55a4a 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -2541,6 +2541,7 @@ public class DisplayPolicy {
*/
public void onOverlayChangedLw() {
onConfigurationChanged();
+ mSystemGestures.onConfigurationChanged();
}
/**
diff --git a/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java b/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java
index bd4e542033c5a..35afaedb0b437 100644
--- a/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java
+++ b/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java
@@ -17,9 +17,13 @@
package com.android.server.wm;
import android.content.Context;
+import android.graphics.Rect;
+import android.hardware.display.DisplayManagerGlobal;
import android.os.Handler;
import android.os.SystemClock;
import android.util.Slog;
+import android.view.Display;
+import android.view.DisplayCutout;
import android.view.GestureDetector;
import android.view.InputDevice;
import android.view.MotionEvent;
@@ -46,8 +50,9 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
private final Context mContext;
private final Handler mHandler;
- private final int mSwipeStartThreshold;
- private final int mSwipeDistanceThreshold;
+ private int mDisplayCutoutTouchableRegionSize;
+ private int mSwipeStartThreshold;
+ private int mSwipeDistanceThreshold;
private final Callbacks mCallbacks;
private final int[] mDownPointerId = new int[MAX_TRACKED_POINTERS];
private final float[] mDownX = new float[MAX_TRACKED_POINTERS];
@@ -65,14 +70,33 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
private long mLastFlingTime;
SystemGesturesPointerEventListener(Context context, Handler handler, Callbacks callbacks) {
- mContext = context;
+ mContext = checkNull("context", context);
mHandler = handler;
mCallbacks = checkNull("callbacks", callbacks);
- mSwipeStartThreshold = checkNull("context", context).getResources()
+
+ onConfigurationChanged();
+ }
+
+ void onConfigurationChanged() {
+ mSwipeStartThreshold = mContext.getResources()
.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
+
+ final Display display = DisplayManagerGlobal.getInstance()
+ .getRealDisplay(Display.DEFAULT_DISPLAY);
+ final DisplayCutout displayCutout = display.getCutout();
+ if (displayCutout != null) {
+ final Rect bounds = displayCutout.getBoundingRectTop();
+ if (!bounds.isEmpty()) {
+ // Expand swipe start threshold such that we can catch touches that just start below
+ // the notch area
+ mDisplayCutoutTouchableRegionSize = mContext.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.display_cutout_touchable_region_size);
+ mSwipeStartThreshold += mDisplayCutoutTouchableRegionSize;
+ }
+ }
mSwipeDistanceThreshold = mSwipeStartThreshold;
if (DEBUG) Slog.d(TAG, "mSwipeStartThreshold=" + mSwipeStartThreshold
- + " mSwipeDistanceThreshold=" + mSwipeDistanceThreshold);
+ + " mSwipeDistanceThreshold=" + mSwipeDistanceThreshold);
}
private static T checkNull(String name, T arg) {