summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/input/InputSettingsObserver.java49
-rw-r--r--services/core/java/com/android/server/input/NativeInputManagerService.java18
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp6
3 files changed, 47 insertions, 26 deletions
diff --git a/services/core/java/com/android/server/input/InputSettingsObserver.java b/services/core/java/com/android/server/input/InputSettingsObserver.java
index 5b2166962d0d..153e9c174b85 100644
--- a/services/core/java/com/android/server/input/InputSettingsObserver.java
+++ b/services/core/java/com/android/server/input/InputSettingsObserver.java
@@ -52,25 +52,27 @@ class InputSettingsObserver extends ContentObserver {
mHandler = handler;
mNative = nativeIms;
mObservers = Map.ofEntries(
- Map.entry(Settings.System.getUriFor(Settings.System.POINTER_SPEED),
- (reason) -> updateMousePointerSpeed()),
- Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_POINTER_SPEED),
- (reason) -> updateTouchpadPointerSpeed()),
- Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_NATURAL_SCROLLING),
- (reason) -> updateTouchpadNaturalScrollingEnabled()),
- Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_TAP_TO_CLICK),
- (reason) -> updateTouchpadTapToClickEnabled()),
- Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE),
- (reason) -> updateTouchpadRightClickZoneEnabled()),
- Map.entry(Settings.System.getUriFor(Settings.System.SHOW_TOUCHES),
- (reason) -> updateShowTouches()),
- Map.entry(Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON),
- (reason) -> updateAccessibilityLargePointer()),
- Map.entry(Settings.Secure.getUriFor(Settings.Secure.LONG_PRESS_TIMEOUT),
- (reason) -> updateDeepPressStatus(reason)),
- Map.entry(
- Settings.Global.getUriFor(Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH),
- (reason) -> updateMaximumObscuringOpacityForTouch()));
+ Map.entry(Settings.System.getUriFor(Settings.System.POINTER_SPEED),
+ (reason) -> updateMousePointerSpeed()),
+ Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_POINTER_SPEED),
+ (reason) -> updateTouchpadPointerSpeed()),
+ Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_NATURAL_SCROLLING),
+ (reason) -> updateTouchpadNaturalScrollingEnabled()),
+ Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_TAP_TO_CLICK),
+ (reason) -> updateTouchpadTapToClickEnabled()),
+ Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE),
+ (reason) -> updateTouchpadRightClickZoneEnabled()),
+ Map.entry(Settings.System.getUriFor(Settings.System.SHOW_TOUCHES),
+ (reason) -> updateShowTouches()),
+ Map.entry(
+ Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON),
+ (reason) -> updateAccessibilityLargePointer()),
+ Map.entry(Settings.Secure.getUriFor(Settings.Secure.LONG_PRESS_TIMEOUT),
+ (reason) -> updateLongPressTimeout(reason)),
+ Map.entry(
+ Settings.Global.getUriFor(
+ Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH),
+ (reason) -> updateMaximumObscuringOpacityForTouch()));
}
/**
@@ -151,8 +153,13 @@ class InputSettingsObserver extends ContentObserver {
mNative.reloadPointerIcons();
}
- private void updateDeepPressStatus(String reason) {
- // Not using ViewConfiguration.getLongPressTimeout here because it may return a stale value
+ private void updateLongPressTimeout(String reason) {
+ // Some key gesture timeouts are based on the long press timeout, so update key gesture
+ // timeouts when the value changes. See ViewConfiguration#getKeyRepeatTimeout().
+ mNative.notifyKeyGestureTimeoutsChanged();
+
+ // Update the deep press status.
+ // Not using ViewConfiguration.getLongPressTimeout here because it may return a stale value.
final int timeout = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.LONG_PRESS_TIMEOUT, ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT,
UserHandle.USER_CURRENT);
diff --git a/services/core/java/com/android/server/input/NativeInputManagerService.java b/services/core/java/com/android/server/input/NativeInputManagerService.java
index aeb2477f8890..363bc94b49bd 100644
--- a/services/core/java/com/android/server/input/NativeInputManagerService.java
+++ b/services/core/java/com/android/server/input/NativeInputManagerService.java
@@ -28,6 +28,7 @@ import android.view.InputChannel;
import android.view.InputEvent;
import android.view.PointerIcon;
import android.view.VerifiedInputEvent;
+import android.view.ViewConfiguration;
import java.util.List;
@@ -198,8 +199,6 @@ interface NativeInputManagerService {
void changeKeyboardLayoutAssociation();
- void notifyPointerDisplayIdChanged();
-
void setDisplayEligibilityForPointerCapture(int displayId, boolean enabled);
void setMotionClassifierEnabled(boolean enabled);
@@ -243,6 +242,15 @@ interface NativeInputManagerService {
*/
void sysfsNodeChanged(String sysfsNodePath);
+ /**
+ * Notify there is a change in any of the key gesture timeouts, such as the key
+ * repeat timeout or key repeat delay.
+ *
+ * @see ViewConfiguration#getKeyRepeatTimeout()
+ * @see ViewConfiguration#getKeyRepeatDelay()
+ */
+ void notifyKeyGestureTimeoutsChanged();
+
/** The native implementation of InputManagerService methods. */
class NativeImpl implements NativeInputManagerService {
/** Pointer to native input manager service object, used by native code. */
@@ -452,9 +460,6 @@ interface NativeInputManagerService {
public native void changeKeyboardLayoutAssociation();
@Override
- public native void notifyPointerDisplayIdChanged();
-
- @Override
public native void setDisplayEligibilityForPointerCapture(int displayId, boolean enabled);
@Override
@@ -493,5 +498,8 @@ interface NativeInputManagerService {
@Override
public native void sysfsNodeChanged(String sysfsNodePath);
+
+ @Override
+ public native void notifyKeyGestureTimeoutsChanged();
}
}
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index cf57b339cc22..369c97470245 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -2567,6 +2567,11 @@ static void nativeSetStylusPointerIconEnabled(JNIEnv* env, jobject nativeImplObj
im->setStylusPointerIconEnabled(enabled);
}
+static void nativeNotifyKeyGestureTimeoutsChanged(JNIEnv* env, jobject nativeImplObj) {
+ NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
+ im->getInputManager()->getDispatcher().requestRefreshConfiguration();
+}
+
// ----------------------------------------------------------------------------
static const JNINativeMethod gInputManagerMethods[] = {
@@ -2663,6 +2668,7 @@ static const JNINativeMethod gInputManagerMethods[] = {
(void*)nativeSetStylusButtonMotionEventsEnabled},
{"getMouseCursorPosition", "()[F", (void*)nativeGetMouseCursorPosition},
{"setStylusPointerIconEnabled", "(Z)V", (void*)nativeSetStylusPointerIconEnabled},
+ {"notifyKeyGestureTimeoutsChanged", "()V", (void*)nativeNotifyKeyGestureTimeoutsChanged},
};
#define FIND_CLASS(var, className) \