Use the last cooked touch state for generating button release events
This bug was exposed by the refactor in ag/20068126 that cleans up the CookedPointerState by ensuring it is always zero-initialized. Button release events are generated before the touch state change events are generated. If the touch goes up before or at the same time as the button goes up, the "current" touch state will have no pointers. The old logic got around this by using the getting the values for the "last" touch state's pointers from the "current" touch state. This wrong, because the "last" state's pointers no longer exist in the "current" state. However, because the CookedState copying logic never reset the underlying PointerCoords data after the pointer is lifted, the "last" state's pointer's values were essentially preserved in the "current" state in some cases. This meant the expected behavior was observed most of the time even though the logic was incorrect. This CL corrects the button release event generation logic to ensure that "last" state is used when generating those events. Bug: 245989146 Test: atest inputflinger_tests Change-Id: I9889e7f816f4ba885eae783ebf4c7721eb60db3a
Loading
Please register or sign in to comment