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

Commit 58638701 authored by Biswarup Pal's avatar Biswarup Pal
Browse files

Test API's for mouse pointer speed

- Add getMousePointerSpeed test API
- Expose InputSettings#DEFAULT_POINTER_SPEED as a test API
- Expose pointer speed settings key as a test API

Test: atest VirtualMouseTest
Bug: 322155662
Change-Id: Ie14a1522905d3de25d69f99029f75e47fa66aa5f
parent 47368cb3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1745,6 +1745,7 @@ package android.hardware.input {
    method @NonNull public java.util.List<java.lang.String> getKeyboardLayoutDescriptorsForInputDevice(@NonNull android.view.InputDevice);
    method @NonNull public String getKeyboardLayoutTypeForLayoutDescriptor(@NonNull String);
    method @NonNull @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public java.util.Map<java.lang.Integer,java.lang.Integer> getModifierKeyRemapping();
    method public int getMousePointerSpeed();
    method @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public void remapModifierKey(int, int);
    method @RequiresPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT) public void removeKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier, @NonNull String);
    method public void removeUniqueIdAssociation(@NonNull String);
@@ -1754,6 +1755,7 @@ package android.hardware.input {

  public class InputSettings {
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static void setMaximumObscuringOpacityForTouch(@NonNull android.content.Context, @FloatRange(from=0, to=1) float);
    field public static final int DEFAULT_POINTER_SPEED = 0; // 0x0
  }

}
@@ -2882,6 +2884,10 @@ package android.provider {
    field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
  }

  public static final class Settings.System extends android.provider.Settings.NameValueTable {
    field public static final String POINTER_SPEED = "pointer_speed";
  }

  public static final class Telephony.Sms.Intents {
    field public static final String SMS_CARRIER_PROVISION_ACTION = "android.provider.Telephony.SMS_CARRIER_PROVISION";
  }
+3 −0
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ interface IInputManager {

    KeyCharacterMap getKeyCharacterMap(String layoutDescriptor);

    // Returns the mouse pointer speed.
    int getMousePointerSpeed();

    // Temporarily changes the pointer speed.
    void tryPointerSpeed(int speed);

+23 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.annotation.UserIdInt;
@@ -837,6 +838,28 @@ public final class InputManager {
        }
    }

    /**
     * Returns the mouse pointer speed.
     *
     * <p>The pointer speed is a value between {@link InputSettings#MIN_POINTER_SPEED} and
     * {@link InputSettings#MAX_POINTER_SPEED}, the default value being
     * {@link InputSettings#DEFAULT_POINTER_SPEED}.
     *
     * <p> Note that while setting the mouse pointer speed, it's possible that the input reader has
     * only received this value and has not yet completed reconfiguring itself with this value.
     *
     * @hide
     */
    @SuppressLint("UnflaggedApi") // TestApi without associated feature.
    @TestApi
    public int getMousePointerSpeed() {
        try {
            return mIm.getMousePointerSpeed();
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Changes the mouse pointer speed temporarily, but does not save the setting.
     * <p>
+1 −1
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ public class InputSettings {

    /**
     * Pointer Speed: The default pointer speed (0).
     * @hide
     */
    @SuppressLint("UnflaggedApi") // TestApi without associated feature.
    public static final int DEFAULT_POINTER_SPEED = 0;

    /**
+2 −0
Original line number Diff line number Diff line
@@ -6015,8 +6015,10 @@ public final class Settings {
         *   +7 = fastest
         * @hide
         */
        @SuppressLint({"NoSettingsProvider", "UnflaggedApi"}) // TestApi without associated feature.
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
        @Readable
        @TestApi
        public static final String POINTER_SPEED = "pointer_speed";
        /**
Loading