Fix notification group scroll in split shade
QsContainer was matching the entire screen size for split shade, while only the qs area in normal shade.
This made `isInsideQsContainer` to always return true for the split shade (also because only the Y coordinate was checked, as there was the assumption QS where only at the top).
Now, the `isInsideQsContainer` (renamed to `isInsideQsHeader`) checks if the touch is inside the QsHeader, that matches the wanted bound both in the normal and split QS.
Fixes: 225328865
Fixes: 223951547
Test: atest NotificationStackScrollLayoutTest
Change-Id: Ie468610eae68eb698310a95a5c9f9d98be4d89fb
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 32d37d1..c0553b5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -347,7 +347,9 @@
setDimAmount((Float) animation.getAnimatedValue());
}
};
- protected ViewGroup mQsContainer;
+ protected ViewGroup mQsHeader;
+ // Rect of QsHeader. Kept as a field just to avoid creating a new one each time.
+ private Rect mQsHeaderBound = new Rect();
private boolean mContinuousShadowUpdate;
private boolean mContinuousBackgroundUpdate;
private ViewTreeObserver.OnPreDrawListener mShadowUpdater
@@ -1598,8 +1600,8 @@
}
@ShadeViewRefactor(RefactorComponent.ADAPTER)
- public void setQsContainer(ViewGroup qsContainer) {
- mQsContainer = qsContainer;
+ public void setQsHeader(ViewGroup qsHeader) {
+ mQsHeader = qsHeader;
}
@ShadeViewRefactor(RefactorComponent.ADAPTER)
@@ -3458,7 +3460,7 @@
if (!isScrollingEnabled()) {
return false;
}
- if (isInsideQsContainer(ev) && !mIsBeingDragged) {
+ if (isInsideQsHeader(ev) && !mIsBeingDragged) {
return false;
}
mForcedScroll = null;
@@ -3611,8 +3613,9 @@
}
@ShadeViewRefactor(RefactorComponent.INPUT)
- protected boolean isInsideQsContainer(MotionEvent ev) {
- return ev.getY() < mQsContainer.getBottom();
+ protected boolean isInsideQsHeader(MotionEvent ev) {
+ mQsHeader.getBoundsOnScreen(mQsHeaderBound);
+ return mQsHeaderBound.contains((int) ev.getX(), (int) ev.getY());
}
@ShadeViewRefactor(RefactorComponent.INPUT)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 5bc50ae..3e630cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -1234,8 +1234,9 @@
mView.setExpandedHeight(expandedHeight);
}
- public void setQsContainer(ViewGroup view) {
- mView.setQsContainer(view);
+ /** Sets the QS header. Used to check if a touch is within its bounds. */
+ public void setQsHeader(ViewGroup view) {
+ mView.setQsHeader(view);
}
public void setAnimationsEnabled(boolean enabled) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 2d16b52..11628cb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -3592,7 +3592,7 @@
}
});
mLockscreenShadeTransitionController.setQS(mQs);
- mNotificationStackScrollLayoutController.setQsContainer((ViewGroup) mQs.getView());
+ mNotificationStackScrollLayoutController.setQsHeader((ViewGroup) mQs.getHeader());
mQs.setScrollListener(mScrollListener);
updateQsExpansion();
}