Add null check between calling onMotionPauseDetected() and Changed()
Some listeners such as ScreenPinnedInputConsumer only care about the
first pause detection and thus clear the MotionPauseDetector in
onMotionPauseDetected(). Because clear() sets mOnMotionPauseListener
to null, we need a second null check before onMotionPauseChanged().
Fixes: 169329910
Change-Id: I4fc30d67ad808a5b0c8feb10cc5392d7cae042b1
diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
index d0f6879..da5f59e 100644
--- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
+++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
@@ -193,7 +193,10 @@
if (isFirstDetectedPause) {
mOnMotionPauseListener.onMotionPauseDetected();
}
- mOnMotionPauseListener.onMotionPauseChanged(mIsPaused);
+ // Null check again as onMotionPauseDetected() maybe have called clear().
+ if (mOnMotionPauseListener != null) {
+ mOnMotionPauseListener.onMotionPauseChanged(mIsPaused);
+ }
}
}
}