diff options
| author | 2023-10-17 21:22:37 +0000 | |
|---|---|---|
| committer | 2023-10-17 21:22:37 +0000 | |
| commit | 0b3dbcefb2d37c8c243b93eda498c5599ace25c6 (patch) | |
| tree | 9cdae903736d3f88660d1b5bbf08c7e5f8ffc91f | |
| parent | 3881e39ce0afd821adc9ec312415db595dd4e03f (diff) | |
| parent | 33dbf5d27b8f886d92a22ec35548bd99ae68bd12 (diff) | |
Merge "input: handle change in std::span::size type" into main am: 33dbf5d27b
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2792197
Change-Id: I04e95e28cb9efd2702b50306b4d2df23eb402908
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/input/MotionPredictor.cpp | 5 | ||||
| -rw-r--r-- | libs/input/TfLiteMotionPredictor.cpp | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libs/input/MotionPredictor.cpp b/libs/input/MotionPredictor.cpp index 3037573538..abcca345d3 100644 --- a/libs/input/MotionPredictor.cpp +++ b/libs/input/MotionPredictor.cpp @@ -176,12 +176,13 @@ std::unique_ptr<MotionEvent> MotionPredictor::predict(nsecs_t timestamp) { int64_t predictionTime = mBuffers->lastTimestamp(); const int64_t futureTime = timestamp + mPredictionTimestampOffsetNanos; - for (int i = 0; i < predictedR.size() && predictionTime <= futureTime; ++i) { + for (size_t i = 0; i < static_cast<size_t>(predictedR.size()) && predictionTime <= futureTime; + ++i) { const TfLiteMotionPredictorSample::Point point = convertPrediction(axisFrom, axisTo, predictedR[i], predictedPhi[i]); // TODO(b/266747654): Stop predictions if confidence is < some threshold. - ALOGD_IF(isDebug(), "prediction %d: %f, %f", i, point.x, point.y); + ALOGD_IF(isDebug(), "prediction %zu: %f, %f", i, point.x, point.y); PointerCoords coords; coords.clear(); coords.setAxisValue(AMOTION_EVENT_AXIS_X, point.x); diff --git a/libs/input/TfLiteMotionPredictor.cpp b/libs/input/TfLiteMotionPredictor.cpp index 85fa176129..8d10ff56b0 100644 --- a/libs/input/TfLiteMotionPredictor.cpp +++ b/libs/input/TfLiteMotionPredictor.cpp @@ -115,8 +115,7 @@ std::span<T> getTensorBuffer(typename std::conditional<std::is_const<T>::value, tensor->name, TfLiteTypeGetName(tensor->type), TfLiteTypeGetName(type)); LOG_ALWAYS_FATAL_IF(!tensor->data.data); - return {reinterpret_cast<T*>(tensor->data.data), - static_cast<typename std::span<T>::index_type>(tensor->bytes / sizeof(T))}; + return std::span<T>(reinterpret_cast<T*>(tensor->data.data), tensor->bytes / sizeof(T)); } // Verifies that a tensor exists and has an underlying buffer of type T. |