diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-08-26 17:14:14 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-08-26 17:14:14 -0700 |
commit | daf4a127ba2af82a3fb477044b872719a0ab1827 (patch) | |
tree | 2147e705a6b912683abd7169910acb548413d946 /services/jni | |
parent | 9b9783ad60d31f3df5d2524e13abc1437d5b6f7d (diff) | |
download | frameworks_base-daf4a127ba2af82a3fb477044b872719a0ab1827.zip frameworks_base-daf4a127ba2af82a3fb477044b872719a0ab1827.tar.gz frameworks_base-daf4a127ba2af82a3fb477044b872719a0ab1827.tar.bz2 |
Add a "show touches" option for demos and presentations.
Bug: 4569045
Change-Id: I8726ea292dd7def790a5e40d7d7e58968974f896
Diffstat (limited to 'services/jni')
-rw-r--r-- | services/jni/com_android_server_InputManager.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_InputManager.cpp index f2a0a71..0a723e8 100644 --- a/services/jni/com_android_server_InputManager.cpp +++ b/services/jni/com_android_server_InputManager.cpp @@ -179,6 +179,7 @@ public: void setInputDispatchMode(bool enabled, bool frozen); void setSystemUiVisibility(int32_t visibility); void setPointerSpeed(int32_t speed); + void setShowTouches(bool enabled); /* --- InputReaderPolicyInterface implementation --- */ @@ -233,6 +234,9 @@ private: // True if pointer gestures are enabled. bool pointerGesturesEnabled; + // Show touches feature enable/disable. + bool showTouches; + // Sprite controller singleton, created on first use. sp<SpriteController> spriteController; @@ -276,6 +280,7 @@ NativeInputManager::NativeInputManager(jobject contextObj, mLocked.systemUiVisibility = ASYSTEM_UI_VISIBILITY_STATUS_BAR_VISIBLE; mLocked.pointerSpeed = 0; mLocked.pointerGesturesEnabled = true; + mLocked.showTouches = false; } sp<EventHub> eventHub = new EventHub(); @@ -431,6 +436,8 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon * POINTER_SPEED_EXPONENT); outConfig->pointerGesturesEnabled = mLocked.pointerGesturesEnabled; + outConfig->showTouches = mLocked.showTouches; + outConfig->setDisplayInfo(0, false /*external*/, mLocked.displayWidth, mLocked.displayHeight, mLocked.displayOrientation); outConfig->setDisplayInfo(0, true /*external*/, @@ -678,6 +685,22 @@ void NativeInputManager::setPointerSpeed(int32_t speed) { InputReaderConfiguration::CHANGE_POINTER_SPEED); } +void NativeInputManager::setShowTouches(bool enabled) { + { // acquire lock + AutoMutex _l(mLock); + + if (mLocked.showTouches == enabled) { + return; + } + + LOGI("Setting show touches feature to %s.", enabled ? "enabled" : "disabled"); + mLocked.showTouches = enabled; + } // release lock + + mInputManager->getReader()->requestRefreshConfiguration( + InputReaderConfiguration::CHANGE_SHOW_TOUCHES); +} + bool NativeInputManager::isScreenOn() { return android_server_PowerManagerService_isScreenOn(); } @@ -1276,6 +1299,15 @@ static void android_server_InputManager_nativeSetPointerSpeed(JNIEnv* env, gNativeInputManager->setPointerSpeed(speed); } +static void android_server_InputManager_nativeSetShowTouches(JNIEnv* env, + jclass clazz, jboolean enabled) { + if (checkInputManagerUnitialized(env)) { + return; + } + + gNativeInputManager->setShowTouches(enabled); +} + static jstring android_server_InputManager_nativeDump(JNIEnv* env, jclass clazz) { if (checkInputManagerUnitialized(env)) { return NULL; @@ -1343,6 +1375,8 @@ static JNINativeMethod gInputManagerMethods[] = { (void*) android_server_InputManager_nativeTransferTouchFocus }, { "nativeSetPointerSpeed", "(I)V", (void*) android_server_InputManager_nativeSetPointerSpeed }, + { "nativeSetShowTouches", "(Z)V", + (void*) android_server_InputManager_nativeSetShowTouches }, { "nativeDump", "()Ljava/lang/String;", (void*) android_server_InputManager_nativeDump }, { "nativeMonitor", "()V", |