Repository: flutter
Issue: Flutter crashes when you press multiple buttons using a mouse on Chromebook and release out of window
Labels: framework,engine,platform-chromebook,a: desktop,a: mouse,P2,team-framework,triaged-framework

## Description
- Run flutter_gallery on a Chromebook and use a mouse
- Press both mouse buttons anywhere and hold
- Drag out of the window
- Release one of the buttons (or both buttons)
- Move back into the window 
- App crashes

On the other hand, if you do the same thing but only presses only one button at the 2nd step, then it doesn't crash

## Investigation
This is the assertion that caused the crash:
```
E/flutter ( 3522): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 'package:flutter/src/gestures/converter.dart': Failed assertion: line 134 pos 20: '!state.down': is not true.
E/flutter ( 3522): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
E/flutter ( 3522): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter ( 3522): #2      PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:134:20)
E/flutter ( 3522): #3      _SyncIterator.moveNext (dart:core-patch/core_patch.dart:144:12)
E/flutter ( 3522): #4      ListQueue.addAll (dart:collection/queue.dart:655:25)
E/flutter ( 3522): #5      GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:84:27)
E/flutter ( 3522): #6      _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter ( 3522): #7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 3522): #8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter ( 3522): #9      _invoke1 (dart:ui/hooks.dart:263:10)
E/flutter ( 3522): #10     _dispatchPointerDataPacket (dart:ui/hooks.dart:172:5)
```

I added print statements of `event` at the beginning of `onGenericMotionEvent` and `onTouchEvent` in `AndroidTouchProcessor.java`. This is the log when you press two buttons, move out, release, then move back: (duplicate items removed)
```
I/System.out( 3604): onGenericMotionEvent: Change 3 buttons 0
I/System.out( 3604): onTouchEvent: Change 4 buttons 2
// When presseing the second button; when dragging
I/System.out( 3604): onTouchEvent: Change 5 buttons 3
// When releasing one of the buttons
I/System.out( 3604): onTouchEvent: Change 5 buttons 2
// Whether you release the other button or not, no more logs are added.
// When moving back into the window
I/System.out( 3604): onGenericMotionEvent: Change 3 buttons 0
```

The last line `onGenericMotionEvent: Change 3 buttons 0` dispatches a hover event, which is unexpected by `PointerEventConverter` because the previous event has not been ended by an up event or cancel event yet, leading to the assertion failure.

On the contrary, this is the log when you press one button, move out, release, then move back:
```
I/System.out( 3604): onGenericMotionEvent: Change 3 buttons 0          
I/System.out( 3604): onTouchEvent: Change 5 buttons 2
// When releasing the button
I/System.out( 3604): onTouchEvent: Change 6 buttons 0  
```
Somehow this time an up event is dispatched.

## Environment 
- Framework: ecf9748a77c86747935ba2ae59c7c19ff8bef8e1
- Engine: 5a33d6ab06fa2cc94cdd864ff238d2c58d6b7e4e
- Device: Chromebook Pixel 75.0.3770.129