From a811938d40070b96557df0f2a36ba8daa561fdd4 Mon Sep 17 00:00:00 2001 From: Tom Ouyang Date: Tue, 18 Sep 2012 22:56:09 -0700 Subject: [PATCH] Refine gesture point duration calcuation to be more localized Bug: 7165929 Change-Id: I3bb1c2622338023626fe4a879e43a86ac8fd0707 --- native/jni/src/proximity_info_state.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp index b9fce5fef..c5f2884c6 100644 --- a/native/jni/src/proximity_info_state.cpp +++ b/native/jni/src/proximity_info_state.cpp @@ -464,8 +464,8 @@ float ProximityInfoState::calculateNormalizedSquaredDistance( } int ProximityInfoState::getDuration(const int index) const { - if (mInputSize > 0 && index > 0 && index < mInputSize - 1) { - return mTimes[index + 1] - mTimes[index - 1]; + if (mInputSize > 0 && index >= 0 && index < mInputSize - 1) { + return mTimes[index + 1] - mTimes[index]; } return 0; }