Loading core/java/android/view/IWindowSession.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -162,6 +162,8 @@ interface IWindowSession { * @param flags See {@code View#startDragAndDrop} * @param surface Surface containing drag shadow image * @param touchSource See {@code InputDevice#getSource()} * @param touchDeviceId device ID of last touch event * @param pointerId pointer ID of last touch event * @param touchX X coordinate of last touch point * @param touchY Y coordinate of last touch point * @param thumbCenterX X coordinate for the position within the shadow image that should be Loading @@ -171,9 +173,9 @@ interface IWindowSession { * @param data Data transferred by drag and drop * @return Token of drag operation which will be passed to cancelDragAndDrop. */ @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); /** * Drops the content of the current drag operation for accessibility Loading core/java/android/view/View.java +4 −1 Original line number Diff line number Diff line Loading @@ -28340,6 +28340,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, IBinder token = mAttachInfo.mSession.performDrag( mAttachInfo.mWindow, flags, null, mAttachInfo.mViewRootImpl.getLastTouchSource(), mAttachInfo.mViewRootImpl.getLastTouchDeviceId(), mAttachInfo.mViewRootImpl.getLastTouchPointerId(), 0f, 0f, 0f, 0f, data); if (ViewDebug.DEBUG_DRAG) { Log.d(VIEW_LOG_TAG, "startDragAndDrop via a11y action returned " + token); Loading Loading @@ -28414,7 +28416,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } token = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, flags, surfaceControl, root.getLastTouchSource(), lastTouchPoint.x, lastTouchPoint.y, root.getLastTouchSource(), root.getLastTouchDeviceId(), root.getLastTouchPointerId(), lastTouchPoint.x, lastTouchPoint.y, shadowTouchPoint.x, shadowTouchPoint.y, data); if (ViewDebug.DEBUG_DRAG) { Log.d(VIEW_LOG_TAG, "performDrag returned " + token); core/java/android/view/ViewRootImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -813,6 +813,8 @@ public final class ViewRootImpl implements ViewParent, final PointF mDragPoint = new PointF(); final PointF mLastTouchPoint = new PointF(); int mLastTouchSource; int mLastTouchDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; int mLastTouchPointerId; /** Tracks last {@link MotionEvent#getToolType(int)} with {@link MotionEvent#ACTION_UP}. **/ private int mLastClickToolType; Loading Loading @@ -7163,6 +7165,8 @@ public final class ViewRootImpl implements ViewParent, mLastTouchPoint.x = event.getRawX(); mLastTouchPoint.y = event.getRawY(); mLastTouchSource = event.getSource(); mLastTouchDeviceId = event.getDeviceId(); mLastTouchPointerId = event.getPointerId(0); // Register last ACTION_UP. This will be propagated to IME. if (event.getActionMasked() == MotionEvent.ACTION_UP) { Loading Loading @@ -8574,6 +8578,14 @@ public final class ViewRootImpl implements ViewParent, return mLastTouchSource; } public int getLastTouchDeviceId() { return mLastTouchDeviceId; } public int getLastTouchPointerId() { return mLastTouchPointerId; } /** * Used by InputMethodManager. * @hide Loading core/java/android/view/WindowlessWindowManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -489,8 +489,9 @@ public class WindowlessWindowManager implements IWindowSession { @Override public android.os.IBinder performDrag(android.view.IWindow window, int flags, android.view.SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, android.content.ClipData data) { android.view.SurfaceControl surface, int touchSource, int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, android.content.ClipData data) { return null; } Loading services/core/java/com/android/server/wm/DragDropController.java +17 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm; import static com.android.input.flags.Flags.enablePointerChoreographer; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DRAG; import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; Loading @@ -23,6 +24,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import android.annotation.NonNull; import android.content.ClipData; import android.content.Context; import android.hardware.input.InputManagerGlobal; import android.os.Binder; import android.os.Handler; import android.os.IBinder; Loading @@ -31,6 +33,8 @@ import android.os.Message; import android.util.Slog; import android.view.Display; import android.view.IWindow; import android.view.InputDevice; import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -97,8 +101,8 @@ class DragDropController { } IBinder performDrag(int callerPid, int callerUid, IWindow window, int flags, SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { SurfaceControl surface, int touchSource, int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "perform drag: win=" + window + " surface=" + surface + " flags=" + Integer.toHexString(flags) + " data=" + data + " touch(" + touchX + "," Loading Loading @@ -208,7 +212,17 @@ class DragDropController { final SurfaceControl surfaceControl = mDragState.mSurfaceControl; mDragState.broadcastDragStartedLocked(touchX, touchY); if (enablePointerChoreographer()) { if ((touchSource & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { InputManagerGlobal.getInstance().setPointerIcon( PointerIcon.getSystemIcon( mService.mContext, PointerIcon.TYPE_GRABBING), mDragState.mDisplayContent.getDisplayId(), touchDeviceId, touchPointerId, mDragState.getInputToken()); } } else { mDragState.overridePointerIconLocked(touchSource); } // remember the thumb offsets for later mDragState.mThumbOffsetX = thumbCenterX; mDragState.mThumbOffsetY = thumbCenterY; Loading Loading
core/java/android/view/IWindowSession.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -162,6 +162,8 @@ interface IWindowSession { * @param flags See {@code View#startDragAndDrop} * @param surface Surface containing drag shadow image * @param touchSource See {@code InputDevice#getSource()} * @param touchDeviceId device ID of last touch event * @param pointerId pointer ID of last touch event * @param touchX X coordinate of last touch point * @param touchY Y coordinate of last touch point * @param thumbCenterX X coordinate for the position within the shadow image that should be Loading @@ -171,9 +173,9 @@ interface IWindowSession { * @param data Data transferred by drag and drop * @return Token of drag operation which will be passed to cancelDragAndDrop. */ @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); /** * Drops the content of the current drag operation for accessibility Loading
core/java/android/view/View.java +4 −1 Original line number Diff line number Diff line Loading @@ -28340,6 +28340,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, IBinder token = mAttachInfo.mSession.performDrag( mAttachInfo.mWindow, flags, null, mAttachInfo.mViewRootImpl.getLastTouchSource(), mAttachInfo.mViewRootImpl.getLastTouchDeviceId(), mAttachInfo.mViewRootImpl.getLastTouchPointerId(), 0f, 0f, 0f, 0f, data); if (ViewDebug.DEBUG_DRAG) { Log.d(VIEW_LOG_TAG, "startDragAndDrop via a11y action returned " + token); Loading Loading @@ -28414,7 +28416,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } token = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, flags, surfaceControl, root.getLastTouchSource(), lastTouchPoint.x, lastTouchPoint.y, root.getLastTouchSource(), root.getLastTouchDeviceId(), root.getLastTouchPointerId(), lastTouchPoint.x, lastTouchPoint.y, shadowTouchPoint.x, shadowTouchPoint.y, data); if (ViewDebug.DEBUG_DRAG) { Log.d(VIEW_LOG_TAG, "performDrag returned " + token);
core/java/android/view/ViewRootImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -813,6 +813,8 @@ public final class ViewRootImpl implements ViewParent, final PointF mDragPoint = new PointF(); final PointF mLastTouchPoint = new PointF(); int mLastTouchSource; int mLastTouchDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; int mLastTouchPointerId; /** Tracks last {@link MotionEvent#getToolType(int)} with {@link MotionEvent#ACTION_UP}. **/ private int mLastClickToolType; Loading Loading @@ -7163,6 +7165,8 @@ public final class ViewRootImpl implements ViewParent, mLastTouchPoint.x = event.getRawX(); mLastTouchPoint.y = event.getRawY(); mLastTouchSource = event.getSource(); mLastTouchDeviceId = event.getDeviceId(); mLastTouchPointerId = event.getPointerId(0); // Register last ACTION_UP. This will be propagated to IME. if (event.getActionMasked() == MotionEvent.ACTION_UP) { Loading Loading @@ -8574,6 +8578,14 @@ public final class ViewRootImpl implements ViewParent, return mLastTouchSource; } public int getLastTouchDeviceId() { return mLastTouchDeviceId; } public int getLastTouchPointerId() { return mLastTouchPointerId; } /** * Used by InputMethodManager. * @hide Loading
core/java/android/view/WindowlessWindowManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -489,8 +489,9 @@ public class WindowlessWindowManager implements IWindowSession { @Override public android.os.IBinder performDrag(android.view.IWindow window, int flags, android.view.SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, android.content.ClipData data) { android.view.SurfaceControl surface, int touchSource, int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, android.content.ClipData data) { return null; } Loading
services/core/java/com/android/server/wm/DragDropController.java +17 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm; import static com.android.input.flags.Flags.enablePointerChoreographer; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DRAG; import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; Loading @@ -23,6 +24,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import android.annotation.NonNull; import android.content.ClipData; import android.content.Context; import android.hardware.input.InputManagerGlobal; import android.os.Binder; import android.os.Handler; import android.os.IBinder; Loading @@ -31,6 +33,8 @@ import android.os.Message; import android.util.Slog; import android.view.Display; import android.view.IWindow; import android.view.InputDevice; import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -97,8 +101,8 @@ class DragDropController { } IBinder performDrag(int callerPid, int callerUid, IWindow window, int flags, SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { SurfaceControl surface, int touchSource, int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "perform drag: win=" + window + " surface=" + surface + " flags=" + Integer.toHexString(flags) + " data=" + data + " touch(" + touchX + "," Loading Loading @@ -208,7 +212,17 @@ class DragDropController { final SurfaceControl surfaceControl = mDragState.mSurfaceControl; mDragState.broadcastDragStartedLocked(touchX, touchY); if (enablePointerChoreographer()) { if ((touchSource & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { InputManagerGlobal.getInstance().setPointerIcon( PointerIcon.getSystemIcon( mService.mContext, PointerIcon.TYPE_GRABBING), mDragState.mDisplayContent.getDisplayId(), touchDeviceId, touchPointerId, mDragState.getInputToken()); } } else { mDragState.overridePointerIconLocked(touchSource); } // remember the thumb offsets for later mDragState.mThumbOffsetX = thumbCenterX; mDragState.mThumbOffsetY = thumbCenterY; Loading