Patch prediction library to allow report rate autodetection

Test: used testing app to ensure prediction are being generated
Bug: 253685081
Change-Id: Ibe4f6682012afe54b742f2904d868c5cea898294
diff --git a/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java b/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java
index d223ddb..c97dd19 100644
--- a/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java
+++ b/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java
@@ -79,7 +79,9 @@
         if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN) {
             KalmanInkPredictor predictor = new KalmanInkPredictor();
             predictor.setPredictionTarget(mPredictionTargetMs);
-            predictor.setReportRate(mReportRateMs);
+            if (mReportRateMs > 0) {
+                predictor.setReportRate(mReportRateMs);
+            }
             predictor.initStrokePrediction(pointerId);
             predictor.onTouchEvent(event);
             mPredictorMap.put(pointerId, predictor);
@@ -145,12 +147,25 @@
         }
 
         // Compute minimal history size for every predicted single pointer MotionEvent
+        boolean foundNullPrediction = false;
         int minHistorySize = Integer.MAX_VALUE;
         for (MotionEvent ev : singlePointerEvents) {
+            if (ev == null) {
+                foundNullPrediction = true;
+                break;
+            }
             if (ev.getHistorySize() < minHistorySize) {
                 minHistorySize = ev.getHistorySize();
             }
         }
+
+        if (foundNullPrediction) {
+            for (MotionEvent ev : singlePointerEvents) {
+                ev.recycle();
+            }
+            return null;
+        }
+
         // Take into account the current event of each predicted MotionEvent
         minHistorySize += 1;