Do not update pointer icon shape for HOVER_EXIT event.
EXIT event does not have to udpate the pointer icon shape, because
when it immediately moves to another window, its HOVER_ENTER will
handle the icon shape.
Also HOVER_EXIT can happen after the HOVER_ENTER of the new window,
and in that case updating pointer icon at HOVER_EXIT will overwrite
the pointer icon for the new window.
Bug: 24415739
Change-Id: I08fc72cc69bbc3a6eef36d501d93e8e9ad36df85
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 6a1d9d5..7d39a0c 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -4182,7 +4182,8 @@
final float x = event.getX();
final float y = event.getY();
- if (x >= 0 && x < mView.getWidth() && y >= 0 && y < mView.getHeight()) {
+ if (event.getActionMasked() != MotionEvent.ACTION_HOVER_EXIT
+ && x >= 0 && x < mView.getWidth() && y >= 0 && y < mView.getHeight()) {
int pointerShape = mView.getPointerShape(event, x, y);
if (pointerShape == PointerIcon.STYLE_NOT_SPECIFIED) {
pointerShape = PointerIcon.STYLE_DEFAULT;