From f9d9ce7705475874c82af04eb9b208a7fb556792 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Fri, 13 May 2016 17:44:16 +0100 Subject: [PATCH] DO NOT MERGE Rename PointerIcon and Pointer Capture APIs This is a response to API council feedback. Bug: 26830970 Change-Id: Ia2d284b5c1ab8365bedfdc37d129be4b8146036b --- api/current.txt | 57 ++-- api/system-current.txt | 57 ++-- api/test-current.txt | 57 ++-- .../android/hardware/input/IInputManager.aidl | 2 +- .../android/hardware/input/InputManager.java | 6 +- core/java/android/view/InputDevice.java | 8 +- core/java/android/view/PointerIcon.java | 245 +++++++++--------- core/java/android/view/View.java | 43 +-- core/java/android/view/ViewGroup.java | 57 +++- core/java/android/view/ViewRootImpl.java | 39 +-- core/java/android/widget/TextView.java | 10 +- core/jni/android_view_PointerIcon.cpp | 8 +- core/res/res/values/attrs.xml | 2 +- core/res/res/values/public.xml | 2 +- libs/input/PointerController.cpp | 20 +- libs/input/PointerController.h | 4 +- .../SystemUI/res/layout/global_screenshot.xml | 2 +- .../systemui/stackdivider/DividerView.java | 6 +- .../server/input/InputManagerService.java | 6 +- .../java/com/android/server/wm/DragState.java | 2 +- .../wm/TaskTapPointerEventListener.java | 48 ++-- .../server/wm/WindowManagerService.java | 2 +- ...droid_server_input_InputManagerService.cpp | 14 +- 23 files changed, 375 insertions(+), 322 deletions(-) diff --git a/api/current.txt b/api/current.txt index c13c435bc30c3..cf5119c9b5acc 100644 --- a/api/current.txt +++ b/api/current.txt @@ -943,7 +943,7 @@ package android { field public static final deprecated int phoneNumber = 16843111; // 0x1010167 field public static final int pivotX = 16843189; // 0x10101b5 field public static final int pivotY = 16843190; // 0x10101b6 - field public static final int pointerShape = 16844042; // 0x101050a + field public static final int pointerIcon = 16844042; // 0x101050a field public static final int popupAnimationStyle = 16843465; // 0x10102c9 field public static final int popupBackground = 16843126; // 0x1010176 field public static final int popupCharacters = 16843332; // 0x1010244 @@ -41939,35 +41939,35 @@ package android.view { } public final class PointerIcon implements android.os.Parcelable { - method public static android.view.PointerIcon createCustomIcon(android.graphics.Bitmap, float, float); + method public static android.view.PointerIcon create(android.graphics.Bitmap, float, float); method public int describeContents(); method public static android.view.PointerIcon getSystemIcon(android.content.Context, int); - method public static android.view.PointerIcon loadCustomIcon(android.content.res.Resources, int); + method public static android.view.PointerIcon load(android.content.res.Resources, int); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; - field public static final int STYLE_ALIAS = 1010; // 0x3f2 - field public static final int STYLE_ALL_SCROLL = 1013; // 0x3f5 - field public static final int STYLE_ARROW = 1000; // 0x3e8 - field public static final int STYLE_CELL = 1006; // 0x3ee - field public static final int STYLE_CONTEXT_MENU = 1001; // 0x3e9 - field public static final int STYLE_COPY = 1011; // 0x3f3 - field public static final int STYLE_CROSSHAIR = 1007; // 0x3ef - field public static final int STYLE_DEFAULT = 1000; // 0x3e8 - field public static final int STYLE_GRAB = 1020; // 0x3fc - field public static final int STYLE_GRABBING = 1021; // 0x3fd - field public static final int STYLE_HAND = 1002; // 0x3ea - field public static final int STYLE_HELP = 1003; // 0x3eb - field public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6 - field public static final int STYLE_NO_DROP = 1012; // 0x3f4 - field public static final int STYLE_NULL = 0; // 0x0 - field public static final int STYLE_TEXT = 1008; // 0x3f0 - field public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9 - field public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8 - field public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7 - field public static final int STYLE_VERTICAL_TEXT = 1009; // 0x3f1 - field public static final int STYLE_WAIT = 1004; // 0x3ec - field public static final int STYLE_ZOOM_IN = 1018; // 0x3fa - field public static final int STYLE_ZOOM_OUT = 1019; // 0x3fb + field public static final int TYPE_ALIAS = 1010; // 0x3f2 + field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5 + field public static final int TYPE_ARROW = 1000; // 0x3e8 + field public static final int TYPE_CELL = 1006; // 0x3ee + 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 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 + field public static final int TYPE_HELP = 1003; // 0x3eb + field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6 + field public static final int TYPE_NO_DROP = 1012; // 0x3f4 + field public static final int TYPE_NULL = 0; // 0x0 + field public static final int TYPE_TEXT = 1008; // 0x3f0 + field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9 + field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8 + field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7 + field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1 + field public static final int TYPE_WAIT = 1004; // 0x3ec + field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa + field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb } public class ScaleGestureDetector { @@ -42333,7 +42333,7 @@ package android.view { method public android.view.ViewParent getParentForAccessibility(); method public float getPivotX(); method public float getPivotY(); - method public android.view.PointerIcon getPointerIcon(android.view.MotionEvent, float, float); + method public android.view.PointerIcon getPointerIcon(); method public android.content.res.Resources getResources(); method public final int getRight(); method protected float getRightFadingEdgeStrength(); @@ -42484,6 +42484,7 @@ package android.view { method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method public void onProvideStructure(android.view.ViewStructure); method public void onProvideVirtualStructure(android.view.ViewStructure); + method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int); method protected void onRestoreInstanceState(android.os.Parcelable); method public void onRtlPropertiesChanged(int); method protected android.os.Parcelable onSaveInstanceState(); @@ -42530,6 +42531,7 @@ package android.view { method public boolean requestFocus(int, android.graphics.Rect); method public final boolean requestFocusFromTouch(); method public void requestLayout(); + method public void requestPointerCapture(); method public boolean requestRectangleOnScreen(android.graphics.Rect); method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean); method public final void requestUnbufferedDispatch(android.view.MotionEvent); @@ -42620,7 +42622,6 @@ package android.view { method public void setPaddingRelative(int, int, int, int); method public void setPivotX(float); method public void setPivotY(float); - method public void setPointerCapture(); method public void setPointerIcon(android.view.PointerIcon); method public void setPressed(boolean); method public final void setRight(int); diff --git a/api/system-current.txt b/api/system-current.txt index 61cd00a702beb..57c1ef65ca25b 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1049,7 +1049,7 @@ package android { field public static final deprecated int phoneNumber = 16843111; // 0x1010167 field public static final int pivotX = 16843189; // 0x10101b5 field public static final int pivotY = 16843190; // 0x10101b6 - field public static final int pointerShape = 16844042; // 0x101050a + field public static final int pointerIcon = 16844042; // 0x101050a field public static final int popupAnimationStyle = 16843465; // 0x10102c9 field public static final int popupBackground = 16843126; // 0x1010176 field public static final int popupCharacters = 16843332; // 0x1010244 @@ -44933,35 +44933,35 @@ package android.view { } public final class PointerIcon implements android.os.Parcelable { - method public static android.view.PointerIcon createCustomIcon(android.graphics.Bitmap, float, float); + method public static android.view.PointerIcon create(android.graphics.Bitmap, float, float); method public int describeContents(); method public static android.view.PointerIcon getSystemIcon(android.content.Context, int); - method public static android.view.PointerIcon loadCustomIcon(android.content.res.Resources, int); + method public static android.view.PointerIcon load(android.content.res.Resources, int); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; - field public static final int STYLE_ALIAS = 1010; // 0x3f2 - field public static final int STYLE_ALL_SCROLL = 1013; // 0x3f5 - field public static final int STYLE_ARROW = 1000; // 0x3e8 - field public static final int STYLE_CELL = 1006; // 0x3ee - field public static final int STYLE_CONTEXT_MENU = 1001; // 0x3e9 - field public static final int STYLE_COPY = 1011; // 0x3f3 - field public static final int STYLE_CROSSHAIR = 1007; // 0x3ef - field public static final int STYLE_DEFAULT = 1000; // 0x3e8 - field public static final int STYLE_GRAB = 1020; // 0x3fc - field public static final int STYLE_GRABBING = 1021; // 0x3fd - field public static final int STYLE_HAND = 1002; // 0x3ea - field public static final int STYLE_HELP = 1003; // 0x3eb - field public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6 - field public static final int STYLE_NO_DROP = 1012; // 0x3f4 - field public static final int STYLE_NULL = 0; // 0x0 - field public static final int STYLE_TEXT = 1008; // 0x3f0 - field public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9 - field public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8 - field public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7 - field public static final int STYLE_VERTICAL_TEXT = 1009; // 0x3f1 - field public static final int STYLE_WAIT = 1004; // 0x3ec - field public static final int STYLE_ZOOM_IN = 1018; // 0x3fa - field public static final int STYLE_ZOOM_OUT = 1019; // 0x3fb + field public static final int TYPE_ALIAS = 1010; // 0x3f2 + field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5 + field public static final int TYPE_ARROW = 1000; // 0x3e8 + field public static final int TYPE_CELL = 1006; // 0x3ee + 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 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 + field public static final int TYPE_HELP = 1003; // 0x3eb + field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6 + field public static final int TYPE_NO_DROP = 1012; // 0x3f4 + field public static final int TYPE_NULL = 0; // 0x0 + field public static final int TYPE_TEXT = 1008; // 0x3f0 + field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9 + field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8 + field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7 + field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1 + field public static final int TYPE_WAIT = 1004; // 0x3ec + field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa + field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb } public class ScaleGestureDetector { @@ -45327,7 +45327,7 @@ package android.view { method public android.view.ViewParent getParentForAccessibility(); method public float getPivotX(); method public float getPivotY(); - method public android.view.PointerIcon getPointerIcon(android.view.MotionEvent, float, float); + method public android.view.PointerIcon getPointerIcon(); method public android.content.res.Resources getResources(); method public final int getRight(); method protected float getRightFadingEdgeStrength(); @@ -45478,6 +45478,7 @@ package android.view { method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method public void onProvideStructure(android.view.ViewStructure); method public void onProvideVirtualStructure(android.view.ViewStructure); + method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int); method protected void onRestoreInstanceState(android.os.Parcelable); method public void onRtlPropertiesChanged(int); method protected android.os.Parcelable onSaveInstanceState(); @@ -45524,6 +45525,7 @@ package android.view { method public boolean requestFocus(int, android.graphics.Rect); method public final boolean requestFocusFromTouch(); method public void requestLayout(); + method public void requestPointerCapture(); method public boolean requestRectangleOnScreen(android.graphics.Rect); method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean); method public final void requestUnbufferedDispatch(android.view.MotionEvent); @@ -45614,7 +45616,6 @@ package android.view { method public void setPaddingRelative(int, int, int, int); method public void setPivotX(float); method public void setPivotY(float); - method public void setPointerCapture(); method public void setPointerIcon(android.view.PointerIcon); method public void setPressed(boolean); method public final void setRight(int); diff --git a/api/test-current.txt b/api/test-current.txt index 9165cb0018bba..e7212ecff4df4 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -943,7 +943,7 @@ package android { field public static final deprecated int phoneNumber = 16843111; // 0x1010167 field public static final int pivotX = 16843189; // 0x10101b5 field public static final int pivotY = 16843190; // 0x10101b6 - field public static final int pointerShape = 16844042; // 0x101050a + field public static final int pointerIcon = 16844042; // 0x101050a field public static final int popupAnimationStyle = 16843465; // 0x10102c9 field public static final int popupBackground = 16843126; // 0x1010176 field public static final int popupCharacters = 16843332; // 0x1010244 @@ -42017,35 +42017,35 @@ package android.view { } public final class PointerIcon implements android.os.Parcelable { - method public static android.view.PointerIcon createCustomIcon(android.graphics.Bitmap, float, float); + method public static android.view.PointerIcon create(android.graphics.Bitmap, float, float); method public int describeContents(); method public static android.view.PointerIcon getSystemIcon(android.content.Context, int); - method public static android.view.PointerIcon loadCustomIcon(android.content.res.Resources, int); + method public static android.view.PointerIcon load(android.content.res.Resources, int); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; - field public static final int STYLE_ALIAS = 1010; // 0x3f2 - field public static final int STYLE_ALL_SCROLL = 1013; // 0x3f5 - field public static final int STYLE_ARROW = 1000; // 0x3e8 - field public static final int STYLE_CELL = 1006; // 0x3ee - field public static final int STYLE_CONTEXT_MENU = 1001; // 0x3e9 - field public static final int STYLE_COPY = 1011; // 0x3f3 - field public static final int STYLE_CROSSHAIR = 1007; // 0x3ef - field public static final int STYLE_DEFAULT = 1000; // 0x3e8 - field public static final int STYLE_GRAB = 1020; // 0x3fc - field public static final int STYLE_GRABBING = 1021; // 0x3fd - field public static final int STYLE_HAND = 1002; // 0x3ea - field public static final int STYLE_HELP = 1003; // 0x3eb - field public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6 - field public static final int STYLE_NO_DROP = 1012; // 0x3f4 - field public static final int STYLE_NULL = 0; // 0x0 - field public static final int STYLE_TEXT = 1008; // 0x3f0 - field public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9 - field public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8 - field public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7 - field public static final int STYLE_VERTICAL_TEXT = 1009; // 0x3f1 - field public static final int STYLE_WAIT = 1004; // 0x3ec - field public static final int STYLE_ZOOM_IN = 1018; // 0x3fa - field public static final int STYLE_ZOOM_OUT = 1019; // 0x3fb + field public static final int TYPE_ALIAS = 1010; // 0x3f2 + field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5 + field public static final int TYPE_ARROW = 1000; // 0x3e8 + field public static final int TYPE_CELL = 1006; // 0x3ee + 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 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 + field public static final int TYPE_HELP = 1003; // 0x3eb + field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6 + field public static final int TYPE_NO_DROP = 1012; // 0x3f4 + field public static final int TYPE_NULL = 0; // 0x0 + field public static final int TYPE_TEXT = 1008; // 0x3f0 + field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9 + field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8 + field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7 + field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1 + field public static final int TYPE_WAIT = 1004; // 0x3ec + field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa + field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb } public class ScaleGestureDetector { @@ -42411,7 +42411,7 @@ package android.view { method public android.view.ViewParent getParentForAccessibility(); method public float getPivotX(); method public float getPivotY(); - method public android.view.PointerIcon getPointerIcon(android.view.MotionEvent, float, float); + method public android.view.PointerIcon getPointerIcon(); method public android.content.res.Resources getResources(); method public final int getRight(); method protected float getRightFadingEdgeStrength(); @@ -42562,6 +42562,7 @@ package android.view { method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method public void onProvideStructure(android.view.ViewStructure); method public void onProvideVirtualStructure(android.view.ViewStructure); + method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int); method protected void onRestoreInstanceState(android.os.Parcelable); method public void onRtlPropertiesChanged(int); method protected android.os.Parcelable onSaveInstanceState(); @@ -42608,6 +42609,7 @@ package android.view { method public boolean requestFocus(int, android.graphics.Rect); method public final boolean requestFocusFromTouch(); method public void requestLayout(); + method public void requestPointerCapture(); method public boolean requestRectangleOnScreen(android.graphics.Rect); method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean); method public final void requestUnbufferedDispatch(android.view.MotionEvent); @@ -42698,7 +42700,6 @@ package android.view { method public void setPaddingRelative(int, int, int, int); method public void setPivotX(float); method public void setPivotY(float); - method public void setPointerCapture(); method public void setPointerIcon(android.view.PointerIcon); method public void setPressed(boolean); method public final void setRight(int); diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index c4ee3478fab4b..49c106e69d9fe 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -79,7 +79,7 @@ interface IInputManager { void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token); void cancelVibrate(int deviceId, IBinder token); - void setPointerIconShape(int shapeId); + void setPointerIconType(int typeId); void setCustomPointerIcon(in PointerIcon icon); void setPointerIconDetached(boolean detached); diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index 8a43acb591009..a5aeae331f847 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -872,13 +872,13 @@ public final class InputManager { * Changes the mouse pointer's icon shape into the specified id. * * @param iconId The id of the pointer graphic, as a value between - * {@link PointerIcon.STYLE_ARROW} and {@link PointerIcon.STYLE_GRABBING}. + * {@link PointerIcon.TYPE_ARROW} and {@link PointerIcon.TYPE_GRABBING}. * * @hide */ - public void setPointerIconShape(int iconId) { + public void setPointerIconType(int iconId) { try { - mIm.setPointerIconShape(iconId); + mIm.setPointerIconType(iconId); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index 88cd7ca71a4ea..e5748c1ffe524 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -775,12 +775,12 @@ public final class InputDevice implements Parcelable { } /** - * Sets the current pointer shape. - * @param pointerShape the id of the pointer icon. + * Sets the current pointer type. + * @param pointerType the type of the pointer icon. * @hide */ - public void setPointerShape(int pointerShape) { - InputManager.getInstance().setPointerIconShape(pointerShape); + public void setPointerType(int pointerType) { + InputManager.getInstance().setPointerIconType(pointerType); } /** diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java index 81bb638e62fbd..fc79f53b744b3 100644 --- a/core/java/android/view/PointerIcon.java +++ b/core/java/android/view/PointerIcon.java @@ -36,112 +36,112 @@ import android.util.Log; /** * Represents an icon that can be used as a mouse pointer. *

- * Pointer icons can be provided either by the system using system styles, + * Pointer icons can be provided either by the system using system types, * or by applications using bitmaps or application resources. *

*/ public final class PointerIcon implements Parcelable { private static final String TAG = "PointerIcon"; - /** {@hide} Style constant: Custom icon with a user-supplied bitmap. */ - public static final int STYLE_CUSTOM = -1; + /** {@hide} Type constant: Custom icon with a user-supplied bitmap. */ + public static final int TYPE_CUSTOM = -1; - /** Style constant: Null icon. It has no bitmap. */ - public static final int STYLE_NULL = 0; + /** Type constant: Null icon. It has no bitmap. */ + public static final int TYPE_NULL = 0; - /** Style constant: no icons are specified. If all views uses this, then falls back - * to the default style, but this is helpful to distinguish a view explicitly want + /** Type constant: no icons are specified. If all views uses this, then falls back + * to the default type, but this is helpful to distinguish a view explicitly want * to have the default icon. * @hide */ - public static final int STYLE_NOT_SPECIFIED = 1; + public static final int TYPE_NOT_SPECIFIED = 1; - /** Style constant: Arrow icon. (Default mouse pointer) */ - public static final int STYLE_ARROW = 1000; + /** Type constant: Arrow icon. (Default mouse pointer) */ + public static final int TYPE_ARROW = 1000; - /** {@hide} Style constant: Spot hover icon for touchpads. */ - public static final int STYLE_SPOT_HOVER = 2000; + /** {@hide} Type constant: Spot hover icon for touchpads. */ + public static final int TYPE_SPOT_HOVER = 2000; - /** {@hide} Style constant: Spot touch icon for touchpads. */ - public static final int STYLE_SPOT_TOUCH = 2001; + /** {@hide} Type constant: Spot touch icon for touchpads. */ + public static final int TYPE_SPOT_TOUCH = 2001; - /** {@hide} Style constant: Spot anchor icon for touchpads. */ - public static final int STYLE_SPOT_ANCHOR = 2002; + /** {@hide} Type constant: Spot anchor icon for touchpads. */ + public static final int TYPE_SPOT_ANCHOR = 2002; - // Style constants for additional predefined icons for mice. - /** Style constant: context-menu. */ - public static final int STYLE_CONTEXT_MENU = 1001; + // Type constants for additional predefined icons for mice. + /** Type constant: context-menu. */ + public static final int TYPE_CONTEXT_MENU = 1001; - /** Style constant: hand. */ - public static final int STYLE_HAND = 1002; + /** Type constant: hand. */ + public static final int TYPE_HAND = 1002; - /** Style constant: help. */ - public static final int STYLE_HELP = 1003; + /** Type constant: help. */ + public static final int TYPE_HELP = 1003; - /** Style constant: wait. */ - public static final int STYLE_WAIT = 1004; + /** Type constant: wait. */ + public static final int TYPE_WAIT = 1004; - /** Style constant: cell. */ - public static final int STYLE_CELL = 1006; + /** Type constant: cell. */ + public static final int TYPE_CELL = 1006; - /** Style constant: crosshair. */ - public static final int STYLE_CROSSHAIR = 1007; + /** Type constant: crosshair. */ + public static final int TYPE_CROSSHAIR = 1007; - /** Style constant: text. */ - public static final int STYLE_TEXT = 1008; + /** Type constant: text. */ + public static final int TYPE_TEXT = 1008; - /** Style constant: vertical-text. */ - public static final int STYLE_VERTICAL_TEXT = 1009; + /** Type constant: vertical-text. */ + public static final int TYPE_VERTICAL_TEXT = 1009; - /** Style constant: alias (indicating an alias of/shortcut to something is + /** Type constant: alias (indicating an alias of/shortcut to something is * to be created. */ - public static final int STYLE_ALIAS = 1010; + public static final int TYPE_ALIAS = 1010; - /** Style constant: copy. */ - public static final int STYLE_COPY = 1011; + /** Type constant: copy. */ + public static final int TYPE_COPY = 1011; - /** Style constant: no-drop. */ - public static final int STYLE_NO_DROP = 1012; + /** Type constant: no-drop. */ + public static final int TYPE_NO_DROP = 1012; - /** Style constant: all-scroll. */ - public static final int STYLE_ALL_SCROLL = 1013; + /** Type constant: all-scroll. */ + public static final int TYPE_ALL_SCROLL = 1013; - /** Style constant: horizontal double arrow mainly for resizing. */ - public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; + /** Type constant: horizontal double arrow mainly for resizing. */ + public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; - /** Style constant: vertical double arrow mainly for resizing. */ - public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; + /** Type constant: vertical double arrow mainly for resizing. */ + public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; - /** Style constant: diagonal double arrow -- top-right to bottom-left. */ - public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; + /** Type constant: diagonal double arrow -- top-right to bottom-left. */ + public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; - /** Style constant: diagonal double arrow -- top-left to bottom-right. */ - public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; + /** Type constant: diagonal double arrow -- top-left to bottom-right. */ + public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; - /** Style constant: zoom-in. */ - public static final int STYLE_ZOOM_IN = 1018; + /** Type constant: zoom-in. */ + public static final int TYPE_ZOOM_IN = 1018; - /** Style constant: zoom-out. */ - public static final int STYLE_ZOOM_OUT = 1019; + /** Type constant: zoom-out. */ + public static final int TYPE_ZOOM_OUT = 1019; - /** Style constant: grab. */ - public static final int STYLE_GRAB = 1020; + /** Type constant: grab. */ + public static final int TYPE_GRAB = 1020; - /** Style constant: grabbing. */ - public static final int STYLE_GRABBING = 1021; + /** Type constant: grabbing. */ + public static final int TYPE_GRABBING = 1021; - // OEM private styles should be defined starting at this range to avoid - // conflicts with any system styles that may be defined in the future. - private static final int STYLE_OEM_FIRST = 10000; + // OEM private types should be defined starting at this range to avoid + // conflicts with any system types that may be defined in the future. + private static final int TYPE_OEM_FIRST = 10000; /** The default pointer icon. */ - public static final int STYLE_DEFAULT = STYLE_ARROW; + public static final int TYPE_DEFAULT = TYPE_ARROW; - private static final PointerIcon gNullIcon = new PointerIcon(STYLE_NULL); + private static final PointerIcon gNullIcon = new PointerIcon(TYPE_NULL); private static final SparseArray gSystemIcons = new SparseArray(); private static boolean sUseLargeIcons = false; - private final int mStyle; + private final int mType; private int mSystemIconResourceId; private Bitmap mBitmap; private float mHotSpotX; @@ -151,8 +151,8 @@ public final class PointerIcon implements Parcelable { private Bitmap mBitmapFrames[]; private int mDurationPerFrame; - private PointerIcon(int style) { - mStyle = style; + private PointerIcon(int type) { + mType = type; } /** @@ -160,7 +160,7 @@ public final class PointerIcon implements Parcelable { * * @return The null pointer icon. * - * @see #STYLE_NULL + * @see #TYPE_NULL * @hide */ public static PointerIcon getNullIcon() { @@ -177,36 +177,36 @@ public final class PointerIcon implements Parcelable { * @hide */ public static PointerIcon getDefaultIcon(@NonNull Context context) { - return getSystemIcon(context, STYLE_DEFAULT); + return getSystemIcon(context, TYPE_DEFAULT); } /** - * Gets a system pointer icon for the given style. - * If style is not recognized, returns the default pointer icon. + * Gets a system pointer icon for the given type. + * If typeis not recognized, returns the default pointer icon. * * @param context The context. - * @param style The pointer icon style. + * @param type The pointer icon type. * @return The pointer icon. * * @throws IllegalArgumentException if context is null. */ - public static PointerIcon getSystemIcon(@NonNull Context context, int style) { + public static PointerIcon getSystemIcon(@NonNull Context context, int type) { if (context == null) { throw new IllegalArgumentException("context must not be null"); } - if (style == STYLE_NULL) { + if (type == TYPE_NULL) { return gNullIcon; } - PointerIcon icon = gSystemIcons.get(style); + PointerIcon icon = gSystemIcons.get(type); if (icon != null) { return icon; } - int styleIndex = getSystemIconStyleIndex(style); - if (styleIndex == 0) { - styleIndex = getSystemIconStyleIndex(STYLE_DEFAULT); + int typeIndex = getSystemIconTypeIndex(type); + if (typeIndex == 0) { + typeIndex = getSystemIconTypeIndex(TYPE_DEFAULT); } int defStyle = sUseLargeIcons ? @@ -214,21 +214,21 @@ public final class PointerIcon implements Parcelable { TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.Pointer, 0, defStyle); - int resourceId = a.getResourceId(styleIndex, -1); + int resourceId = a.getResourceId(typeIndex, -1); a.recycle(); if (resourceId == -1) { - Log.w(TAG, "Missing theme resources for pointer icon style " + style); - return style == STYLE_DEFAULT ? gNullIcon : getSystemIcon(context, STYLE_DEFAULT); + Log.w(TAG, "Missing theme resources for pointer icon type " + type); + return type == TYPE_DEFAULT ? gNullIcon : getSystemIcon(context, TYPE_DEFAULT); } - icon = new PointerIcon(style); + icon = new PointerIcon(type); if ((resourceId & 0xff000000) == 0x01000000) { icon.mSystemIconResourceId = resourceId; } else { icon.loadResource(context, context.getResources(), resourceId); } - gSystemIcons.append(style, icon); + gSystemIcons.append(type, icon); return icon; } @@ -242,7 +242,7 @@ public final class PointerIcon implements Parcelable { } /** - * Creates a custom pointer from the given bitmap and hotspot information. + * Creates a custom pointer icon from the given bitmap and hotspot information. * * @param bitmap The bitmap for the icon. * @param hotSpotX The X offset of the pointer icon hotspot in the bitmap. @@ -254,14 +254,13 @@ public final class PointerIcon implements Parcelable { * @throws IllegalArgumentException if bitmap is null, or if the x/y hotspot * parameters are invalid. */ - public static PointerIcon createCustomIcon( - @NonNull Bitmap bitmap, float hotSpotX, float hotSpotY) { + public static PointerIcon create(@NonNull Bitmap bitmap, float hotSpotX, float hotSpotY) { if (bitmap == null) { throw new IllegalArgumentException("bitmap must not be null"); } validateHotSpot(bitmap, hotSpotX, hotSpotY); - PointerIcon icon = new PointerIcon(STYLE_CUSTOM); + PointerIcon icon = new PointerIcon(TYPE_CUSTOM); icon.mBitmap = bitmap; icon.mHotSpotX = hotSpotX; icon.mHotSpotY = hotSpotY; @@ -289,12 +288,12 @@ public final class PointerIcon implements Parcelable { * @throws Resources.NotFoundException if the resource was not found or the drawable * linked in the resource was not found. */ - public static PointerIcon loadCustomIcon(@NonNull Resources resources, @XmlRes int resourceId) { + public static PointerIcon load(@NonNull Resources resources, @XmlRes int resourceId) { if (resources == null) { throw new IllegalArgumentException("resources must not be null"); } - PointerIcon icon = new PointerIcon(STYLE_CUSTOM); + PointerIcon icon = new PointerIcon(TYPE_CUSTOM); icon.loadResource(null, resources, resourceId); return icon; } @@ -318,28 +317,28 @@ public final class PointerIcon implements Parcelable { return this; } - PointerIcon result = new PointerIcon(mStyle); + PointerIcon result = new PointerIcon(mType); result.mSystemIconResourceId = mSystemIconResourceId; result.loadResource(context, context.getResources(), mSystemIconResourceId); return result; } /** @hide */ - public int getStyle() { - return mStyle; + public int getType() { + return mType; } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public PointerIcon createFromParcel(Parcel in) { - int style = in.readInt(); - if (style == STYLE_NULL) { + int type = in.readInt(); + if (type == TYPE_NULL) { return getNullIcon(); } int systemIconResourceId = in.readInt(); if (systemIconResourceId != 0) { - PointerIcon icon = new PointerIcon(style); + PointerIcon icon = new PointerIcon(type); icon.mSystemIconResourceId = systemIconResourceId; return icon; } @@ -347,7 +346,7 @@ public final class PointerIcon implements Parcelable { Bitmap bitmap = Bitmap.CREATOR.createFromParcel(in); float hotSpotX = in.readFloat(); float hotSpotY = in.readFloat(); - return PointerIcon.createCustomIcon(bitmap, hotSpotX, hotSpotY); + return PointerIcon.create(bitmap, hotSpotX, hotSpotY); } public PointerIcon[] newArray(int size) { @@ -360,9 +359,9 @@ public final class PointerIcon implements Parcelable { } public void writeToParcel(Parcel out, int flags) { - out.writeInt(mStyle); + out.writeInt(mType); - if (mStyle != STYLE_NULL) { + if (mType != TYPE_NULL) { out.writeInt(mSystemIconResourceId); if (mSystemIconResourceId == 0) { mBitmap.writeToParcel(out, flags); @@ -383,7 +382,7 @@ public final class PointerIcon implements Parcelable { } PointerIcon otherIcon = (PointerIcon) other; - if (mStyle != otherIcon.mStyle + if (mType != otherIcon.mType || mSystemIconResourceId != otherIcon.mSystemIconResourceId) { return false; } @@ -477,57 +476,57 @@ public final class PointerIcon implements Parcelable { } } - private static int getSystemIconStyleIndex(int style) { - switch (style) { - case STYLE_ARROW: + private static int getSystemIconTypeIndex(int type) { + switch (type) { + case TYPE_ARROW: return com.android.internal.R.styleable.Pointer_pointerIconArrow; - case STYLE_SPOT_HOVER: + case TYPE_SPOT_HOVER: return com.android.internal.R.styleable.Pointer_pointerIconSpotHover; - case STYLE_SPOT_TOUCH: + case TYPE_SPOT_TOUCH: return com.android.internal.R.styleable.Pointer_pointerIconSpotTouch; - case STYLE_SPOT_ANCHOR: + case TYPE_SPOT_ANCHOR: return com.android.internal.R.styleable.Pointer_pointerIconSpotAnchor; - case STYLE_HAND: + case TYPE_HAND: return com.android.internal.R.styleable.Pointer_pointerIconHand; - case STYLE_CONTEXT_MENU: + case TYPE_CONTEXT_MENU: return com.android.internal.R.styleable.Pointer_pointerIconContextMenu; - case STYLE_HELP: + case TYPE_HELP: return com.android.internal.R.styleable.Pointer_pointerIconHelp; - case STYLE_WAIT: + case TYPE_WAIT: return com.android.internal.R.styleable.Pointer_pointerIconWait; - case STYLE_CELL: + case TYPE_CELL: return com.android.internal.R.styleable.Pointer_pointerIconCell; - case STYLE_CROSSHAIR: + case TYPE_CROSSHAIR: return com.android.internal.R.styleable.Pointer_pointerIconCrosshair; - case STYLE_TEXT: + case TYPE_TEXT: return com.android.internal.R.styleable.Pointer_pointerIconText; - case STYLE_VERTICAL_TEXT: + case TYPE_VERTICAL_TEXT: return com.android.internal.R.styleable.Pointer_pointerIconVerticalText; - case STYLE_ALIAS: + case TYPE_ALIAS: return com.android.internal.R.styleable.Pointer_pointerIconAlias; - case STYLE_COPY: + case TYPE_COPY: return com.android.internal.R.styleable.Pointer_pointerIconCopy; - case STYLE_ALL_SCROLL: + case TYPE_ALL_SCROLL: return com.android.internal.R.styleable.Pointer_pointerIconAllScroll; - case STYLE_NO_DROP: + case TYPE_NO_DROP: return com.android.internal.R.styleable.Pointer_pointerIconNodrop; - case STYLE_HORIZONTAL_DOUBLE_ARROW: + case TYPE_HORIZONTAL_DOUBLE_ARROW: return com.android.internal.R.styleable.Pointer_pointerIconHorizontalDoubleArrow; - case STYLE_VERTICAL_DOUBLE_ARROW: + case TYPE_VERTICAL_DOUBLE_ARROW: return com.android.internal.R.styleable.Pointer_pointerIconVerticalDoubleArrow; - case STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW: + case TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW: return com.android.internal.R.styleable. Pointer_pointerIconTopRightDiagonalDoubleArrow; - case STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW: + case TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW: return com.android.internal.R.styleable. Pointer_pointerIconTopLeftDiagonalDoubleArrow; - case STYLE_ZOOM_IN: + case TYPE_ZOOM_IN: return com.android.internal.R.styleable.Pointer_pointerIconZoomIn; - case STYLE_ZOOM_OUT: + case TYPE_ZOOM_OUT: return com.android.internal.R.styleable.Pointer_pointerIconZoomOut; - case STYLE_GRAB: + case TYPE_GRAB: return com.android.internal.R.styleable.Pointer_pointerIconGrab; - case STYLE_GRABBING: + case TYPE_GRABBING: return com.android.internal.R.styleable.Pointer_pointerIconGrabbing; default: return 0; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 77884f6e4d778..2269282a57711 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2644,7 +2644,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private static final int PFLAG3_POINTER_ICON_NOT_SPECIFIED = 0 << PFLAG3_POINTER_ICON_LSHIFT; /** - * Value indicating {@link PointerIcon.STYLE_NULL}. + * Value indicating {@link PointerIcon.TYPE_NULL}. */ private static final int PFLAG3_POINTER_ICON_NULL = 1 << PFLAG3_POINTER_ICON_LSHIFT; @@ -4539,15 +4539,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, initializeScrollIndicators = true; } break; - case R.styleable.View_pointerShape: + case R.styleable.View_pointerIcon: final int resourceId = a.getResourceId(attr, 0); if (resourceId != 0) { - setPointerIcon(PointerIcon.loadCustomIcon( + setPointerIcon(PointerIcon.load( context.getResources(), resourceId)); } else { - final int pointerShape = a.getInt(attr, PointerIcon.STYLE_NOT_SPECIFIED); - if (pointerShape != PointerIcon.STYLE_NOT_SPECIFIED) { - setPointerIcon(PointerIcon.getSystemIcon(context, pointerShape)); + final int pointerType = a.getInt(attr, PointerIcon.TYPE_NOT_SPECIFIED); + if (pointerType != PointerIcon.TYPE_NOT_SPECIFIED) { + setPointerIcon(PointerIcon.getSystemIcon(context, pointerType)); } } break; @@ -21788,19 +21788,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * The default implementation does not care the location or event types, but some subclasses * may use it (such as WebViews). * @param event The MotionEvent from a mouse - * @param x The x position of the event, local to the view - * @param y The y position of the event, local to the view + * @param pointerIndex The index of the pointer for which to retrieve the {@link PointerIcon}. + * This will be between 0 and {@link MotionEvent#getPointerCount()}. * @see PointerIcon */ - public PointerIcon getPointerIcon(MotionEvent event, float x, float y) { + public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) { + final float x = event.getX(pointerIndex); + final float y = event.getY(pointerIndex); if (isDraggingScrollBar() || isOnScrollbarThumb(x, y)) { - return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_ARROW); + return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_ARROW); } return mPointerIcon; } /** * Set the pointer icon for the current view. + * Passing {@code null} will restore the pointer icon to its default value. * @param pointerIcon A PointerIcon instance which will be shown when the mouse hovers. */ public void setPointerIcon(PointerIcon pointerIcon) { @@ -21814,11 +21817,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } + /** + * Gets the pointer icon for the current view. + */ + public PointerIcon getPointerIcon() { + return mPointerIcon; + } + + /** * Request capturing further mouse events. * - * When the view captures, the mouse pointer icon will disappear and will not change its - * position. Further mouse events will come to the capturing view, and the mouse movements + * When the view captures, the pointer icon will disappear and will not change its + * position. Further pointer events will come to the capturing view, and the pointer movements * will can be detected through {@link MotionEvent#AXIS_RELATIVE_X} and * {@link MotionEvent#AXIS_RELATIVE_Y}. Non-mouse events (touchscreens, or stylus) will not * be affected. @@ -21830,10 +21841,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #releasePointerCapture() * @see #hasPointerCapture() */ - public void setPointerCapture() { + public void requestPointerCapture() { final ViewRootImpl viewRootImpl = getViewRootImpl(); if (viewRootImpl != null) { - viewRootImpl.setPointerCapture(this); + viewRootImpl.requestPointerCapture(this); } } @@ -21842,7 +21853,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Release the current capture of mouse events. * * If the view does not have the capture, it will do nothing. - * @see #setPointerCapture() + * @see #requestPointerCapture() * @see #hasPointerCapture() */ public void releasePointerCapture() { @@ -21856,7 +21867,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Checks the capture status of mouse events. * * @return true if the view has the capture. - * @see #setPointerCapture() + * @see #requestPointerCapture() * @see #hasPointerCapture() */ public boolean hasPointerCapture() { diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index b060fa7b6449b..de0db7d8efda1 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -1700,9 +1700,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } @Override - public PointerIcon getPointerIcon(MotionEvent event, float x, float y) { + public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) { + final float x = event.getX(pointerIndex); + final float y = event.getY(pointerIndex); if (isOnScrollbarThumb(x, y) || isDraggingScrollBar()) { - return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_ARROW); + return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_ARROW); } // Check what the child under the pointer says about the pointer. final int childrenCount = mChildrenCount; @@ -1716,7 +1718,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final View child = getAndVerifyPreorderedView(preorderedList, children, childIndex); final PointF point = getLocalPoint(); if (isTransformedTouchPointInView(x, y, child, point)) { - final PointerIcon pointerIcon = child.getPointerIcon(event, point.x, point.y); + final PointerIcon pointerIcon = + dispatchResolvePointerIcon(event, pointerIndex, child); if (pointerIcon != null) { if (preorderedList != null) preorderedList.clear(); return pointerIcon; @@ -1729,7 +1732,24 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // The pointer is not a child or the child has no preferences, returning the default // implementation. - return super.getPointerIcon(event, x, y); + return super.onResolvePointerIcon(event, pointerIndex); + } + + private PointerIcon dispatchResolvePointerIcon(MotionEvent event, int pointerIndex, + View child) { + final PointerIcon pointerIcon; + if (!child.hasIdentityMatrix()) { + MotionEvent transformedEvent = getTransformedMotionEvent(event, child); + pointerIcon = child.onResolvePointerIcon(transformedEvent, pointerIndex); + transformedEvent.recycle(); + } else { + final float offsetX = mScrollX - child.mLeft; + final float offsetY = mScrollY - child.mTop; + event.offsetLocation(offsetX, offsetY); + pointerIcon = child.onResolvePointerIcon(event, pointerIndex); + event.offsetLocation(-offsetX, -offsetY); + } + return pointerIcon; } private int getAndVerifyPreorderedIndex(int childrenCount, int i, boolean customOrder) { @@ -2110,17 +2130,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @return {@code true} if the child handled the event. */ private boolean dispatchTransformedGenericPointerEvent(MotionEvent event, View child) { - final float offsetX = mScrollX - child.mLeft; - final float offsetY = mScrollY - child.mTop; - boolean handled; if (!child.hasIdentityMatrix()) { - MotionEvent transformedEvent = MotionEvent.obtain(event); - transformedEvent.offsetLocation(offsetX, offsetY); - transformedEvent.transform(child.getInverseMatrix()); + MotionEvent transformedEvent = getTransformedMotionEvent(event, child); handled = child.dispatchGenericMotionEvent(transformedEvent); transformedEvent.recycle(); } else { + final float offsetX = mScrollX - child.mLeft; + final float offsetY = mScrollY - child.mTop; event.offsetLocation(offsetX, offsetY); handled = child.dispatchGenericMotionEvent(event); event.offsetLocation(-offsetX, -offsetY); @@ -2128,6 +2145,26 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return handled; } + /** + * Returns a MotionEvent that's been transformed into the child's local coordinates. + * + * It's the responsibility of the caller to recycle it once they're finished with it. + * @param event The event to transform. + * @param child The view whose coordinate space is to be used. + * @return A copy of the the given MotionEvent, transformed into the given View's coordinate + * space. + */ + private MotionEvent getTransformedMotionEvent(MotionEvent event, View child) { + final float offsetX = mScrollX - child.mLeft; + final float offsetY = mScrollY - child.mTop; + final MotionEvent transformedEvent = MotionEvent.obtain(event); + transformedEvent.offsetLocation(offsetX, offsetY); + if (!child.hasIdentityMatrix()) { + transformedEvent.transform(child.getInverseMatrix()); + } + return transformedEvent; + } + @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (mInputEventConsistencyVerifier != null) { diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 130b440dfbbd1..1c6600d0b3ac1 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -359,7 +359,7 @@ public final class ViewRootImpl implements ViewParent, private long mFpsPrevTime = -1; private int mFpsNumFrames; - private int mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED; + private int mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED; private PointerIcon mCustomPointerIcon = null; /** @@ -3168,7 +3168,7 @@ public final class ViewRootImpl implements ViewParent, } } - void setPointerCapture(View view) { + void requestPointerCapture(View view) { if (!mAttachInfo.mHasWindowFocus) { Log.w(mTag, "Can't set capture if it's not focused."); return; @@ -3178,6 +3178,7 @@ public final class ViewRootImpl implements ViewParent, } mCapturingView = view; InputManager.getInstance().setPointerIconDetached(true); + return; } void releasePointerCapture(View view) { @@ -4445,19 +4446,18 @@ public final class ViewRootImpl implements ViewParent, } private void maybeUpdatePointerIcon(MotionEvent event) { - if (event.getPointerCount() == 1 - && event.isFromSource(InputDevice.SOURCE_MOUSE)) { + if (event.getPointerCount() == 1 && event.isFromSource(InputDevice.SOURCE_MOUSE)) { if (event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER || event.getActionMasked() == MotionEvent.ACTION_HOVER_EXIT) { - // Other apps or the window manager may change the icon shape outside of - // this app, therefore the icon shape has to be reset on enter/exit event. - mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED; + // Other apps or the window manager may change the icon type outside of + // this app, therefore the icon type has to be reset on enter/exit event. + mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED; } if (event.getActionMasked() != MotionEvent.ACTION_HOVER_EXIT) { if (!updatePointerIcon(event) && event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE) { - mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED; + mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED; } } } @@ -4484,13 +4484,14 @@ public final class ViewRootImpl implements ViewParent, } private void resetPointerIcon(MotionEvent event) { - mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED; + mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED; updatePointerIcon(event); } private boolean updatePointerIcon(MotionEvent event) { - final float x = event.getX(); - final float y = event.getY(); + final int pointerIndex = 0; + final float x = event.getX(pointerIndex); + final float y = event.getY(pointerIndex); if (mView == null) { // E.g. click outside a popup to dismiss it Slog.d(mTag, "updatePointerIcon called after view was removed"); @@ -4501,19 +4502,19 @@ public final class ViewRootImpl implements ViewParent, Slog.d(mTag, "updatePointerIcon called with position out of bounds"); return false; } - final PointerIcon pointerIcon = mView.getPointerIcon(event, x, y); - final int pointerShape = (pointerIcon != null) ? - pointerIcon.getStyle() : PointerIcon.STYLE_DEFAULT; + final PointerIcon pointerIcon = mView.onResolvePointerIcon(event, pointerIndex); + final int pointerType = (pointerIcon != null) ? + pointerIcon.getType() : PointerIcon.TYPE_DEFAULT; - if (mPointerIconShape != pointerShape) { - mPointerIconShape = pointerShape; - if (mPointerIconShape != PointerIcon.STYLE_CUSTOM) { + if (mPointerIconType != pointerType) { + mPointerIconType = pointerType; + if (mPointerIconType != PointerIcon.TYPE_CUSTOM) { mCustomPointerIcon = null; - InputManager.getInstance().setPointerIconShape(pointerShape); + InputManager.getInstance().setPointerIconType(pointerType); return true; } } - if (mPointerIconShape == PointerIcon.STYLE_CUSTOM && + if (mPointerIconType == PointerIcon.TYPE_CUSTOM && !pointerIcon.equals(mCustomPointerIcon)) { mCustomPointerIcon = pointerIcon; InputManager.getInstance().setCustomPointerIcon(mCustomPointerIcon); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index a0843c7a8be4c..a7b460ef0919f 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -6005,19 +6005,21 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } @Override - public PointerIcon getPointerIcon(MotionEvent event, float x, float y) { + public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) { if (mText instanceof Spannable && mLinksClickable) { + final float x = event.getX(pointerIndex); + final float y = event.getY(pointerIndex); final int offset = getOffsetForPosition(x, y); final ClickableSpan[] clickables = ((Spannable) mText).getSpans(offset, offset, ClickableSpan.class); if (clickables.length > 0) { - return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_HAND); + return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_HAND); } } if (isTextSelectable() || isTextEditable()) { - return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_TEXT); + return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_TEXT); } - return super.getPointerIcon(event, x, y); + return super.onResolvePointerIcon(event, pointerIndex); } @Override diff --git a/core/jni/android_view_PointerIcon.cpp b/core/jni/android_view_PointerIcon.cpp index 71be52e52e57f..6b634dfbef3e5 100644 --- a/core/jni/android_view_PointerIcon.cpp +++ b/core/jni/android_view_PointerIcon.cpp @@ -32,7 +32,7 @@ namespace android { static struct { jclass clazz; - jfieldID mStyle; + jfieldID mType; jfieldID mBitmap; jfieldID mHotSpotX; jfieldID mHotSpotY; @@ -78,7 +78,7 @@ status_t android_view_PointerIcon_load(JNIEnv* env, jobject pointerIconObj, jobj status_t android_view_PointerIcon_getLoadedIcon(JNIEnv* env, jobject pointerIconObj, PointerIcon* outPointerIcon) { - outPointerIcon->style = env->GetIntField(pointerIconObj, gPointerIconClassInfo.mStyle); + outPointerIcon->style = env->GetIntField(pointerIconObj, gPointerIconClassInfo.mType); outPointerIcon->hotSpotX = env->GetFloatField(pointerIconObj, gPointerIconClassInfo.mHotSpotX); outPointerIcon->hotSpotY = env->GetFloatField(pointerIconObj, gPointerIconClassInfo.mHotSpotY); @@ -128,8 +128,8 @@ int register_android_view_PointerIcon(JNIEnv* env) { gPointerIconClassInfo.mBitmap = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz, "mBitmap", "Landroid/graphics/Bitmap;"); - gPointerIconClassInfo.mStyle = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz, - "mStyle", "I"); + gPointerIconClassInfo.mType = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz, + "mType", "I"); gPointerIconClassInfo.mHotSpotX = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz, "mHotSpotX", "F"); diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 6af9ef2271fa1..d12e34c1cb104 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2796,7 +2796,7 @@ i - + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index c91e09fd39d03..fbc766517181e 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2684,7 +2684,7 @@ - + diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp index 212c6a0d2c3c8..61f78cc069c5a 100644 --- a/libs/input/PointerController.cpp +++ b/libs/input/PointerController.cpp @@ -84,7 +84,7 @@ PointerController::PointerController(const sp& mLocked.pointerAlpha = 0.0f; // pointer is initially faded mLocked.pointerSprite = mSpriteController->createSprite(); mLocked.pointerIconChanged = false; - mLocked.requestedPointerShape = mPolicy->getDefaultPointerIconId(); + mLocked.requestedPointerType= mPolicy->getDefaultPointerIconId(); mLocked.animationFrameIndex = 0; mLocked.lastFrameUpdatedTime = 0; @@ -459,10 +459,10 @@ void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_ updatePointerLocked(); } -void PointerController::updatePointerShape(int32_t iconId) { +void PointerController::updatePointerIcon(int32_t iconId) { AutoMutex _l(mLock); - if (mLocked.requestedPointerShape != iconId) { - mLocked.requestedPointerShape = iconId; + if (mLocked.requestedPointerType != iconId) { + mLocked.requestedPointerType = iconId; mLocked.presentationChanged = true; updatePointerLocked(); } @@ -473,7 +473,7 @@ void PointerController::setCustomPointerIcon(const SpriteIcon& icon) { const int32_t iconId = mPolicy->getCustomPointerIconId(); mLocked.additionalMouseResources[iconId] = icon; - mLocked.requestedPointerShape = iconId; + mLocked.requestedPointerType = iconId; mLocked.presentationChanged = true; updatePointerLocked(); @@ -574,7 +574,7 @@ bool PointerController::doFadingAnimationLocked(nsecs_t timestamp) { bool PointerController::doBitmapAnimationLocked(nsecs_t timestamp) { std::map::const_iterator iter = mLocked.animationResources.find( - mLocked.requestedPointerShape); + mLocked.requestedPointerType); if (iter == mLocked.animationResources.end()) { return false; } @@ -636,14 +636,14 @@ void PointerController::updatePointerLocked() { if (mLocked.pointerIconChanged || mLocked.presentationChanged) { if (mLocked.presentation == PRESENTATION_POINTER) { - if (mLocked.requestedPointerShape == mPolicy->getDefaultPointerIconId()) { + if (mLocked.requestedPointerType== mPolicy->getDefaultPointerIconId()) { mLocked.pointerSprite->setIcon(mLocked.pointerIcon); } else { std::map::const_iterator iter = - mLocked.additionalMouseResources.find(mLocked.requestedPointerShape); + mLocked.additionalMouseResources.find(mLocked.requestedPointerType); if (iter != mLocked.additionalMouseResources.end()) { std::map::const_iterator anim_iter = - mLocked.animationResources.find(mLocked.requestedPointerShape); + mLocked.animationResources.find(mLocked.requestedPointerType); if (anim_iter != mLocked.animationResources.end()) { mLocked.animationFrameIndex = 0; mLocked.lastFrameUpdatedTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -651,7 +651,7 @@ void PointerController::updatePointerLocked() { } mLocked.pointerSprite->setIcon(iter->second); } else { - ALOGW("Can't find the resource for icon id %d", mLocked.requestedPointerShape); + ALOGW("Can't find the resource for icon id %d", mLocked.requestedPointerType); mLocked.pointerSprite->setIcon(mLocked.pointerIcon); } } diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h index c1381f32a37f8..b47139adaf907 100644 --- a/libs/input/PointerController.h +++ b/libs/input/PointerController.h @@ -105,7 +105,7 @@ public: const uint32_t* spotIdToIndex, BitSet32 spotIdBits); virtual void clearSpots(); - void updatePointerShape(int32_t iconId); + void updatePointerIcon(int32_t iconId); void setCustomPointerIcon(const SpriteIcon& icon); void setDisplayViewport(int32_t width, int32_t height, int32_t orientation); void setInactivityTimeout(InactivityTimeout inactivityTimeout); @@ -180,7 +180,7 @@ private: std::map additionalMouseResources; std::map animationResources; - int32_t requestedPointerShape; + int32_t requestedPointerType; int32_t buttonState; diff --git a/packages/SystemUI/res/layout/global_screenshot.xml b/packages/SystemUI/res/layout/global_screenshot.xml index c1fe1a806d113..59952e09555fd 100644 --- a/packages/SystemUI/res/layout/global_screenshot.xml +++ b/packages/SystemUI/res/layout/global_screenshot.xml @@ -38,5 +38,5 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" - android:pointerShape="crosshair"/> + android:pointerIcon="crosshair"/> diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 3fc66dd2f62bb..6e78def2b45e5 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -16,8 +16,8 @@ package com.android.systemui.stackdivider; -import static android.view.PointerIcon.STYLE_HORIZONTAL_DOUBLE_ARROW; -import static android.view.PointerIcon.STYLE_VERTICAL_DOUBLE_ARROW; +import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW; +import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -266,7 +266,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, boolean landscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; mHandle.setPointerIcon(PointerIcon.getSystemIcon(getContext(), - landscape ? STYLE_HORIZONTAL_DOUBLE_ARROW : STYLE_VERTICAL_DOUBLE_ARROW)); + landscape ? TYPE_HORIZONTAL_DOUBLE_ARROW : TYPE_VERTICAL_DOUBLE_ARROW)); getViewTreeObserver().addOnComputeInternalInsetsListener(this); mHandle.setAccessibilityDelegate(mHandleDelegate); mGestureDetector = new GestureDetector(mContext, new SimpleOnGestureListener() { diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index c64901235ebcd..b54f839ced304 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -219,7 +219,7 @@ public class InputManagerService extends IInputManager.Stub private static native void nativeReloadDeviceAliases(long ptr); private static native String nativeDump(long ptr); private static native void nativeMonitor(long ptr); - private static native void nativeSetPointerIconShape(long ptr, int iconId); + private static native void nativeSetPointerIconType(long ptr, int iconId); private static native void nativeReloadPointerIcons(long ptr); private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon); private static native void nativeSetPointerIconDetached(long ptr, boolean detached); @@ -1691,8 +1691,8 @@ public class InputManagerService extends IInputManager.Stub // Binder call @Override - public void setPointerIconShape(int iconId) { - nativeSetPointerIconShape(mPtr, iconId); + public void setPointerIconType(int iconId) { + nativeSetPointerIconType(mPtr, iconId); } // Binder call diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java index 0539b05fa8466..c4eca08bb5614 100644 --- a/services/core/java/com/android/server/wm/DragState.java +++ b/services/core/java/com/android/server/wm/DragState.java @@ -584,7 +584,7 @@ class DragState { void overridePointerIconLw(int touchSource) { mTouchSource = touchSource; if (isFromSource(InputDevice.SOURCE_MOUSE)) { - InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_GRABBING); + InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_GRABBING); } } } diff --git a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java index 3dc512f442246..fb556d23cdd3d 100644 --- a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java +++ b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java @@ -26,12 +26,12 @@ import android.view.WindowManagerPolicy.PointerEventListener; import com.android.server.wm.WindowManagerService.H; -import static android.view.PointerIcon.STYLE_NOT_SPECIFIED; -import static android.view.PointerIcon.STYLE_DEFAULT; -import static android.view.PointerIcon.STYLE_HORIZONTAL_DOUBLE_ARROW; -import static android.view.PointerIcon.STYLE_VERTICAL_DOUBLE_ARROW; -import static android.view.PointerIcon.STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW; -import static android.view.PointerIcon.STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW; +import static android.view.PointerIcon.TYPE_NOT_SPECIFIED; +import static android.view.PointerIcon.TYPE_DEFAULT; +import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW; +import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; +import static android.view.PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW; +import static android.view.PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW; public class TaskTapPointerEventListener implements PointerEventListener { @@ -43,7 +43,7 @@ public class TaskTapPointerEventListener implements PointerEventListener { private boolean mTwoFingerScrolling; private boolean mInGestureDetection; private GestureDetector mGestureDetector; - private int mPointerIconShape = STYLE_NOT_SPECIFIED; + private int mPointerIconType = TYPE_NOT_SPECIFIED; public TaskTapPointerEventListener(WindowManagerService service, DisplayContent displayContent) { @@ -91,39 +91,39 @@ public class TaskTapPointerEventListener implements PointerEventListener { final Task task = mDisplayContent.findTaskForControlPoint(x, y); InputDevice inputDevice = motionEvent.getDevice(); if (task == null || inputDevice == null) { - mPointerIconShape = STYLE_NOT_SPECIFIED; + mPointerIconType = TYPE_NOT_SPECIFIED; break; } task.getDimBounds(mTmpRect); if (!mTmpRect.isEmpty() && !mTmpRect.contains(x, y)) { - int iconShape = STYLE_DEFAULT; + int iconType = TYPE_DEFAULT; if (x < mTmpRect.left) { - iconShape = - (y < mTmpRect.top) ? STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW : - (y > mTmpRect.bottom) ? STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW : - STYLE_HORIZONTAL_DOUBLE_ARROW; + iconType = + (y < mTmpRect.top) ? TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW : + (y > mTmpRect.bottom) ? TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW : + TYPE_HORIZONTAL_DOUBLE_ARROW; } else if (x > mTmpRect.right) { - iconShape = - (y < mTmpRect.top) ? STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW : - (y > mTmpRect.bottom) ? STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW : - STYLE_HORIZONTAL_DOUBLE_ARROW; + iconType = + (y < mTmpRect.top) ? TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW : + (y > mTmpRect.bottom) ? TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW : + TYPE_HORIZONTAL_DOUBLE_ARROW; } else if (y < mTmpRect.top || y > mTmpRect.bottom) { - iconShape = STYLE_VERTICAL_DOUBLE_ARROW; + iconType = TYPE_VERTICAL_DOUBLE_ARROW; } - if (mPointerIconShape != iconShape) { - mPointerIconShape = iconShape; - inputDevice.setPointerShape(iconShape); + if (mPointerIconType != iconType) { + mPointerIconType = iconType; + inputDevice.setPointerType(iconType); } } else { - mPointerIconShape = STYLE_NOT_SPECIFIED; + mPointerIconType = TYPE_NOT_SPECIFIED; } } break; case MotionEvent.ACTION_HOVER_EXIT: - mPointerIconShape = STYLE_NOT_SPECIFIED; + mPointerIconType = TYPE_NOT_SPECIFIED; InputDevice inputDevice = motionEvent.getDevice(); if (inputDevice != null) { - inputDevice.setPointerShape(STYLE_DEFAULT); + inputDevice.setPointerType(TYPE_DEFAULT); } break; diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 239cc8eaae8cd..1dd86a6a893f2 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -11085,7 +11085,7 @@ public class WindowManagerService extends IWindowManager.Stub Slog.w(TAG_WM, "unable to restore pointer icon"); } } else { - InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_DEFAULT); + InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_DEFAULT); } } diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index cd485c55c816b..2e82cec7e9d9b 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -204,7 +204,7 @@ public: void setShowTouches(bool enabled); void setInteractive(bool interactive); void reloadCalibration(); - void setPointerIconShape(int32_t iconId); + void setPointerIconType(int32_t iconId); void reloadPointerIcons(); void setCustomPointerIcon(const SpriteIcon& icon); void setPointerIconDetached(bool detached); @@ -785,11 +785,11 @@ void NativeInputManager::reloadCalibration() { InputReaderConfiguration::CHANGE_TOUCH_AFFINE_TRANSFORMATION); } -void NativeInputManager::setPointerIconShape(int32_t iconId) { +void NativeInputManager::setPointerIconType(int32_t iconId) { AutoMutex _l(mLock); sp controller = mLocked.pointerController.promote(); if (controller != NULL) { - controller->updatePointerShape(iconId); + controller->updatePointerIcon(iconId); } } @@ -1462,9 +1462,9 @@ static void nativeMonitor(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { im->getInputManager()->getDispatcher()->monitor(); } -static void nativeSetPointerIconShape(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jint iconId) { +static void nativeSetPointerIconType(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jint iconId) { NativeInputManager* im = reinterpret_cast(ptr); - im->setPointerIconShape(iconId); + im->setPointerIconType(iconId); } static void nativeReloadPointerIcons(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { @@ -1548,8 +1548,8 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativeDump }, { "nativeMonitor", "(J)V", (void*) nativeMonitor }, - { "nativeSetPointerIconShape", "(JI)V", - (void*) nativeSetPointerIconShape }, + { "nativeSetPointerIconType", "(JI)V", + (void*) nativeSetPointerIconType }, { "nativeReloadPointerIcons", "(J)V", (void*) nativeReloadPointerIcons }, { "nativeSetCustomPointerIcon", "(JLandroid/view/PointerIcon;)V",