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

Commit d1bd9e6c authored by Prabir Pradhan's avatar Prabir Pradhan Committed by Android (Google) Code Review
Browse files

Merge changes from topics "pointer-icon-refactor-setPointerIcon",...

Merge changes from topics "pointer-icon-refactor-setPointerIcon", "setPointerIcon-hitTest" into main

* changes:
  Perform hit test before allowing the pointer icon to be set
  Add setPointerIcon for PointerChoreographer (base)
parents 6fe0ceb5 7282d556
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@ interface IInputManager {

    void setPointerIconType(int typeId);
    void setCustomPointerIcon(in PointerIcon icon);
    boolean setPointerIcon(in PointerIcon icon, int displayId, int deviceId, int pointerId,
            in IBinder inputToken);

    oneway void requestPointerCapture(IBinder inputChannelToken, boolean enabled);

+6 −0
Original line number Diff line number Diff line
@@ -1057,6 +1057,12 @@ public final class InputManager {
        mGlobal.setCustomPointerIcon(icon);
    }

    /** @hide */
    public boolean setPointerIcon(PointerIcon icon, int displayId, int deviceId, int pointerId,
            IBinder inputToken) {
        return mGlobal.setPointerIcon(icon, displayId, deviceId, pointerId, inputToken);
    }

    /**
     * Check if showing a {@link android.view.PointerIcon} for styluses is enabled.
     *
+12 −0
Original line number Diff line number Diff line
@@ -1285,6 +1285,18 @@ public final class InputManagerGlobal {
        }
    }

    /**
     * @see InputManager#setPointerIcon(PointerIcon, int, int, int, IBinder)
     */
    public boolean setPointerIcon(PointerIcon icon, int displayId, int deviceId, int pointerId,
            IBinder inputToken) {
        try {
            return mIm.setPointerIcon(icon, displayId, deviceId, pointerId, inputToken);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * @see InputManager#requestPointerCapture(IBinder, boolean)
     */
+0 −18
Original line number Diff line number Diff line
@@ -1307,24 +1307,6 @@ public final class InputDevice implements Parcelable {
        return mHasSensor;
    }

    /**
     * Sets the current pointer type.
     * @param pointerType the type of the pointer icon.
     * @hide
     */
    public void setPointerType(int pointerType) {
        InputManagerGlobal.getInstance().setPointerIconType(pointerType);
    }

    /**
     * Specifies the current custom pointer.
     * @param icon the icon data.
     * @hide
     */
    public void setCustomPointerIcon(PointerIcon icon) {
        InputManagerGlobal.getInstance().setCustomPointerIcon(icon);
    }

    /**
     * Reports whether the device has a battery.
     * @return true if the device has a battery, false otherwise.
+3 −0
Original line number Diff line number Diff line
@@ -223,6 +223,9 @@ public final class PointerIcon implements Parcelable {
     * @throws IllegalArgumentException if context is null.
     */
    public static @NonNull PointerIcon getSystemIcon(@NonNull Context context, int type) {
        // TODO(b/293587049): Pointer Icon Refactor: There is no need to load the system
        // icon resource into memory outside of system server. Remove the need to load
        // resources when getting a system icon.
        if (context == null) {
            throw new IllegalArgumentException("context must not be null");
        }
Loading