From 22a4d65f66a6155a60d77a22922c195fb22a1bd6 Mon Sep 17 00:00:00 2001 From: nadlabak Date: Mon, 13 May 2013 17:41:57 +0200 Subject: Re-implement orientation aware volume buttons at lower level Rework of http://review.cyanogenmod.org/31979 Fixes: 1. inconsistent volume button behaviour depending on app in use - the buttons were not swapped for some NDK/OPENSL ES apps like e.g. MX Player 2. the function of volume buttons on external input devices like BT/USB keyboards should not be affected by the main unit orientation This commit finishes http://review.cyanogenmod.org/18273 - use of system property has been replaced with config push via JNI as suggested during the original review. Patch Set 7: Circumvent the need for "keyboard.orientationAware = 1" idc Patch Set 8: Don't leak implementation details outside InputReader Change-Id: I19cc60cb0acb0005ab13fa069f52e3d468d694e7 --- services/input/InputReader.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'services/input/InputReader.h') diff --git a/services/input/InputReader.h b/services/input/InputReader.h index ab452c8..dc786a6 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -140,6 +140,9 @@ struct InputReaderConfiguration { // Stylus icon option changed. CHANGE_STYLUS_ICON_ENABLED = 1 << 6, + // Volume keys rotation option changed. + CHANGE_VOLUME_KEYS_ROTATION = 1 << 7, + // All devices must be reopened. CHANGE_MUST_REOPEN = 1 << 31, }; @@ -230,6 +233,10 @@ struct InputReaderConfiguration { // True to show the pointer icon when a stylus is used. bool stylusIconEnabled; + // Remap volume keys according to display rotation + // 0 - disabled, 1 - phone or hybrid rotation mode, 2 - tablet rotation mode + int volumeKeysRotationMode; + // Ignore finger touches this long after the stylus has been used (including hover) nsecs_t stylusPalmRejectionTime; @@ -249,9 +256,10 @@ struct InputReaderConfiguration { pointerGestureSwipeMaxWidthRatio(0.25f), pointerGestureMovementSpeedRatio(0.8f), pointerGestureZoomSpeedRatio(0.3f), - showTouches(false), + showTouches(false), stylusIconEnabled(false), - stylusPalmRejectionTime(50 * 10000000LL) // 50 ms + stylusPalmRejectionTime(50 * 10000000LL), // 50 ms + volumeKeysRotationMode(0) { } bool getDisplayInfo(bool external, DisplayViewport* outViewport) const; @@ -1039,7 +1047,8 @@ private: uint32_t mSource; int32_t mKeyboardType; - int32_t mOrientation; // orientation for dpad keys + int32_t mRotationMapOffset; // determines if and how volume keys rotate + int32_t mOrientation; // orientation for dpad and volume keys Vector mKeyDowns; // keys that are down int32_t mMetaState; -- cgit v1.1