Loading core/java/android/view/ViewRootImpl.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -8571,6 +8571,17 @@ public final class ViewRootImpl implements ViewParent, dispatchPointerCaptureChanged(pointerCaptureEnabled); dispatchPointerCaptureChanged(pointerCaptureEnabled); } } @Override public void onDragEvent(boolean isExiting, float x, float y) { // force DRAG_EXITED_EVENT if appropriate DragEvent event = DragEvent.obtain( isExiting ? DragEvent.ACTION_DRAG_EXITED : DragEvent.ACTION_DRAG_LOCATION, x, y, 0 /* offsetX */, 0 /* offsetY */, null/* localState */, null/* description */, null /* data */, null /* dragSurface */, null /* dragAndDropPermissions */, false /* result */); dispatchDragEvent(event); } @Override @Override public void dispose() { public void dispose() { unscheduleConsumeBatchedInput(); unscheduleConsumeBatchedInput(); Loading services/core/java/com/android/server/input/InputManagerService.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -304,7 +304,7 @@ public class InputManagerService extends IInputManager.Stub int displayId, InputApplicationHandle application); int displayId, InputApplicationHandle application); private static native void nativeSetFocusedDisplay(long ptr, int displayId); private static native void nativeSetFocusedDisplay(long ptr, int displayId); private static native boolean nativeTransferTouchFocus(long ptr, private static native boolean nativeTransferTouchFocus(long ptr, IBinder fromChannelToken, IBinder toChannelToken); IBinder fromChannelToken, IBinder toChannelToken, boolean isDragDrop); private static native void nativeSetPointerSpeed(long ptr, int speed); private static native void nativeSetPointerSpeed(long ptr, int speed); private static native void nativeSetShowTouches(long ptr, boolean enabled); private static native void nativeSetShowTouches(long ptr, boolean enabled); private static native void nativeSetInteractive(long ptr, boolean interactive); private static native void nativeSetInteractive(long ptr, boolean interactive); Loading Loading @@ -1727,12 +1727,14 @@ public class InputManagerService extends IInputManager.Stub * @param fromChannel The channel of a window that currently has touch focus. * @param fromChannel The channel of a window that currently has touch focus. * @param toChannel The channel of the window that should receive touch focus in * @param toChannel The channel of the window that should receive touch focus in * place of the first. * place of the first. * @param isDragDrop True if transfer touch focus for drag and drop. * @return True if the transfer was successful. False if the window with the * @return True if the transfer was successful. False if the window with the * specified channel did not actually have touch focus at the time of the request. * specified channel did not actually have touch focus at the time of the request. */ */ public boolean transferTouchFocus(@NonNull InputChannel fromChannel, public boolean transferTouchFocus(@NonNull InputChannel fromChannel, @NonNull InputChannel toChannel) { @NonNull InputChannel toChannel, boolean isDragDrop) { return nativeTransferTouchFocus(mPtr, fromChannel.getToken(), toChannel.getToken()); return nativeTransferTouchFocus(mPtr, fromChannel.getToken(), toChannel.getToken(), isDragDrop); } } /** /** Loading @@ -1752,7 +1754,8 @@ public class InputManagerService extends IInputManager.Stub @NonNull IBinder toChannelToken) { @NonNull IBinder toChannelToken) { Objects.nonNull(fromChannelToken); Objects.nonNull(fromChannelToken); Objects.nonNull(toChannelToken); Objects.nonNull(toChannelToken); return nativeTransferTouchFocus(mPtr, fromChannelToken, toChannelToken); return nativeTransferTouchFocus(mPtr, fromChannelToken, toChannelToken, false /* isDragDrop */); } } @Override // Binder call @Override // Binder call Loading services/core/java/com/android/server/wm/DragDropController.java +0 −2 Original line number Original line Diff line number Diff line Loading @@ -182,8 +182,6 @@ class DragDropController { if (SHOW_LIGHT_TRANSACTIONS) { if (SHOW_LIGHT_TRANSACTIONS) { Slog.i(TAG_WM, "<<< CLOSE TRANSACTION performDrag"); Slog.i(TAG_WM, "<<< CLOSE TRANSACTION performDrag"); } } mDragState.notifyLocationLocked(touchX, touchY); } finally { } finally { if (surface != null) { if (surface != null) { surface.release(); surface.release(); Loading services/core/java/com/android/server/wm/DragState.java +0 −44 Original line number Original line Diff line number Diff line Loading @@ -515,50 +515,6 @@ class DragState { mTransaction.setPosition(mSurfaceControl, x - mThumbOffsetX, y - mThumbOffsetY).apply(); mTransaction.setPosition(mSurfaceControl, x - mThumbOffsetX, y - mThumbOffsetY).apply(); ProtoLog.i(WM_SHOW_TRANSACTIONS, "DRAG %s: pos=(%d,%d)", mSurfaceControl, ProtoLog.i(WM_SHOW_TRANSACTIONS, "DRAG %s: pos=(%d,%d)", mSurfaceControl, (int) (x - mThumbOffsetX), (int) (y - mThumbOffsetY)); (int) (x - mThumbOffsetX), (int) (y - mThumbOffsetY)); notifyLocationLocked(x, y); } void notifyLocationLocked(float x, float y) { // Tell the affected window WindowState touchedWin = mDisplayContent.getTouchableWinAtPointLocked(x, y); if (touchedWin != null && !isWindowNotified(touchedWin)) { // The drag point is over a window which was not notified about a drag start. // Pretend it's over empty space. touchedWin = null; } try { final int myPid = Process.myPid(); // have we dragged over a new window? if ((touchedWin != mTargetWindow) && (mTargetWindow != null)) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "sending DRAG_EXITED to " + mTargetWindow); } // force DRAG_EXITED_EVENT if appropriate DragEvent evt = obtainDragEvent(mTargetWindow, DragEvent.ACTION_DRAG_EXITED, 0, 0, 0, 0, null, null, null, null, null, false); mTargetWindow.mClient.dispatchDragEvent(evt); if (myPid != mTargetWindow.mSession.mPid) { evt.recycle(); } } if (touchedWin != null) { if (false && DEBUG_DRAG) { Slog.d(TAG_WM, "sending DRAG_LOCATION to " + touchedWin); } DragEvent evt = obtainDragEvent(touchedWin, DragEvent.ACTION_DRAG_LOCATION, x, y, mThumbOffsetX, mThumbOffsetY, null, null, null, null, null, false); touchedWin.mClient.dispatchDragEvent(evt); if (myPid != touchedWin.mSession.mPid) { evt.recycle(); } } } catch (RemoteException e) { Slog.w(TAG_WM, "can't send drag notification to windows"); } mTargetWindow = touchedWin; } } /** /** Loading services/core/java/com/android/server/wm/TaskPositioningController.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -188,7 +188,8 @@ class TaskPositioningController { transferFocusFromWin = displayContent.mCurrentFocus; transferFocusFromWin = displayContent.mCurrentFocus; } } if (!mInputManager.transferTouchFocus( if (!mInputManager.transferTouchFocus( transferFocusFromWin.mInputChannel, mTaskPositioner.mClientChannel)) { transferFocusFromWin.mInputChannel, mTaskPositioner.mClientChannel, false /* isDragDrop */)) { Slog.e(TAG_WM, "startPositioningLocked: Unable to transfer touch focus"); Slog.e(TAG_WM, "startPositioningLocked: Unable to transfer touch focus"); cleanUpTaskPositioner(); cleanUpTaskPositioner(); return false; return false; Loading Loading
core/java/android/view/ViewRootImpl.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -8571,6 +8571,17 @@ public final class ViewRootImpl implements ViewParent, dispatchPointerCaptureChanged(pointerCaptureEnabled); dispatchPointerCaptureChanged(pointerCaptureEnabled); } } @Override public void onDragEvent(boolean isExiting, float x, float y) { // force DRAG_EXITED_EVENT if appropriate DragEvent event = DragEvent.obtain( isExiting ? DragEvent.ACTION_DRAG_EXITED : DragEvent.ACTION_DRAG_LOCATION, x, y, 0 /* offsetX */, 0 /* offsetY */, null/* localState */, null/* description */, null /* data */, null /* dragSurface */, null /* dragAndDropPermissions */, false /* result */); dispatchDragEvent(event); } @Override @Override public void dispose() { public void dispose() { unscheduleConsumeBatchedInput(); unscheduleConsumeBatchedInput(); Loading
services/core/java/com/android/server/input/InputManagerService.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -304,7 +304,7 @@ public class InputManagerService extends IInputManager.Stub int displayId, InputApplicationHandle application); int displayId, InputApplicationHandle application); private static native void nativeSetFocusedDisplay(long ptr, int displayId); private static native void nativeSetFocusedDisplay(long ptr, int displayId); private static native boolean nativeTransferTouchFocus(long ptr, private static native boolean nativeTransferTouchFocus(long ptr, IBinder fromChannelToken, IBinder toChannelToken); IBinder fromChannelToken, IBinder toChannelToken, boolean isDragDrop); private static native void nativeSetPointerSpeed(long ptr, int speed); private static native void nativeSetPointerSpeed(long ptr, int speed); private static native void nativeSetShowTouches(long ptr, boolean enabled); private static native void nativeSetShowTouches(long ptr, boolean enabled); private static native void nativeSetInteractive(long ptr, boolean interactive); private static native void nativeSetInteractive(long ptr, boolean interactive); Loading Loading @@ -1727,12 +1727,14 @@ public class InputManagerService extends IInputManager.Stub * @param fromChannel The channel of a window that currently has touch focus. * @param fromChannel The channel of a window that currently has touch focus. * @param toChannel The channel of the window that should receive touch focus in * @param toChannel The channel of the window that should receive touch focus in * place of the first. * place of the first. * @param isDragDrop True if transfer touch focus for drag and drop. * @return True if the transfer was successful. False if the window with the * @return True if the transfer was successful. False if the window with the * specified channel did not actually have touch focus at the time of the request. * specified channel did not actually have touch focus at the time of the request. */ */ public boolean transferTouchFocus(@NonNull InputChannel fromChannel, public boolean transferTouchFocus(@NonNull InputChannel fromChannel, @NonNull InputChannel toChannel) { @NonNull InputChannel toChannel, boolean isDragDrop) { return nativeTransferTouchFocus(mPtr, fromChannel.getToken(), toChannel.getToken()); return nativeTransferTouchFocus(mPtr, fromChannel.getToken(), toChannel.getToken(), isDragDrop); } } /** /** Loading @@ -1752,7 +1754,8 @@ public class InputManagerService extends IInputManager.Stub @NonNull IBinder toChannelToken) { @NonNull IBinder toChannelToken) { Objects.nonNull(fromChannelToken); Objects.nonNull(fromChannelToken); Objects.nonNull(toChannelToken); Objects.nonNull(toChannelToken); return nativeTransferTouchFocus(mPtr, fromChannelToken, toChannelToken); return nativeTransferTouchFocus(mPtr, fromChannelToken, toChannelToken, false /* isDragDrop */); } } @Override // Binder call @Override // Binder call Loading
services/core/java/com/android/server/wm/DragDropController.java +0 −2 Original line number Original line Diff line number Diff line Loading @@ -182,8 +182,6 @@ class DragDropController { if (SHOW_LIGHT_TRANSACTIONS) { if (SHOW_LIGHT_TRANSACTIONS) { Slog.i(TAG_WM, "<<< CLOSE TRANSACTION performDrag"); Slog.i(TAG_WM, "<<< CLOSE TRANSACTION performDrag"); } } mDragState.notifyLocationLocked(touchX, touchY); } finally { } finally { if (surface != null) { if (surface != null) { surface.release(); surface.release(); Loading
services/core/java/com/android/server/wm/DragState.java +0 −44 Original line number Original line Diff line number Diff line Loading @@ -515,50 +515,6 @@ class DragState { mTransaction.setPosition(mSurfaceControl, x - mThumbOffsetX, y - mThumbOffsetY).apply(); mTransaction.setPosition(mSurfaceControl, x - mThumbOffsetX, y - mThumbOffsetY).apply(); ProtoLog.i(WM_SHOW_TRANSACTIONS, "DRAG %s: pos=(%d,%d)", mSurfaceControl, ProtoLog.i(WM_SHOW_TRANSACTIONS, "DRAG %s: pos=(%d,%d)", mSurfaceControl, (int) (x - mThumbOffsetX), (int) (y - mThumbOffsetY)); (int) (x - mThumbOffsetX), (int) (y - mThumbOffsetY)); notifyLocationLocked(x, y); } void notifyLocationLocked(float x, float y) { // Tell the affected window WindowState touchedWin = mDisplayContent.getTouchableWinAtPointLocked(x, y); if (touchedWin != null && !isWindowNotified(touchedWin)) { // The drag point is over a window which was not notified about a drag start. // Pretend it's over empty space. touchedWin = null; } try { final int myPid = Process.myPid(); // have we dragged over a new window? if ((touchedWin != mTargetWindow) && (mTargetWindow != null)) { if (DEBUG_DRAG) { Slog.d(TAG_WM, "sending DRAG_EXITED to " + mTargetWindow); } // force DRAG_EXITED_EVENT if appropriate DragEvent evt = obtainDragEvent(mTargetWindow, DragEvent.ACTION_DRAG_EXITED, 0, 0, 0, 0, null, null, null, null, null, false); mTargetWindow.mClient.dispatchDragEvent(evt); if (myPid != mTargetWindow.mSession.mPid) { evt.recycle(); } } if (touchedWin != null) { if (false && DEBUG_DRAG) { Slog.d(TAG_WM, "sending DRAG_LOCATION to " + touchedWin); } DragEvent evt = obtainDragEvent(touchedWin, DragEvent.ACTION_DRAG_LOCATION, x, y, mThumbOffsetX, mThumbOffsetY, null, null, null, null, null, false); touchedWin.mClient.dispatchDragEvent(evt); if (myPid != touchedWin.mSession.mPid) { evt.recycle(); } } } catch (RemoteException e) { Slog.w(TAG_WM, "can't send drag notification to windows"); } mTargetWindow = touchedWin; } } /** /** Loading
services/core/java/com/android/server/wm/TaskPositioningController.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -188,7 +188,8 @@ class TaskPositioningController { transferFocusFromWin = displayContent.mCurrentFocus; transferFocusFromWin = displayContent.mCurrentFocus; } } if (!mInputManager.transferTouchFocus( if (!mInputManager.transferTouchFocus( transferFocusFromWin.mInputChannel, mTaskPositioner.mClientChannel)) { transferFocusFromWin.mInputChannel, mTaskPositioner.mClientChannel, false /* isDragDrop */)) { Slog.e(TAG_WM, "startPositioningLocked: Unable to transfer touch focus"); Slog.e(TAG_WM, "startPositioningLocked: Unable to transfer touch focus"); cleanUpTaskPositioner(); cleanUpTaskPositioner(); return false; return false; Loading