summaryrefslogtreecommitdiffstats
path: root/services/input
diff options
context:
space:
mode:
Diffstat (limited to 'services/input')
-rw-r--r--services/input/InputReader.cpp28
-rw-r--r--services/input/InputReader.h5
-rw-r--r--services/input/tests/InputReader_test.cpp2
3 files changed, 25 insertions, 10 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 9d69c60..db312ad 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1505,7 +1505,10 @@ void KeyboardInputMapper::configureParameters() {
getDevice()->getConfiguration().tryGetProperty(String8("keyboard.orientationAware"),
mParameters.orientationAware);
- mParameters.associatedDisplayId = mParameters.orientationAware ? 0 : -1;
+ mParameters.associatedDisplayId = -1;
+ if (mParameters.orientationAware) {
+ mParameters.associatedDisplayId = 0;
+ }
}
void KeyboardInputMapper::dumpParameters(String8& dump) {
@@ -1577,7 +1580,7 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
if (mParameters.orientationAware && mParameters.associatedDisplayId >= 0) {
int32_t orientation;
if (!getPolicy()->getDisplayInfo(mParameters.associatedDisplayId,
- NULL, NULL, & orientation)) {
+ false /*external*/, NULL, NULL, & orientation)) {
orientation = DISPLAY_ORIENTATION_0;
}
@@ -1830,8 +1833,10 @@ void CursorInputMapper::configureParameters() {
getDevice()->getConfiguration().tryGetProperty(String8("cursor.orientationAware"),
mParameters.orientationAware);
- mParameters.associatedDisplayId = mParameters.mode == Parameters::MODE_POINTER
- || mParameters.orientationAware ? 0 : -1;
+ mParameters.associatedDisplayId = -1;
+ if (mParameters.mode == Parameters::MODE_POINTER || mParameters.orientationAware) {
+ mParameters.associatedDisplayId = 0;
+ }
}
void CursorInputMapper::dumpParameters(String8& dump) {
@@ -1943,7 +1948,7 @@ void CursorInputMapper::sync(nsecs_t when) {
// Note: getDisplayInfo is non-reentrant so we can continue holding the lock.
int32_t orientation;
if (! getPolicy()->getDisplayInfo(mParameters.associatedDisplayId,
- NULL, NULL, & orientation)) {
+ false /*external*/, NULL, NULL, & orientation)) {
orientation = DISPLAY_ORIENTATION_0;
}
@@ -2308,10 +2313,16 @@ void TouchInputMapper::configureParameters() {
getDevice()->getConfiguration().tryGetProperty(String8("touch.orientationAware"),
mParameters.orientationAware);
- mParameters.associatedDisplayId = mParameters.orientationAware
+ mParameters.associatedDisplayId = -1;
+ mParameters.associatedDisplayIsExternal = false;
+ if (mParameters.orientationAware
|| mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
- || mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER
- ? 0 : -1;
+ || mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
+ mParameters.associatedDisplayIsExternal =
+ mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
+ && getDevice()->isExternal();
+ mParameters.associatedDisplayId = 0;
+ }
}
void TouchInputMapper::dumpParameters(String8& dump) {
@@ -2393,6 +2404,7 @@ bool TouchInputMapper::configureSurfaceLocked() {
if (mParameters.associatedDisplayId >= 0) {
// Note: getDisplayInfo is non-reentrant so we can continue holding the lock.
if (! getPolicy()->getDisplayInfo(mParameters.associatedDisplayId,
+ mParameters.associatedDisplayIsExternal,
&mLocked.associatedDisplayWidth, &mLocked.associatedDisplayHeight,
&mLocked.associatedDisplayOrientation)) {
return false;
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index f9750d0..ee6990b 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -180,9 +180,11 @@ public:
};
/* Gets information about the display with the specified id.
+ * If external is true, returns the size of the external mirrored
+ * counterpart of the specified display.
* Returns true if the display info is available, false otherwise.
*/
- virtual bool getDisplayInfo(int32_t displayId,
+ virtual bool getDisplayInfo(int32_t displayId, bool external,
int32_t* width, int32_t* height, int32_t* orientation) = 0;
/* Gets the input reader configuration. */
@@ -944,6 +946,7 @@ protected:
DeviceType deviceType;
int32_t associatedDisplayId;
+ bool associatedDisplayIsExternal;
bool orientationAware;
enum GestureMode {
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index 7a6af25..8533743 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -157,7 +157,7 @@ public:
}
private:
- virtual bool getDisplayInfo(int32_t displayId,
+ virtual bool getDisplayInfo(int32_t displayId, bool external /*currently ignored*/,
int32_t* width, int32_t* height, int32_t* orientation) {
ssize_t index = mDisplayInfos.indexOfKey(displayId);
if (index >= 0) {