Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -1737,6 +1737,14 @@ public final class Settings { */ public static final String POINTER_LOCATION = "pointer_location"; /** * Show touch positions on screen? * 0 = no * 1 = yes * @hide */ public static final String SHOW_TOUCHES = "show_touches"; /** * Log raw orientation data from {@link WindowOrientationListener} for use with the * orientationplot.py tool. Loading services/input/InputReader.cpp +24 −11 Original line number Diff line number Diff line Loading @@ -2491,7 +2491,8 @@ void TouchInputMapper::configure(nsecs_t when, bool resetNeeded = false; if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT))) { | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT | InputReaderConfiguration::CHANGE_SHOW_TOUCHES))) { // Configure device sources, surface dimensions, orientation and // scaling factors. configureSurface(when, &resetNeeded); Loading Loading @@ -2681,8 +2682,12 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) { bool deviceModeChanged; if (mDeviceMode != oldDeviceMode) { deviceModeChanged = true; mOrientedRanges.clear(); } if (mDeviceMode == DEVICE_MODE_POINTER) { // Create pointer controller if needed. if (mDeviceMode == DEVICE_MODE_POINTER || (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches)) { if (mPointerController == NULL) { mPointerController = getPolicy()->obtainPointerController(getDeviceId()); } Loading @@ -2690,9 +2695,6 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) { mPointerController.clear(); } mOrientedRanges.clear(); } bool orientationChanged = mSurfaceOrientation != orientation; if (orientationChanged) { mSurfaceOrientation = orientation; Loading Loading @@ -3380,7 +3382,7 @@ void TouchInputMapper::sync(nsecs_t when) { cookPointerData(); // Dispatch the touches either directly or by translation through a pointer on screen. if (mPointerController != NULL) { if (mDeviceMode == DEVICE_MODE_POINTER) { for (BitSet32 idBits(mCurrentRawPointerData.touchingIdBits); !idBits.isEmpty(); ) { uint32_t id = idBits.clearFirstMarkedBit(); const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id); Loading Loading @@ -3418,6 +3420,17 @@ void TouchInputMapper::sync(nsecs_t when) { dispatchPointerUsage(when, policyFlags, pointerUsage); } else { if (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches && mPointerController != NULL) { mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT); mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); mPointerController->setButtonState(mCurrentButtonState); mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords, mCurrentCookedPointerData.idToIndex, mCurrentCookedPointerData.touchingIdBits); } dispatchHoverExit(when, policyFlags); dispatchTouches(when, policyFlags); dispatchHoverEnterAndMove(when, policyFlags); Loading @@ -3442,7 +3455,7 @@ void TouchInputMapper::sync(nsecs_t when) { } void TouchInputMapper::timeoutExpired(nsecs_t when) { if (mPointerController != NULL) { if (mDeviceMode == DEVICE_MODE_POINTER) { if (mPointerUsage == POINTER_USAGE_GESTURES) { dispatchPointerGestures(when, 0 /*policyFlags*/, true /*isTimeout*/); } Loading services/input/InputReader.h +8 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,9 @@ struct InputReaderConfiguration { // The display size or orientation changed. CHANGE_DISPLAY_INFO = 1 << 2, // The visible touches option changed. CHANGE_SHOW_TOUCHES = 1 << 3, // All devices must be reopened. CHANGE_MUST_REOPEN = 1 << 31, }; Loading Loading @@ -140,6 +143,9 @@ struct InputReaderConfiguration { // will cover this portion of the display diagonal. float pointerGestureZoomSpeedRatio; // True to show the location of touches on the touch screen as spots. bool showTouches; InputReaderConfiguration() : virtualKeyQuietTime(0), pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f), Loading @@ -155,7 +161,8 @@ struct InputReaderConfiguration { pointerGestureSwipeTransitionAngleCosine(0.2588f), // cosine of 75 degrees pointerGestureSwipeMaxWidthRatio(0.25f), pointerGestureMovementSpeedRatio(0.8f), pointerGestureZoomSpeedRatio(0.3f) { } pointerGestureZoomSpeedRatio(0.3f), showTouches(false) { } bool getDisplayInfo(int32_t displayId, bool external, int32_t* width, int32_t* height, int32_t* orientation) const; Loading services/java/com/android/server/wm/InputManager.java +30 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ public class InputManager implements Watchdog.Monitor { private static native boolean nativeTransferTouchFocus(InputChannel fromChannel, InputChannel toChannel); private static native void nativeSetPointerSpeed(int speed); private static native void nativeSetShowTouches(boolean enabled); private static native String nativeDump(); private static native void nativeMonitor(); Loading Loading @@ -147,7 +148,10 @@ public class InputManager implements Watchdog.Monitor { nativeStart(); registerPointerSpeedSettingObserver(); registerShowTouchesSettingObserver(); updatePointerSpeedFromSettings(); updateShowTouchesFromSettings(); } public void setDisplaySize(int displayId, int width, int height, Loading Loading @@ -454,6 +458,32 @@ public class InputManager implements Watchdog.Monitor { return speed; } public void updateShowTouchesFromSettings() { int setting = getShowTouchesSetting(0); nativeSetShowTouches(setting != 0); } private void registerShowTouchesSettingObserver() { mContext.getContentResolver().registerContentObserver( Settings.System.getUriFor(Settings.System.SHOW_TOUCHES), true, new ContentObserver(mWindowManagerService.mH) { @Override public void onChange(boolean selfChange) { updateShowTouchesFromSettings(); } }); } private int getShowTouchesSetting(int defaultValue) { int result = defaultValue; try { result = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SHOW_TOUCHES); } catch (SettingNotFoundException snfe) { } return result; } public void dump(PrintWriter pw) { String dumpStr = nativeDump(); if (dumpStr != null) { Loading services/jni/com_android_server_InputManager.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -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 --- */ Loading Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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*/, Loading Loading @@ -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(); } Loading Loading @@ -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; Loading Loading @@ -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", Loading Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -1737,6 +1737,14 @@ public final class Settings { */ public static final String POINTER_LOCATION = "pointer_location"; /** * Show touch positions on screen? * 0 = no * 1 = yes * @hide */ public static final String SHOW_TOUCHES = "show_touches"; /** * Log raw orientation data from {@link WindowOrientationListener} for use with the * orientationplot.py tool. Loading
services/input/InputReader.cpp +24 −11 Original line number Diff line number Diff line Loading @@ -2491,7 +2491,8 @@ void TouchInputMapper::configure(nsecs_t when, bool resetNeeded = false; if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT))) { | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT | InputReaderConfiguration::CHANGE_SHOW_TOUCHES))) { // Configure device sources, surface dimensions, orientation and // scaling factors. configureSurface(when, &resetNeeded); Loading Loading @@ -2681,8 +2682,12 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) { bool deviceModeChanged; if (mDeviceMode != oldDeviceMode) { deviceModeChanged = true; mOrientedRanges.clear(); } if (mDeviceMode == DEVICE_MODE_POINTER) { // Create pointer controller if needed. if (mDeviceMode == DEVICE_MODE_POINTER || (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches)) { if (mPointerController == NULL) { mPointerController = getPolicy()->obtainPointerController(getDeviceId()); } Loading @@ -2690,9 +2695,6 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) { mPointerController.clear(); } mOrientedRanges.clear(); } bool orientationChanged = mSurfaceOrientation != orientation; if (orientationChanged) { mSurfaceOrientation = orientation; Loading Loading @@ -3380,7 +3382,7 @@ void TouchInputMapper::sync(nsecs_t when) { cookPointerData(); // Dispatch the touches either directly or by translation through a pointer on screen. if (mPointerController != NULL) { if (mDeviceMode == DEVICE_MODE_POINTER) { for (BitSet32 idBits(mCurrentRawPointerData.touchingIdBits); !idBits.isEmpty(); ) { uint32_t id = idBits.clearFirstMarkedBit(); const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id); Loading Loading @@ -3418,6 +3420,17 @@ void TouchInputMapper::sync(nsecs_t when) { dispatchPointerUsage(when, policyFlags, pointerUsage); } else { if (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches && mPointerController != NULL) { mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT); mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); mPointerController->setButtonState(mCurrentButtonState); mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords, mCurrentCookedPointerData.idToIndex, mCurrentCookedPointerData.touchingIdBits); } dispatchHoverExit(when, policyFlags); dispatchTouches(when, policyFlags); dispatchHoverEnterAndMove(when, policyFlags); Loading @@ -3442,7 +3455,7 @@ void TouchInputMapper::sync(nsecs_t when) { } void TouchInputMapper::timeoutExpired(nsecs_t when) { if (mPointerController != NULL) { if (mDeviceMode == DEVICE_MODE_POINTER) { if (mPointerUsage == POINTER_USAGE_GESTURES) { dispatchPointerGestures(when, 0 /*policyFlags*/, true /*isTimeout*/); } Loading
services/input/InputReader.h +8 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,9 @@ struct InputReaderConfiguration { // The display size or orientation changed. CHANGE_DISPLAY_INFO = 1 << 2, // The visible touches option changed. CHANGE_SHOW_TOUCHES = 1 << 3, // All devices must be reopened. CHANGE_MUST_REOPEN = 1 << 31, }; Loading Loading @@ -140,6 +143,9 @@ struct InputReaderConfiguration { // will cover this portion of the display diagonal. float pointerGestureZoomSpeedRatio; // True to show the location of touches on the touch screen as spots. bool showTouches; InputReaderConfiguration() : virtualKeyQuietTime(0), pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f), Loading @@ -155,7 +161,8 @@ struct InputReaderConfiguration { pointerGestureSwipeTransitionAngleCosine(0.2588f), // cosine of 75 degrees pointerGestureSwipeMaxWidthRatio(0.25f), pointerGestureMovementSpeedRatio(0.8f), pointerGestureZoomSpeedRatio(0.3f) { } pointerGestureZoomSpeedRatio(0.3f), showTouches(false) { } bool getDisplayInfo(int32_t displayId, bool external, int32_t* width, int32_t* height, int32_t* orientation) const; Loading
services/java/com/android/server/wm/InputManager.java +30 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ public class InputManager implements Watchdog.Monitor { private static native boolean nativeTransferTouchFocus(InputChannel fromChannel, InputChannel toChannel); private static native void nativeSetPointerSpeed(int speed); private static native void nativeSetShowTouches(boolean enabled); private static native String nativeDump(); private static native void nativeMonitor(); Loading Loading @@ -147,7 +148,10 @@ public class InputManager implements Watchdog.Monitor { nativeStart(); registerPointerSpeedSettingObserver(); registerShowTouchesSettingObserver(); updatePointerSpeedFromSettings(); updateShowTouchesFromSettings(); } public void setDisplaySize(int displayId, int width, int height, Loading Loading @@ -454,6 +458,32 @@ public class InputManager implements Watchdog.Monitor { return speed; } public void updateShowTouchesFromSettings() { int setting = getShowTouchesSetting(0); nativeSetShowTouches(setting != 0); } private void registerShowTouchesSettingObserver() { mContext.getContentResolver().registerContentObserver( Settings.System.getUriFor(Settings.System.SHOW_TOUCHES), true, new ContentObserver(mWindowManagerService.mH) { @Override public void onChange(boolean selfChange) { updateShowTouchesFromSettings(); } }); } private int getShowTouchesSetting(int defaultValue) { int result = defaultValue; try { result = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SHOW_TOUCHES); } catch (SettingNotFoundException snfe) { } return result; } public void dump(PrintWriter pw) { String dumpStr = nativeDump(); if (dumpStr != null) { Loading
services/jni/com_android_server_InputManager.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -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 --- */ Loading Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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*/, Loading Loading @@ -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(); } Loading Loading @@ -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; Loading Loading @@ -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", Loading