Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -36284,6 +36284,7 @@ package android.view { method public boolean canResolveTextDirection(); method public boolean canScrollHorizontally(int); method public boolean canScrollVertically(int); method public final void cancelDragAndDrop(); method public void cancelLongPress(); method public final void cancelPendingInputEvents(); method public boolean checkInputConnectionProxy(android.view.View); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -38607,6 +38607,7 @@ package android.view { method public boolean canResolveTextDirection(); method public boolean canScrollHorizontally(int); method public boolean canScrollVertically(int); method public final void cancelDragAndDrop(); method public void cancelLongPress(); method public final void cancelPendingInputEvents(); method public boolean checkInputConnectionProxy(android.view.View); core/java/android/view/IWindowSession.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ interface IWindowSession { */ void reportDropResult(IWindow window, boolean consumed); /** * Cancel the current drag operation. */ void cancelDragAndDrop(IBinder dragToken); /** * Tell the OS that we've just dragged into a View that is willing to accept the drop */ Loading core/java/android/view/View.java +43 −5 Original line number Diff line number Diff line Loading @@ -19980,11 +19980,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } Surface surface = new Surface(); try { IBinder token = mAttachInfo.mSession.prepareDrag(mAttachInfo.mWindow, mAttachInfo.mDragToken = mAttachInfo.mSession.prepareDrag(mAttachInfo.mWindow, flags, shadowSize.x, shadowSize.y, surface); if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "prepareDrag returned token=" + token + " surface=" + surface); if (token != null) { if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "prepareDrag returned token=" + mAttachInfo.mDragToken + " surface=" + surface); if (mAttachInfo.mDragToken != null) { Canvas canvas = surface.lockCanvas(null); try { canvas.drawColor(0, PorterDuff.Mode.CLEAR); Loading @@ -20001,7 +20001,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // repurpose 'shadowSize' for the last touch point root.getLastTouchPoint(shadowSize); okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, token, okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, mAttachInfo.mDragToken, shadowSize.x, shadowSize.y, shadowTouchPoint.x, shadowTouchPoint.y, data); if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "performDrag returned " + okay); Loading @@ -20018,6 +20018,39 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return okay; } /** * Cancels an ongoing drag and drop operation. * <p> * A {@link android.view.DragEvent} object with * {@link android.view.DragEvent#getAction()} value of * {@link android.view.DragEvent#ACTION_DRAG_ENDED} and * {@link android.view.DragEvent#getResult()} value of {@code false} * will be sent to every * View that received {@link android.view.DragEvent#ACTION_DRAG_STARTED} * even if they are not currently visible. * </p> * <p> * This method can be called on any View in the same window as the View on which * {@link #startDragAndDrop(ClipData, DragShadowBuilder, Object, int) startDragAndDrop} * was called. * </p> */ public final void cancelDragAndDrop() { if (ViewDebug.DEBUG_DRAG) { Log.d(VIEW_LOG_TAG, "cancelDragAndDrop"); } if (mAttachInfo.mDragToken != null) { try { mAttachInfo.mSession.cancelDragAndDrop(mAttachInfo.mDragToken); } catch (Exception e) { Log.e(VIEW_LOG_TAG, "Unable to cancel drag", e); } mAttachInfo.mDragToken = null; } else { Log.e(VIEW_LOG_TAG, "No active drag to cancel"); } } /** * Starts a move from {startX, startY}, the amount of the movement will be the offset * between {startX, startY} and the new cursor positon. Loading Loading @@ -22303,6 +22336,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ final List<View> mPartialLayoutViews = new ArrayList<View>(); /** * Used to track the identity of the current drag operation. */ IBinder mDragToken; /** * Creates a new set of attachment information with the specified * events handler and thread. core/java/android/view/ViewRootImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -5372,10 +5372,10 @@ public final class ViewRootImpl implements ViewParent, } } // When the drag operation ends, release any local state object // that may have been in use // When the drag operation ends, reset drag-related state if (what == DragEvent.ACTION_DRAG_ENDED) { setLocalDragState(null); mAttachInfo.mDragToken = null; } } } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -36284,6 +36284,7 @@ package android.view { method public boolean canResolveTextDirection(); method public boolean canScrollHorizontally(int); method public boolean canScrollVertically(int); method public final void cancelDragAndDrop(); method public void cancelLongPress(); method public final void cancelPendingInputEvents(); method public boolean checkInputConnectionProxy(android.view.View);
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -38607,6 +38607,7 @@ package android.view { method public boolean canResolveTextDirection(); method public boolean canScrollHorizontally(int); method public boolean canScrollVertically(int); method public final void cancelDragAndDrop(); method public void cancelLongPress(); method public final void cancelPendingInputEvents(); method public boolean checkInputConnectionProxy(android.view.View);
core/java/android/view/IWindowSession.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ interface IWindowSession { */ void reportDropResult(IWindow window, boolean consumed); /** * Cancel the current drag operation. */ void cancelDragAndDrop(IBinder dragToken); /** * Tell the OS that we've just dragged into a View that is willing to accept the drop */ Loading
core/java/android/view/View.java +43 −5 Original line number Diff line number Diff line Loading @@ -19980,11 +19980,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } Surface surface = new Surface(); try { IBinder token = mAttachInfo.mSession.prepareDrag(mAttachInfo.mWindow, mAttachInfo.mDragToken = mAttachInfo.mSession.prepareDrag(mAttachInfo.mWindow, flags, shadowSize.x, shadowSize.y, surface); if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "prepareDrag returned token=" + token + " surface=" + surface); if (token != null) { if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "prepareDrag returned token=" + mAttachInfo.mDragToken + " surface=" + surface); if (mAttachInfo.mDragToken != null) { Canvas canvas = surface.lockCanvas(null); try { canvas.drawColor(0, PorterDuff.Mode.CLEAR); Loading @@ -20001,7 +20001,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // repurpose 'shadowSize' for the last touch point root.getLastTouchPoint(shadowSize); okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, token, okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, mAttachInfo.mDragToken, shadowSize.x, shadowSize.y, shadowTouchPoint.x, shadowTouchPoint.y, data); if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "performDrag returned " + okay); Loading @@ -20018,6 +20018,39 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return okay; } /** * Cancels an ongoing drag and drop operation. * <p> * A {@link android.view.DragEvent} object with * {@link android.view.DragEvent#getAction()} value of * {@link android.view.DragEvent#ACTION_DRAG_ENDED} and * {@link android.view.DragEvent#getResult()} value of {@code false} * will be sent to every * View that received {@link android.view.DragEvent#ACTION_DRAG_STARTED} * even if they are not currently visible. * </p> * <p> * This method can be called on any View in the same window as the View on which * {@link #startDragAndDrop(ClipData, DragShadowBuilder, Object, int) startDragAndDrop} * was called. * </p> */ public final void cancelDragAndDrop() { if (ViewDebug.DEBUG_DRAG) { Log.d(VIEW_LOG_TAG, "cancelDragAndDrop"); } if (mAttachInfo.mDragToken != null) { try { mAttachInfo.mSession.cancelDragAndDrop(mAttachInfo.mDragToken); } catch (Exception e) { Log.e(VIEW_LOG_TAG, "Unable to cancel drag", e); } mAttachInfo.mDragToken = null; } else { Log.e(VIEW_LOG_TAG, "No active drag to cancel"); } } /** * Starts a move from {startX, startY}, the amount of the movement will be the offset * between {startX, startY} and the new cursor positon. Loading Loading @@ -22303,6 +22336,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ final List<View> mPartialLayoutViews = new ArrayList<View>(); /** * Used to track the identity of the current drag operation. */ IBinder mDragToken; /** * Creates a new set of attachment information with the specified * events handler and thread.
core/java/android/view/ViewRootImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -5372,10 +5372,10 @@ public final class ViewRootImpl implements ViewParent, } } // When the drag operation ends, release any local state object // that may have been in use // When the drag operation ends, reset drag-related state if (what == DragEvent.ACTION_DRAG_ENDED) { setLocalDragState(null); mAttachInfo.mDragToken = null; } } } Loading