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

Commit 06a8068e authored by Michael Checo's avatar Michael Checo Committed by Android (Google) Code Review
Browse files

Merge "InputSettings: Add touchpad acceleration setting" into main

parents 98842b5a 4b7b5322
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -384,6 +384,42 @@ public class InputSettings {
                UserHandle.USER_CURRENT);
    }

    /**
     * Whether touchpad acceleration is enabled or not.
     *
     * @param context The application context.
     *
     * @hide
     */
    public static boolean isTouchpadAccelerationEnabled(@NonNull Context context) {
        if (!isPointerAccelerationFeatureFlagEnabled()) {
            return false;
        }

        return Settings.System.getIntForUser(context.getContentResolver(),
                Settings.System.TOUCHPAD_ACCELERATION_ENABLED, 1, UserHandle.USER_CURRENT)
                == 1;
    }

   /**
    * Enables or disables touchpad acceleration.
    *
    * @param context The application context.
    * @param enabled Will enable touchpad acceleration if true, disable it if
    *                false.
    * @hide
    */
    @RequiresPermission(Manifest.permission.WRITE_SETTINGS)
    public static void setTouchpadAccelerationEnabled(@NonNull Context context,
            boolean enabled) {
        if (!isPointerAccelerationFeatureFlagEnabled()) {
            return;
        }
        Settings.System.putIntForUser(context.getContentResolver(),
                Settings.System.TOUCHPAD_ACCELERATION_ENABLED, enabled ? 1 : 0,
                UserHandle.USER_CURRENT);
    }

    /**
     * Returns true if the feature flag for disabling system gestures on touchpads is enabled.
     *
@@ -835,7 +871,6 @@ public class InputSettings {
                UserHandle.USER_CURRENT);
    }


    /**
     * Whether Accessibility bounce keys feature is enabled.
     *
+12 −0
Original line number Diff line number Diff line
@@ -6329,6 +6329,17 @@ public final class Settings {
         */
        public static final String TOUCHPAD_SYSTEM_GESTURES = "touchpad_system_gestures";
        /**
         * Whether touchpad acceleration is enabled.
         *
         * When enabled, the speed of the pointer will increase as the user moves their
         * finger faster on the touchpad.
         *
         * @hide
         */
        public static final String TOUCHPAD_ACCELERATION_ENABLED =
                "touchpad_acceleration_enabled";
        /**
         * Whether to enable reversed vertical scrolling for connected mice.
         *
@@ -6624,6 +6635,7 @@ public final class Settings {
            PRIVATE_SETTINGS.add(TOUCHPAD_TAP_DRAGGING);
            PRIVATE_SETTINGS.add(TOUCHPAD_RIGHT_CLICK_ZONE);
            PRIVATE_SETTINGS.add(TOUCHPAD_SYSTEM_GESTURES);
            PRIVATE_SETTINGS.add(TOUCHPAD_ACCELERATION_ENABLED);
            PRIVATE_SETTINGS.add(CAMERA_FLASH_NOTIFICATION);
            PRIVATE_SETTINGS.add(SCREEN_FLASH_NOTIFICATION);
            PRIVATE_SETTINGS.add(SCREEN_FLASH_NOTIFICATION_COLOR);
+2 −1
Original line number Diff line number Diff line
@@ -218,7 +218,8 @@ message SystemSettingsProto {
        optional SettingProto tap_to_click = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto tap_dragging = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto three_finger_tap_customization = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto system_gestures = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];;
        optional SettingProto system_gestures = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto acceleration_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];;
    }
    optional Touchpad touchpad = 36;

+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ public class SystemSettings {
                Settings.System.TOUCHPAD_TAP_TO_CLICK,
                Settings.System.TOUCHPAD_TAP_DRAGGING,
                Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE,
                Settings.System.TOUCHPAD_ACCELERATION_ENABLED,
                Settings.System.CAMERA_FLASH_NOTIFICATION,
                Settings.System.SCREEN_FLASH_NOTIFICATION,
                Settings.System.SCREEN_FLASH_NOTIFICATION_COLOR,
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ public class SystemSettingsValidators {
        VALIDATORS.put(System.TOUCHPAD_TAP_DRAGGING, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.TOUCHPAD_RIGHT_CLICK_ZONE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.TOUCHPAD_SYSTEM_GESTURES, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.TOUCHPAD_ACCELERATION_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.LOCK_TO_APP_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(
                System.EGG_MODE,
Loading