diff options
| author | 2021-08-04 18:50:03 -0700 | |
|---|---|---|
| committer | 2021-12-08 16:44:03 +0000 | |
| commit | c5b0f4ebf2a4c0acd36992f012847e94d37e5adb (patch) | |
| tree | 06a060253179aa1b1ff70225cfb9bea908166aef | |
| parent | e1d8d046037a9195dd7080dd6e4fdd1b9edcf318 (diff) | |
Fix shade flicker & touch absorption
Intercept MOVE events for closed shade (with no HUNs)
and call startExpandMotion when appropriate.
----------------------------------------------------
Fixes: 188249360 (shade flicker to full height on swipe open)
This bug happened because ag/13733252 introduced
a new behavior (reverted here) where
PVC intercepts only if PanelView is hidden. This means:
=> PanelView initially shows onIntercept(down),
so we do NOT intercept and onTouch(down) does NOT run.
=> PanelView is then hidden onIntercept(move),
so we intercept and onTouch(move) runs.
When onTouch(down) does NOT run and onTouch(move) runs,
we are MISSING the following:
=> onTouch(down): mGestureWaitForTouchSlop = true for closed shade
=> onTouch(move) calls startExpandMotion
=> startExpandMotion: mInitialOffsetOnTouch = 0
=> onTouch(move): newHeight = mInitialOffsetOnTouch = 0
Instead, newHeight = full shade height from previous shade open.
This causes the shade to jump to full height on swipe start.
----------------------------------------------------
Bug: 178277858 (touch absorption / shade not opening on swipe)
This bug happened because onIntercept(move) did not intercept and call
startExpandMotion when we swipe open from closed shade, resulting in
the shade staying closed while child views silently eat the event.
------------------------------------------------
Test: open/close shade with varying drag speeds and flings
=> shade consistently opens with no flicker to full height
Test: swipe-to-dismiss hun, expand hun, swipe down for hun-to-shade
=> no regressions
Change-Id: I26ada34ed173393ee08a96aefd37b1935702bb90
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index 323a1128d3bb..de0f31d3cf59 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -1211,10 +1211,14 @@ public abstract class PanelViewController { case MotionEvent.ACTION_MOVE: final float h = y - mInitialTouchY; addMovement(event); - if (canCollapsePanel || mTouchStartedInEmptyArea || mAnimatingOnDown) { + final boolean openShadeWithoutHun = + mPanelClosedOnDown && !mCollapsedAndHeadsUpOnDown; + if (canCollapsePanel || mTouchStartedInEmptyArea || mAnimatingOnDown + || openShadeWithoutHun) { float hAbs = Math.abs(h); float touchSlop = getTouchSlop(event); - if ((h < -touchSlop || (mAnimatingOnDown && hAbs > touchSlop)) + if ((h < -touchSlop + || ((openShadeWithoutHun || mAnimatingOnDown) && hAbs > touchSlop)) && hAbs > Math.abs(x - mInitialTouchX)) { cancelHeightAnimator(); startExpandMotion(x, y, true /* startTracking */, mExpandedHeight); @@ -1227,10 +1231,7 @@ public abstract class PanelViewController { mVelocityTracker.clear(); break; } - - // Finally, if none of the above cases applies, ensure that touches do not get handled - // by the contents of a panel that is not showing (a bit of a hack to avoid b/178277858) - return (mView.getVisibility() != View.VISIBLE); + return false; } @Override |