Enable expanding of status bar just below the notch
Test: Expand status bar with cutout emulation enabled
Bug: 79435224
Change-Id: I427f382578f4dc2abe347973323bb455cb67594d
Merged-In: I427f382578f4dc2abe347973323bb455cb67594d
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index a79a41b..0390f60 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -94,6 +94,12 @@
private boolean mExpandAnimationRunning;
private boolean mExpandAnimationPending;
+ /**
+ * If set to true, the current gesture started below the notch and we need to dispatch touch
+ * events manually as it's outside of the regular view bounds.
+ */
+ private boolean mExpandingBelowNotch;
+
public StatusBarWindowView(Context context, AttributeSet attrs) {
super(context, attrs);
setMotionEventSplittingEnabled(false);
@@ -258,7 +264,16 @@
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN;
+ boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP;
boolean isCancel = ev.getActionMasked() == MotionEvent.ACTION_CANCEL;
+
+ // Reset manual touch dispatch state here but make sure the UP/CANCEL event still gets
+ // delivered.
+ boolean expandingBelowNotch = mExpandingBelowNotch;
+ if (isUp || isCancel) {
+ mExpandingBelowNotch = false;
+ }
+
if (!isCancel && mService.shouldIgnoreTouch()) {
return false;
}
@@ -291,6 +306,17 @@
mService.mDozeScrimController.extendPulse();
}
+ // In case we start outside of the view bounds (below the status bar), we need to dispatch
+ // the touch manually as the view system can't accomodate for touches outside of the
+ // regular view bounds.
+ if (isDown && ev.getY() >= mBottom) {
+ mExpandingBelowNotch = true;
+ expandingBelowNotch = true;
+ }
+ if (expandingBelowNotch) {
+ return mNotificationPanel.dispatchTouchEvent(ev);
+ }
+
return super.dispatchTouchEvent(ev);
}