Ensure mConsumer isn't set to null in reset().

mResetGestureInputConsumer is not initialized until onUserUnlocked(), meaning it might still be null in reset(). Use NO_OP input consumer in that case.

Test: none
Bug: 191669813
Change-Id: Ib9edde50fba0b6164390ec2b5c877d3db74ddfeb
This commit is contained in:
Tony Wickham
2021-06-21 12:41:36 -07:00
parent 53ec9a4e06
commit 9c10d08e1e
@@ -807,7 +807,13 @@ public class TouchInteractionService extends Service implements PluginListener<O
}
private void reset() {
mConsumer = mUncheckedConsumer = mResetGestureInputConsumer;
if (mResetGestureInputConsumer != null) {
mConsumer = mUncheckedConsumer = mResetGestureInputConsumer;
} else {
// mResetGestureInputConsumer isn't initialized until onUserUnlocked(), so reset to
// NO_OP until then (we never want these to be null).
mConsumer = mUncheckedConsumer = InputConsumer.NO_OP;
}
mGestureState = DEFAULT_STATE;
// By default, use batching of the input events, but check receiver before using in the rare
// case that the monitor was disposed before the swipe settled