Don't crash if NSSL gets incomplete gesture
In *theory*, a View should always receive an ACTION_DOWN before receiving any other touch events, but this isn't always the case in practice. Whenever we see one of these "partial" gestures, we should ignore it until a real one starts. Test: manual Bug: 146323887 Change-Id: I22182d90b0057df67fbd6d20785da23d6c17dcf3
This commit is contained in:
@@ -3865,9 +3865,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
initVelocityTrackerIfNotExists();
|
initVelocityTrackerIfNotExists();
|
||||||
mVelocityTracker.addMovement(ev);
|
mVelocityTracker.addMovement(ev);
|
||||||
|
|
||||||
final int action = ev.getAction();
|
final int action = ev.getActionMasked();
|
||||||
|
if (ev.findPointerIndex(mActivePointerId) == -1 && action != MotionEvent.ACTION_DOWN) {
|
||||||
|
// Incomplete gesture, possibly due to window swap mid-gesture. Ignore until a new
|
||||||
|
// one starts.
|
||||||
|
Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent "
|
||||||
|
+ MotionEvent.actionToString(ev.getActionMasked()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (action & MotionEvent.ACTION_MASK) {
|
switch (action) {
|
||||||
case MotionEvent.ACTION_DOWN: {
|
case MotionEvent.ACTION_DOWN: {
|
||||||
if (getChildCount() == 0 || !isInContentBounds(ev)) {
|
if (getChildCount() == 0 || !isInContentBounds(ev)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user