Merge "Notify dispatcher when its configuration needs to be updated" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cb0109edcb
@@ -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);
|
||||
|
||||
@@ -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. */
|
||||
@@ -451,9 +459,6 @@ interface NativeInputManagerService {
|
||||
@Override
|
||||
public native void changeKeyboardLayoutAssociation();
|
||||
|
||||
@Override
|
||||
public native void notifyPointerDisplayIdChanged();
|
||||
|
||||
@Override
|
||||
public native void setDisplayEligibilityForPointerCapture(int displayId, boolean enabled);
|
||||
|
||||
@@ -493,5 +498,8 @@ interface NativeInputManagerService {
|
||||
|
||||
@Override
|
||||
public native void sysfsNodeChanged(String sysfsNodePath);
|
||||
|
||||
@Override
|
||||
public native void notifyKeyGestureTimeoutsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user