From 71b16e81f9cbf2e288611f32c43ea7fb4a331fcf Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Mon, 10 Mar 2014 09:47:59 -0700 Subject: [PATCH] Support unique calibration per orientation Updates the format of the calibration XML to store the Surface rotation that a specific calibration applies to. Also updates the API to require a rotation value for get/set, and has the native framework supply this according to the current rotation whenever it changes. Change-Id: If38563ceba27c9d8a75f9fd7928c8d7c9d187afb --- services/inputflinger/InputReader.cpp | 6 +++++- services/inputflinger/InputReader.h | 2 +- services/inputflinger/tests/InputReader_test.cpp | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp index a8ccf8bb0..05b1a9cb9 100644 --- a/services/inputflinger/InputReader.cpp +++ b/services/inputflinger/InputReader.cpp @@ -3282,6 +3282,9 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) { break; } + // Location + updateAffineTransformation(); + if (mDeviceMode == DEVICE_MODE_POINTER) { // Compute pointer gesture detection parameters. float rawDiagonal = hypotf(rawWidth, rawHeight); @@ -3660,7 +3663,8 @@ void TouchInputMapper::dumpAffineTransformation(String8& dump) { } void TouchInputMapper::updateAffineTransformation() { - mAffineTransform = getPolicy()->getTouchAffineTransformation(mDevice->getDescriptor()); + mAffineTransform = getPolicy()->getTouchAffineTransformation(mDevice->getDescriptor(), + mSurfaceOrientation); } void TouchInputMapper::reset(nsecs_t when) { diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h index 43d486961..c1ce5f7c5 100644 --- a/services/inputflinger/InputReader.h +++ b/services/inputflinger/InputReader.h @@ -316,7 +316,7 @@ public: /* Gets the affine calibration associated with the specified device. */ virtual TouchAffineTransformation getTouchAffineTransformation( - const String8& inputDeviceDescriptor) = 0; + const String8& inputDeviceDescriptor, int32_t surfaceRotation) = 0; }; diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp index 34d70aeb7..c6eb1fdd1 100644 --- a/services/inputflinger/tests/InputReader_test.cpp +++ b/services/inputflinger/tests/InputReader_test.cpp @@ -174,7 +174,8 @@ public: return mInputDevices; } - TouchAffineTransformation getTouchAffineTransformation(const String8& inputDeviceDescriptor) { + TouchAffineTransformation getTouchAffineTransformation(const String8& inputDeviceDescriptor, + int32_t surfaceRotation) { return transform; }