Handle duplicate DOWN event

After unlocking the device, an immediate swipe down to reveal the
shade (a very common user journey) can sometimes just directly to the
QS shade variant, instead of showing the expected QQS shade with
notifications. I have been unable to find root cause at this point,
however, I am aware that multiple ACTION_DOWN events are issued in
this case with the same downTime.

To fix, detect this very specific scenario and ignore the touch.

Fixes: 193350347
Test: manual, follow steps in bug (swipe down after unlock)
Change-Id: I84ba92fb0cf981b227afdff15cbe41c09ea56f5d
(cherry picked from commit 2e8d3e5e09)
This commit is contained in:
Matt Pietal
2021-09-22 12:29:48 -04:00
committed by Daniel Sandler
parent 775d2cdc12
commit 83d700c593

View File

@@ -3869,6 +3869,9 @@ public class NotificationPanelViewController extends PanelViewController {
@Override @Override
protected TouchHandler createTouchHandler() { protected TouchHandler createTouchHandler() {
return new TouchHandler() { return new TouchHandler() {
private long mLastTouchDownTime = -1L;
@Override @Override
public boolean onInterceptTouchEvent(MotionEvent event) { public boolean onInterceptTouchEvent(MotionEvent event) {
if (mBlockTouches || mQsFullyExpanded && mQs.disallowPanelTouches()) { if (mBlockTouches || mQsFullyExpanded && mQs.disallowPanelTouches()) {
@@ -3898,6 +3901,19 @@ public class NotificationPanelViewController extends PanelViewController {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (event.getDownTime() == mLastTouchDownTime) {
// An issue can occur when swiping down after unlock, where multiple down
// events are received in this handler with identical downTimes. Until the
// source of the issue can be located, detect this case and ignore.
// see b/193350347
Log.w(TAG, "Duplicate down event detected... ignoring");
return true;
}
mLastTouchDownTime = event.getDownTime();
}
if (mBlockTouches || (mQsFullyExpanded && mQs != null if (mBlockTouches || (mQsFullyExpanded && mQs != null
&& mQs.disallowPanelTouches())) { && mQs.disallowPanelTouches())) {
return false; return false;