Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4203947e authored by Harry Cutts's avatar Harry Cutts Committed by Android (Google) Code Review
Browse files

Merge "InputManagerService: remove old touchpad stack configuration" into main

parents 010b40c1 ce836776
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -840,16 +840,6 @@ public class ViewConfiguration {
        return mDoubleTapMinTimeMillis;
    }

    /**
     * @return the maximum duration in milliseconds between a touch pad
     * touch and release for a given touch to be considered a tap (click) as
     * opposed to a hover movement gesture.
     * @hide
     */
    public static int getHoverTapTimeout() {
        return sResourceCache.getHoverTapTimeout();
    }

    /**
     * @return the maximum distance in pixels that a touch pad touch can move
     * before being released for it to be considered a tap (click) as opposed
@@ -1618,16 +1608,6 @@ public class ViewConfiguration {
            return mDoubleTapMinTime;
        }

        public int getHoverTapTimeout() {
            if (mHoverTapTimeout < 0) {
                Resources resources = getCurrentResources();
                mHoverTapTimeout = resources != null
                        ? resources.getInteger(R.integer.config_hoverTapTimeoutMillis)
                        : HOVER_TAP_TIMEOUT;
            }
            return mHoverTapTimeout;
        }

        public int getHoverTapSlop() {
            if (mHoverTapSlop < 0) {
                Resources resources = getCurrentResources();
+0 −4
Original line number Diff line number Diff line
@@ -3152,10 +3152,6 @@
         down event for an interaction to be considered a double-tap. -->
    <integer name="config_doubleTapMinTimeMillis">40</integer>

    <!-- Maximum duration in milliseconds between a touch pad touch and release for a given touch
         to be considered a tap (click) as opposed to a hover movement gesture. -->
    <integer name="config_hoverTapTimeoutMillis">150</integer>

    <!-- The amount of time in milliseconds that the zoom controls should be displayed on the
         screen. -->
    <integer name="config_zoomControlsTimeoutMillis">3000</integer>
+0 −1
Original line number Diff line number Diff line
@@ -4194,7 +4194,6 @@
  <java-symbol type="integer" name="config_jumpTapTimeoutMillis" />
  <java-symbol type="integer" name="config_doubleTapTimeoutMillis" />
  <java-symbol type="integer" name="config_doubleTapMinTimeMillis" />
  <java-symbol type="integer" name="config_hoverTapTimeoutMillis" />
  <java-symbol type="integer" name="config_zoomControlsTimeoutMillis" />
  <java-symbol type="integer" name="config_defaultActionModeHideDurationMillis" />
  <java-symbol type="dimen" name="config_hoverTapSlop" />
+0 −25
Original line number Diff line number Diff line
@@ -121,7 +121,6 @@ import android.view.PointerIcon;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.VerifiedInputEvent;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.view.WindowManagerPolicyConstants;
import android.view.inputmethod.InputMethodInfo;
@@ -2973,30 +2972,6 @@ public class InputManagerService extends IInputManager.Stub
        return mNative.canDispatchToDisplay(deviceId, displayId);
    }

    // Native callback.
    @SuppressWarnings("unused")
    private int getHoverTapTimeout() {
        return ViewConfiguration.getHoverTapTimeout();
    }

    // Native callback.
    @SuppressWarnings("unused")
    private int getHoverTapSlop() {
        return ViewConfiguration.getHoverTapSlop();
    }

    // Native callback.
    @SuppressWarnings("unused")
    private int getDoubleTapTimeout() {
        return ViewConfiguration.getDoubleTapTimeout();
    }

    // Native callback.
    @SuppressWarnings("unused")
    private int getLongPressTimeout() {
        return ViewConfiguration.getLongPressTimeout();
    }

    // Native callback.
    @SuppressWarnings("unused")
    private int getPointerLayer() {
+0 −50
Original line number Diff line number Diff line
@@ -138,10 +138,6 @@ static struct {
    jmethodID getInputUniqueIdAssociationsByDescriptor;
    jmethodID getDeviceTypeAssociations;
    jmethodID getKeyboardLayoutAssociations;
    jmethodID getHoverTapTimeout;
    jmethodID getHoverTapSlop;
    jmethodID getDoubleTapTimeout;
    jmethodID getLongPressTimeout;
    jmethodID getPointerLayer;
    jmethodID getLoadedPointerIcon;
    jmethodID getKeyboardLayoutOverlay;
@@ -776,45 +772,11 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon
                                                              std::move(layoutType));
                                });

    jint hoverTapTimeout = env->CallIntMethod(mServiceObj,
            gServiceClassInfo.getHoverTapTimeout);
    if (!checkAndClearExceptionFromCallback(env, "getHoverTapTimeout")) {
        jint doubleTapTimeout = env->CallIntMethod(mServiceObj,
                gServiceClassInfo.getDoubleTapTimeout);
        if (!checkAndClearExceptionFromCallback(env, "getDoubleTapTimeout")) {
            jint longPressTimeout = env->CallIntMethod(mServiceObj,
                    gServiceClassInfo.getLongPressTimeout);
            if (!checkAndClearExceptionFromCallback(env, "getLongPressTimeout")) {
                outConfig->pointerGestureTapInterval = milliseconds_to_nanoseconds(hoverTapTimeout);

                // We must ensure that the tap-drag interval is significantly shorter than
                // the long-press timeout because the tap is held down for the entire duration
                // of the double-tap timeout.
                jint tapDragInterval = max(min(longPressTimeout - 100,
                        doubleTapTimeout), hoverTapTimeout);
                outConfig->pointerGestureTapDragInterval =
                        milliseconds_to_nanoseconds(tapDragInterval);
            }
        }
    }

    jint hoverTapSlop = env->CallIntMethod(mServiceObj,
            gServiceClassInfo.getHoverTapSlop);
    if (!checkAndClearExceptionFromCallback(env, "getHoverTapSlop")) {
        outConfig->pointerGestureTapSlop = hoverTapSlop;
    }

    { // acquire lock
        std::scoped_lock _l(mLock);

        outConfig->mousePointerSpeed = mLocked.pointerSpeed;
        outConfig->displaysWithMouseScalingDisabled = mLocked.displaysWithMouseScalingDisabled;
        outConfig->pointerVelocityControlParameters.scale =
                exp2f(mLocked.pointerSpeed * POINTER_SPEED_EXPONENT);
        outConfig->pointerVelocityControlParameters.acceleration =
                mLocked.displaysWithMouseScalingDisabled.count(mLocked.pointerDisplayId) == 0
                ? android::os::IInputConstants::DEFAULT_POINTER_ACCELERATION
                : 1;
        outConfig->wheelVelocityControlParameters.acceleration =
                mLocked.mouseScrollingAccelerationEnabled
                ? android::os::IInputConstants::DEFAULT_MOUSE_WHEEL_ACCELERATION
@@ -3570,18 +3532,6 @@ int register_android_server_InputManager(JNIEnv* env) {
    GET_METHOD_ID(gServiceClassInfo.getKeyboardLayoutAssociations, clazz,
                  "getKeyboardLayoutAssociations", "()[Ljava/lang/String;");

    GET_METHOD_ID(gServiceClassInfo.getHoverTapTimeout, clazz,
            "getHoverTapTimeout", "()I");

    GET_METHOD_ID(gServiceClassInfo.getHoverTapSlop, clazz,
            "getHoverTapSlop", "()I");

    GET_METHOD_ID(gServiceClassInfo.getDoubleTapTimeout, clazz,
            "getDoubleTapTimeout", "()I");

    GET_METHOD_ID(gServiceClassInfo.getLongPressTimeout, clazz,
            "getLongPressTimeout", "()I");

    GET_METHOD_ID(gServiceClassInfo.getPointerLayer, clazz,
            "getPointerLayer", "()I");