diff options
Diffstat (limited to 'services/jni/com_android_server_input_InputManagerService.cpp')
-rw-r--r-- | services/jni/com_android_server_input_InputManagerService.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp index 55a8061..6d98907 100644 --- a/services/jni/com_android_server_input_InputManagerService.cpp +++ b/services/jni/com_android_server_input_InputManagerService.cpp @@ -177,6 +177,7 @@ public: void setPointerSpeed(int32_t speed); void setShowTouches(bool enabled); void setStylusIconEnabled(bool enabled); + void setVolumeKeysRotation(int mode); /* --- InputReaderPolicyInterface implementation --- */ @@ -240,6 +241,9 @@ private: // Show icon when stylus is used bool stylusIconEnabled; + // Volume keys rotation mode (0 - off, 1 - phone, 2 - tablet) + int32_t volumeKeysRotationMode; + // Sprite controller singleton, created on first use. sp<SpriteController> spriteController; @@ -279,6 +283,7 @@ NativeInputManager::NativeInputManager(jobject contextObj, mLocked.pointerGesturesEnabled = true; mLocked.showTouches = false; mLocked.stylusIconEnabled = false; + mLocked.volumeKeysRotationMode = 0; } sp<EventHub> eventHub = new EventHub(); @@ -412,6 +417,7 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon outConfig->showTouches = mLocked.showTouches; outConfig->stylusIconEnabled = mLocked.stylusIconEnabled; + outConfig->volumeKeysRotationMode = mLocked.volumeKeysRotationMode; outConfig->setDisplayInfo(false /*external*/, mLocked.internalViewport); outConfig->setDisplayInfo(true /*external*/, mLocked.externalViewport); @@ -752,6 +758,22 @@ void NativeInputManager::setStylusIconEnabled(bool enabled) { InputReaderConfiguration::CHANGE_STYLUS_ICON_ENABLED); } +void NativeInputManager::setVolumeKeysRotation(int mode) { + { // acquire lock + AutoMutex _l(mLock); + + if (mLocked.volumeKeysRotationMode == mode) { + return; + } + + ALOGI("Volume keys: rotation mode set to %d.", mode); + mLocked.volumeKeysRotationMode = mode; + } // release lock + + mInputManager->getReader()->requestRefreshConfiguration( + InputReaderConfiguration::CHANGE_VOLUME_KEYS_ROTATION); +} + bool NativeInputManager::isScreenOn() { return android_server_PowerManagerService_isScreenOn(); } @@ -1250,6 +1272,13 @@ static void nativeSetStylusIconEnabled(JNIEnv* env, im->setStylusIconEnabled(enabled); } +static void nativeSetVolumeKeysRotation(JNIEnv* env, + jclass clazz, jint ptr, int mode) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); + + im->setVolumeKeysRotation(mode); +} + static void nativeVibrate(JNIEnv* env, jclass clazz, jint ptr, jint deviceId, jlongArray patternObj, jint repeat, jint token) { @@ -1357,6 +1386,8 @@ static JNINativeMethod gInputManagerMethods[] = { (void*) nativeSetShowTouches }, { "nativeSetStylusIconEnabled", "(IZ)V", (void*) nativeSetStylusIconEnabled }, + { "nativeSetVolumeKeysRotation", "(II)V", + (void*) nativeSetVolumeKeysRotation }, { "nativeVibrate", "(II[JII)V", (void*) nativeVibrate }, { "nativeCancelVibrate", "(III)V", |