summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorbaik.han <baik.han@lge.com>2015-04-14 19:49:28 +0900
committerbaik.han <baik.han@lge.com>2015-04-14 19:49:28 +0900
commit18a81488f928a94bdeede9b884f9b56c8da0c5fc (patch)
treec0d9b6b559e5d46bda39de3f0bfb179356774ecd /services
parentdfc30ae393fd610fcbd05a1ecfe7d4834a792de3 (diff)
downloadframeworks_native-18a81488f928a94bdeede9b884f9b56c8da0c5fc.zip
frameworks_native-18a81488f928a94bdeede9b884f9b56c8da0c5fc.tar.gz
frameworks_native-18a81488f928a94bdeede9b884f9b56c8da0c5fc.tar.bz2
Check orientation range has been initialized first
To avoid nan or infinity when orientation value is used for calculation without being initialized, check mOrientedRanges.haveOrientation value before using mOrientedRanges.orientation.min or .max value. Change-Id: I68ed9ab36819c5faa6422e9f061e1275aeed11e3 Signed-off-by: Baik Han <baik.han@lge.com>
Diffstat (limited to 'services')
-rw-r--r--services/inputflinger/InputReader.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 8634e42..318c85f 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -4315,7 +4315,7 @@ void TouchInputMapper::cookPointerData() {
bottom = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate;
top = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate;
orientation -= M_PI_2;
- if (orientation < mOrientedRanges.orientation.min) {
+ if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
@@ -4327,7 +4327,7 @@ void TouchInputMapper::cookPointerData() {
bottom = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate;
top = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate;
orientation -= M_PI;
- if (orientation < mOrientedRanges.orientation.min) {
+ if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
@@ -4339,7 +4339,7 @@ void TouchInputMapper::cookPointerData() {
bottom = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
top = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
orientation += M_PI_2;
- if (orientation > mOrientedRanges.orientation.max) {
+ if (mOrientedRanges.haveOrientation && orientation > mOrientedRanges.orientation.max) {
orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;