Loading core/java/android/view/ViewRootImpl.java +2 −0 Original line number Diff line number Diff line Loading @@ -4192,6 +4192,8 @@ public final class ViewRootImpl implements ViewParent, mPointerIconShape = pointerShape; event.getDevice().setPointerShape(pointerShape); } } else if (event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE) { mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED; } } Loading services/core/java/com/android/server/wm/TaskTapPointerEventListener.java +47 −0 Original line number Diff line number Diff line Loading @@ -16,13 +16,22 @@ package com.android.server.wm; import android.graphics.Rect; import android.graphics.Region; import android.view.DisplayInfo; import android.view.InputDevice; import android.view.MotionEvent; 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; public class TaskTapPointerEventListener implements PointerEventListener { private static final int TAP_TIMEOUT_MSEC = 300; private static final float TAP_MOTION_SLOP_INCHES = 0.125f; Loading @@ -34,6 +43,8 @@ public class TaskTapPointerEventListener implements PointerEventListener { final private Region mTouchExcludeRegion = new Region(); private final WindowManagerService mService; private final DisplayContent mDisplayContent; private final Rect mTmpRect = new Rect(); private int mPointerIconShape = STYLE_NOT_SPECIFIED; public TaskTapPointerEventListener(WindowManagerService service, DisplayContent displayContent) { Loading Loading @@ -76,6 +87,42 @@ public class TaskTapPointerEventListener implements PointerEventListener { break; } case MotionEvent.ACTION_HOVER_MOVE: { final int x = (int) motionEvent.getX(); final int y = (int) motionEvent.getY(); final WindowState window = mDisplayContent.findWindowForControlPoint(x, y); if (window == null) { break; } window.getVisibleBounds(mTmpRect, false); if (!mTmpRect.isEmpty() && !mTmpRect.contains(x, y)) { int iconShape = STYLE_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; } 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; } else if (y < mTmpRect.top || y > mTmpRect.bottom) { iconShape = STYLE_VERTICAL_DOUBLE_ARROW; } if (mPointerIconShape != iconShape) { mPointerIconShape = iconShape; motionEvent.getDevice().setPointerShape(iconShape); } } else { mPointerIconShape = STYLE_NOT_SPECIFIED; } } break; case MotionEvent.ACTION_HOVER_EXIT: motionEvent.getDevice().setPointerShape(STYLE_DEFAULT); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: { int index = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) Loading Loading
core/java/android/view/ViewRootImpl.java +2 −0 Original line number Diff line number Diff line Loading @@ -4192,6 +4192,8 @@ public final class ViewRootImpl implements ViewParent, mPointerIconShape = pointerShape; event.getDevice().setPointerShape(pointerShape); } } else if (event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE) { mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED; } } Loading
services/core/java/com/android/server/wm/TaskTapPointerEventListener.java +47 −0 Original line number Diff line number Diff line Loading @@ -16,13 +16,22 @@ package com.android.server.wm; import android.graphics.Rect; import android.graphics.Region; import android.view.DisplayInfo; import android.view.InputDevice; import android.view.MotionEvent; 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; public class TaskTapPointerEventListener implements PointerEventListener { private static final int TAP_TIMEOUT_MSEC = 300; private static final float TAP_MOTION_SLOP_INCHES = 0.125f; Loading @@ -34,6 +43,8 @@ public class TaskTapPointerEventListener implements PointerEventListener { final private Region mTouchExcludeRegion = new Region(); private final WindowManagerService mService; private final DisplayContent mDisplayContent; private final Rect mTmpRect = new Rect(); private int mPointerIconShape = STYLE_NOT_SPECIFIED; public TaskTapPointerEventListener(WindowManagerService service, DisplayContent displayContent) { Loading Loading @@ -76,6 +87,42 @@ public class TaskTapPointerEventListener implements PointerEventListener { break; } case MotionEvent.ACTION_HOVER_MOVE: { final int x = (int) motionEvent.getX(); final int y = (int) motionEvent.getY(); final WindowState window = mDisplayContent.findWindowForControlPoint(x, y); if (window == null) { break; } window.getVisibleBounds(mTmpRect, false); if (!mTmpRect.isEmpty() && !mTmpRect.contains(x, y)) { int iconShape = STYLE_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; } 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; } else if (y < mTmpRect.top || y > mTmpRect.bottom) { iconShape = STYLE_VERTICAL_DOUBLE_ARROW; } if (mPointerIconShape != iconShape) { mPointerIconShape = iconShape; motionEvent.getDevice().setPointerShape(iconShape); } } else { mPointerIconShape = STYLE_NOT_SPECIFIED; } } break; case MotionEvent.ACTION_HOVER_EXIT: motionEvent.getDevice().setPointerShape(STYLE_DEFAULT); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: { int index = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) Loading