Loading core/java/android/view/IWindowSession.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -186,8 +186,8 @@ interface IWindowSession { /** * Initiate the drag operation itself */ boolean performDrag(IWindow window, IBinder dragToken, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); boolean performDrag(IWindow window, IBinder dragToken, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); /** * Report the result of a drop action targeted to the given window. Loading core/java/android/view/View.java +1 −1 Original line number Diff line number Diff line Loading @@ -20059,7 +20059,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, root.getLastTouchPoint(shadowSize); okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, mAttachInfo.mDragToken, shadowSize.x, shadowSize.y, root.getLastTouchSource(), shadowSize.x, shadowSize.y, shadowTouchPoint.x, shadowTouchPoint.y, data); if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "performDrag returned " + okay); } core/java/android/view/ViewRootImpl.java +6 −0 Original line number Diff line number Diff line Loading @@ -339,6 +339,7 @@ public final class ViewRootImpl implements ViewParent, volatile Object mLocalDragState; final PointF mDragPoint = new PointF(); final PointF mLastTouchPoint = new PointF(); int mLastTouchSource; private boolean mProfileRendering; private Choreographer.FrameCallback mRenderProfiler; Loading Loading @@ -4122,6 +4123,7 @@ public final class ViewRootImpl implements ViewParent, if (event.isTouchEvent()) { mLastTouchPoint.x = event.getRawX(); mLastTouchPoint.y = event.getRawY(); mLastTouchSource = event.getSource(); } return FORWARD; } Loading Loading @@ -5475,6 +5477,10 @@ public final class ViewRootImpl implements ViewParent, outLocation.y = (int) mLastTouchPoint.y; } public int getLastTouchSource() { return mLastTouchSource; } public void setDragFocus(View newDragTarget) { if (mCurrentDragView != newDragTarget) { mCurrentDragView = newDragTarget; Loading services/core/java/com/android/server/wm/DragState.java +22 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Region; import android.hardware.input.InputManager; import android.os.IBinder; import android.os.Message; import android.os.Process; Loading @@ -36,6 +37,8 @@ import android.util.Slog; import android.view.Display; import android.view.DragEvent; import android.view.InputChannel; import android.view.InputDevice; import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.WindowManager; Loading Loading @@ -72,6 +75,7 @@ class DragState { int mUid; ClipData mData; ClipDescription mDataDescription; int mTouchSource; boolean mDragResult; float mOriginalAlpha; float mOriginalX, mOriginalY; Loading Loading @@ -342,6 +346,7 @@ class DragState { private void cleanUpDragLw() { broadcastDragEndedLw(); restorePointerIconLw(); // stop intercepting input unregister(); Loading Loading @@ -576,4 +581,21 @@ class DragState { set.start(); // Will start on the first call to getTransformation. return set; } private boolean isFromSource(int source) { return (mTouchSource & source) == source; } void overridePointerIconLw(int touchSource) { mTouchSource = touchSource; if (isFromSource(InputDevice.SOURCE_MOUSE)) { InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_GRAB); } } private void restorePointerIconLw() { if (isFromSource(InputDevice.SOURCE_MOUSE)) { InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_DEFAULT); } } } services/core/java/com/android/server/wm/Session.java +2 −1 Original line number Diff line number Diff line Loading @@ -283,7 +283,7 @@ final class Session extends IWindowSession.Stub } public boolean performDrag(IWindow window, IBinder dragToken, float touchX, float touchY, float thumbCenterX, float thumbCenterY, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "perform drag: win=" + window + " data=" + data); Loading Loading @@ -336,6 +336,7 @@ final class Session extends IWindowSession.Stub mService.mDragState.mData = data; mService.mDragState.broadcastDragStartedLw(touchX, touchY); mService.mDragState.overridePointerIconLw(touchSource); // remember the thumb offsets for later mService.mDragState.mThumbOffsetX = thumbCenterX; Loading Loading
core/java/android/view/IWindowSession.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -186,8 +186,8 @@ interface IWindowSession { /** * Initiate the drag operation itself */ boolean performDrag(IWindow window, IBinder dragToken, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); boolean performDrag(IWindow window, IBinder dragToken, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); /** * Report the result of a drop action targeted to the given window. Loading
core/java/android/view/View.java +1 −1 Original line number Diff line number Diff line Loading @@ -20059,7 +20059,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, root.getLastTouchPoint(shadowSize); okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, mAttachInfo.mDragToken, shadowSize.x, shadowSize.y, root.getLastTouchSource(), shadowSize.x, shadowSize.y, shadowTouchPoint.x, shadowTouchPoint.y, data); if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "performDrag returned " + okay); }
core/java/android/view/ViewRootImpl.java +6 −0 Original line number Diff line number Diff line Loading @@ -339,6 +339,7 @@ public final class ViewRootImpl implements ViewParent, volatile Object mLocalDragState; final PointF mDragPoint = new PointF(); final PointF mLastTouchPoint = new PointF(); int mLastTouchSource; private boolean mProfileRendering; private Choreographer.FrameCallback mRenderProfiler; Loading Loading @@ -4122,6 +4123,7 @@ public final class ViewRootImpl implements ViewParent, if (event.isTouchEvent()) { mLastTouchPoint.x = event.getRawX(); mLastTouchPoint.y = event.getRawY(); mLastTouchSource = event.getSource(); } return FORWARD; } Loading Loading @@ -5475,6 +5477,10 @@ public final class ViewRootImpl implements ViewParent, outLocation.y = (int) mLastTouchPoint.y; } public int getLastTouchSource() { return mLastTouchSource; } public void setDragFocus(View newDragTarget) { if (mCurrentDragView != newDragTarget) { mCurrentDragView = newDragTarget; Loading
services/core/java/com/android/server/wm/DragState.java +22 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Region; import android.hardware.input.InputManager; import android.os.IBinder; import android.os.Message; import android.os.Process; Loading @@ -36,6 +37,8 @@ import android.util.Slog; import android.view.Display; import android.view.DragEvent; import android.view.InputChannel; import android.view.InputDevice; import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.WindowManager; Loading Loading @@ -72,6 +75,7 @@ class DragState { int mUid; ClipData mData; ClipDescription mDataDescription; int mTouchSource; boolean mDragResult; float mOriginalAlpha; float mOriginalX, mOriginalY; Loading Loading @@ -342,6 +346,7 @@ class DragState { private void cleanUpDragLw() { broadcastDragEndedLw(); restorePointerIconLw(); // stop intercepting input unregister(); Loading Loading @@ -576,4 +581,21 @@ class DragState { set.start(); // Will start on the first call to getTransformation. return set; } private boolean isFromSource(int source) { return (mTouchSource & source) == source; } void overridePointerIconLw(int touchSource) { mTouchSource = touchSource; if (isFromSource(InputDevice.SOURCE_MOUSE)) { InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_GRAB); } } private void restorePointerIconLw() { if (isFromSource(InputDevice.SOURCE_MOUSE)) { InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_DEFAULT); } } }
services/core/java/com/android/server/wm/Session.java +2 −1 Original line number Diff line number Diff line Loading @@ -283,7 +283,7 @@ final class Session extends IWindowSession.Stub } public boolean performDrag(IWindow window, IBinder dragToken, float touchX, float touchY, float thumbCenterX, float thumbCenterY, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "perform drag: win=" + window + " data=" + data); Loading Loading @@ -336,6 +336,7 @@ final class Session extends IWindowSession.Stub mService.mDragState.mData = data; mService.mDragState.broadcastDragStartedLw(touchX, touchY); mService.mDragState.overridePointerIconLw(touchSource); // remember the thumb offsets for later mService.mDragState.mThumbOffsetX = thumbCenterX; Loading