diff options
author | Jason Gerecke <killertofu@gmail.com> | 2014-01-27 18:30:37 -0800 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2014-03-10 15:54:21 -0700 |
commit | d6396d67201fb2b64d13070324bb115c9c23b08a (patch) | |
tree | 1a4e3278bc72fc189cfe8358ed21ad5269ce92c4 /core/java/android/hardware/input/InputManager.java | |
parent | 724cc1f04f117ee27583d015b414a5ba4540d3b1 (diff) | |
download | frameworks_base-d6396d67201fb2b64d13070324bb115c9c23b08a.zip frameworks_base-d6396d67201fb2b64d13070324bb115c9c23b08a.tar.gz frameworks_base-d6396d67201fb2b64d13070324bb115c9c23b08a.tar.bz2 |
Allow persistence of input device calibration
This patch extends the PersistentDataStore store to read and write
input device calibration data. A new SET_INPUT_CALIBRATION permission
grants apps the ability to update this information, and a new
TouchCalibration class is used to wrap the raw calibration data.
Change-Id: I4daac2b15ef03616ea5b068c1e77bebd0ce7b8c1
Diffstat (limited to 'core/java/android/hardware/input/InputManager.java')
-rw-r--r-- | core/java/android/hardware/input/InputManager.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index a2aeafb..ece5d82 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -500,6 +500,44 @@ public final class InputManager { } /** + * Gets the TouchCalibration applied to the specified input device's coordinates. + * + * @param inputDeviceDescriptor The input device descriptor. + * @return The TouchCalibration currently assigned for use with the given + * input device. If none is set, an identity TouchCalibration is returned. + * + * @hide + */ + public TouchCalibration getTouchCalibration(String inputDeviceDescriptor) { + try { + return mIm.getTouchCalibrationForInputDevice(inputDeviceDescriptor); + } catch (RemoteException ex) { + Log.w(TAG, "Could not get calibration matrix for input device.", ex); + return TouchCalibration.IDENTITY; + } + } + + /** + * Sets the TouchCalibration to apply to the specified input device's coordinates. + * <p> + * This method may have the side-effect of causing the input device in question + * to be reconfigured. Requires {@link android.Manifest.permissions.SET_INPUT_CALIBRATION}. + * </p> + * + * @param inputDeviceDescriptor The input device descriptor. + * @param calibration The calibration to be applied + * + * @hide + */ + public void setTouchCalibration(String inputDeviceDescriptor, TouchCalibration calibration) { + try { + mIm.setTouchCalibrationForInputDevice(inputDeviceDescriptor, calibration); + } catch (RemoteException ex) { + Log.w(TAG, "Could not set calibration matrix for input device.", ex); + } + } + + /** * Gets the mouse pointer speed. * <p> * Only returns the permanent mouse pointer speed. Ignores any temporary pointer |