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

Commit 6191809a authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Deprecate PointerIcon#TYPE_DEFAULT API

The PointerIcon#TYPE_DEFAULT constant has the same value as TYPE_ARROW,
which makes it a redundant API. Especially now that styluses can also
show pointer icons, this API is misleading, because not all pointer
types have the same default icon. While the arrow might be the default
for a mouse or trackpad, it will likely not be the default for styluses.
Since this default is no longer correct, deprecate the API.

The way to use the system's default icon is to return a null value for
PointerIcon through the View APIs. This is not to be confused with
TYPE_NULL, which shows no icon.

Bug: 215436642
Test: Build
Change-Id: I89f55685b588dc39a0d2b34619e4187d9f041a56
parent bcd276d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51615,7 +51615,7 @@ package android.view {
    field public static final int TYPE_CONTEXT_MENU = 1001; // 0x3e9
    field public static final int TYPE_COPY = 1011; // 0x3f3
    field public static final int TYPE_CROSSHAIR = 1007; // 0x3ef
    field public static final int TYPE_DEFAULT = 1000; // 0x3e8
    field @Deprecated public static final int TYPE_DEFAULT = 1000; // 0x3e8
    field public static final int TYPE_GRAB = 1020; // 0x3fc
    field public static final int TYPE_GRABBING = 1021; // 0x3fd
    field public static final int TYPE_HAND = 1002; // 0x3ea
+8 −1
Original line number Diff line number Diff line
@@ -146,7 +146,14 @@ public final class PointerIcon implements Parcelable {
    // conflicts with any system types that may be defined in the future.
    private static final int TYPE_OEM_FIRST = 10000;

    /** The default pointer icon. */
    /**
     * The default pointer icon.
     * @deprecated This is the same as using {@link #TYPE_ARROW}. Use {@link #TYPE_ARROW} to
     *     explicitly show an arrow, or use a {@code null} {@link PointerIcon} with
     *     {@link View#setPointerIcon(PointerIcon)} or
     *     {@link View#onResolvePointerIcon(MotionEvent, int)} instead to show
     *     the default pointer icon.
     */
    public static final int TYPE_DEFAULT = TYPE_ARROW;

    private static final PointerIcon gNullIcon = new PointerIcon(TYPE_NULL);