diff options
| author | 2024-05-10 00:21:07 +0000 | |
|---|---|---|
| committer | 2024-05-10 00:21:07 +0000 | |
| commit | e007f08c3a3536c867a6c685e05117fe7396ddea (patch) | |
| tree | 31c014f10dec785594fbec1f64e23440fcb8dddc | |
| parent | 2a6921499587b8419c0bb0e1d213e1c60a29dd81 (diff) | |
| parent | 76342abe5ff88a580ef8f4c64e9a6eb49985eb35 (diff) | |
Merge changes from topic "rm-choreographer-flag" into main
* changes:
WM mouse pointer tracking: Cleanup after PointerChoreographer refactor
InputManager: Cleanup after PointerChoreogpraher refactor
22 files changed, 29 insertions, 408 deletions
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index 243ae142d9b6..8f78032435a8 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -148,8 +148,6 @@ interface IInputManager { IInputDeviceBatteryState getBatteryState(int deviceId); - void setPointerIconType(int typeId); - void setCustomPointerIcon(in PointerIcon icon); boolean setPointerIcon(in PointerIcon icon, int displayId, int deviceId, int pointerId, in IBinder inputToken); diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index dd4ea31af17d..57004bca80b6 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -992,21 +992,14 @@ public final class InputManager { } /** - * Changes the mouse pointer's icon shape into the specified id. - * - * @param iconId The id of the pointer graphic, as a value between - * {@link PointerIcon#TYPE_ARROW} and {@link PointerIcon#TYPE_HANDWRITING}. + * This method exists for backwards-compatibility, and is a no-op. * + * @deprecated * @hide */ @UnsupportedAppUsage public void setPointerIconType(int iconId) { - mGlobal.setPointerIconType(iconId); - } - - /** @hide */ - public void setCustomPointerIcon(PointerIcon icon) { - mGlobal.setCustomPointerIcon(icon); + Log.e(TAG, "setPointerIcon: Unsupported app usage!"); } /** @hide */ diff --git a/core/java/android/hardware/input/InputManagerGlobal.java b/core/java/android/hardware/input/InputManagerGlobal.java index a9c97b1a0e51..cb3af2b915bb 100644 --- a/core/java/android/hardware/input/InputManagerGlobal.java +++ b/core/java/android/hardware/input/InputManagerGlobal.java @@ -1411,28 +1411,6 @@ public final class InputManagerGlobal { } /** - * @see InputManager#setPointerIconType(int) - */ - public void setPointerIconType(int iconId) { - try { - mIm.setPointerIconType(iconId); - } catch (RemoteException ex) { - throw ex.rethrowFromSystemServer(); - } - } - - /** - * @see InputManager#setCustomPointerIcon(PointerIcon) - */ - public void setCustomPointerIcon(PointerIcon icon) { - try { - mIm.setCustomPointerIcon(icon); - } catch (RemoteException ex) { - throw ex.rethrowFromSystemServer(); - } - } - - /** * @see InputManager#setPointerIcon(PointerIcon, int, int, int, IBinder) */ public boolean setPointerIcon(PointerIcon icon, int displayId, int deviceId, int pointerId, diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl index 498be2f18ffa..374303501ffc 100644 --- a/core/java/android/view/IWindow.aidl +++ b/core/java/android/view/IWindow.aidl @@ -108,11 +108,6 @@ oneway interface IWindow { void dispatchDragEvent(in DragEvent event); /** - * Pointer icon events - */ - void updatePointerIcon(float x, float y); - - /** * Called for non-application windows when the enter animation has completed. */ void dispatchWindowShown(); diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index 86264eb31663..e3e4fc04098b 100644 --- a/core/java/android/view/IWindowSession.aidl +++ b/core/java/android/view/IWindowSession.aidl @@ -288,8 +288,6 @@ interface IWindowSession { oneway void finishMovingTask(IWindow window); - oneway void updatePointerIcon(IWindow window); - /** * Update a tap exclude region identified by provided id in the window. Touches on this region * will neither be dispatched to this window nor change the focus to this window. Passing an diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 60ad926f2be1..1cb276568244 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -30695,21 +30695,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public void setPointerIcon(PointerIcon pointerIcon) { mMousePointerIcon = pointerIcon; - if (com.android.input.flags.Flags.enablePointerChoreographer()) { - final ViewRootImpl viewRootImpl = getViewRootImpl(); - if (viewRootImpl == null) { - return; - } - viewRootImpl.refreshPointerIcon(); - } else { - if (mAttachInfo == null || mAttachInfo.mHandlingPointerEvent) { - return; - } - try { - mAttachInfo.mSession.updatePointerIcon(mAttachInfo.mWindow); - } catch (RemoteException e) { - } + final ViewRootImpl viewRootImpl = getViewRootImpl(); + if (viewRootImpl == null) { + return; } + viewRootImpl.refreshPointerIcon(); } /** diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 42b40a12f93f..155c0537b5b5 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -74,7 +74,6 @@ import static android.view.ViewRootImplProto.WIDTH; import static android.view.ViewRootImplProto.WINDOW_ATTRIBUTES; import static android.view.ViewRootImplProto.WIN_FRAME; import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION; -import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OVERRIDE_LAYOUT_IN_DISPLAY_CUTOUT_MODE; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; @@ -96,6 +95,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_V import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INSET_PARENT_FRAME_BY_IME; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE; +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OVERRIDE_LAYOUT_IN_DISPLAY_CUTOUT_MODE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; @@ -122,7 +122,6 @@ import static android.view.flags.Flags.toolkitSetFrameRateReadOnly; import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.IME_FOCUS_CONTROLLER; import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.INSETS_CONTROLLER; -import static com.android.input.flags.Flags.enablePointerChoreographer; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.window.flags.Flags.activityWindowInfoFlag; import static com.android.window.flags.Flags.enableBufferTransformHintFromDisplay; @@ -7980,46 +7979,20 @@ public final class ViewRootImpl implements ViewParent, if (event.isStylusPointer() && mIsStylusPointerIconEnabled) { pointerIcon = mHandwritingInitiator.onResolvePointerIcon(mContext, event); } - if (pointerIcon == null) { pointerIcon = mView.onResolvePointerIcon(event, pointerIndex); } - - if (enablePointerChoreographer()) { - if (pointerIcon == null) { - pointerIcon = PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_NOT_SPECIFIED); - } - if (Objects.equals(mResolvedPointerIcon, pointerIcon)) { - return true; - } - mResolvedPointerIcon = pointerIcon; - - InputManagerGlobal.getInstance() - .setPointerIcon(pointerIcon, event.getDisplayId(), - event.getDeviceId(), event.getPointerId(0), getInputToken()); + if (pointerIcon == null) { + pointerIcon = PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_NOT_SPECIFIED); + } + if (Objects.equals(mResolvedPointerIcon, pointerIcon)) { return true; } + mResolvedPointerIcon = pointerIcon; - final int pointerType = (pointerIcon != null) ? - pointerIcon.getType() : PointerIcon.TYPE_NOT_SPECIFIED; - - if (mPointerIconType == null || mPointerIconType != pointerType) { - mPointerIconType = pointerType; - mCustomPointerIcon = null; - if (mPointerIconType != PointerIcon.TYPE_CUSTOM) { - InputManagerGlobal - .getInstance() - .setPointerIconType(pointerType); - return true; - } - } - if (mPointerIconType == PointerIcon.TYPE_CUSTOM && - !pointerIcon.equals(mCustomPointerIcon)) { - mCustomPointerIcon = pointerIcon; - InputManagerGlobal - .getInstance() - .setCustomPointerIcon(mCustomPointerIcon); - } + InputManagerGlobal.getInstance() + .setPointerIcon(pointerIcon, event.getDisplayId(), + event.getDeviceId(), event.getPointerId(0), getInputToken()); return true; } @@ -10623,16 +10596,6 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } - public void updatePointerIcon(float x, float y) { - final int what = MSG_UPDATE_POINTER_ICON; - mHandler.removeMessages(what); - final long now = SystemClock.uptimeMillis(); - final MotionEvent event = MotionEvent.obtain( - 0, now, MotionEvent.ACTION_HOVER_MOVE, x, y, 0); - Message msg = mHandler.obtainMessage(what, event); - mHandler.sendMessage(msg); - } - public void dispatchCheckFocus() { if (!mHandler.hasMessages(MSG_CHECK_FOCUS)) { // This will result in a call to checkFocus() below. @@ -11496,14 +11459,6 @@ public final class ViewRootImpl implements ViewParent, } @Override - public void updatePointerIcon(float x, float y) { - final ViewRootImpl viewAncestor = mViewAncestor.get(); - if (viewAncestor != null) { - viewAncestor.updatePointerIcon(x, y); - } - } - - @Override public void dispatchWindowShown() { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java index e6367ff7b4dc..d7d764b6ce75 100644 --- a/core/java/android/view/WindowlessWindowManager.java +++ b/core/java/android/view/WindowlessWindowManager.java @@ -603,10 +603,6 @@ public class WindowlessWindowManager implements IWindowSession { } @Override - public void updatePointerIcon(android.view.IWindow window) { - } - - @Override public void updateTapExcludeRegion(android.view.IWindow window, android.graphics.Region region) { } diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java index c0616d0ac96c..3fc4fff21d2d 100644 --- a/core/java/com/android/internal/view/BaseIWindow.java +++ b/core/java/com/android/internal/view/BaseIWindow.java @@ -18,7 +18,6 @@ package com.android.internal.view; import android.annotation.Nullable; import android.compat.annotation.UnsupportedAppUsage; -import android.hardware.input.InputManagerGlobal; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.RemoteException; @@ -29,7 +28,6 @@ import android.view.IWindow; import android.view.IWindowSession; import android.view.InsetsSourceControl; import android.view.InsetsState; -import android.view.PointerIcon; import android.view.ScrollCaptureResponse; import android.view.WindowInsets.Type.InsetsType; import android.view.inputmethod.ImeTracker; @@ -128,12 +126,6 @@ public class BaseIWindow extends IWindow.Stub { } @Override - public void updatePointerIcon(float x, float y) { - InputManagerGlobal.getInstance() - .setPointerIconType(PointerIcon.TYPE_NOT_SPECIFIED); - } - - @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { if (sync) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java index 5e063a20f9a1..da414cc9ae70 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java @@ -389,9 +389,6 @@ public class SystemWindows { public void dispatchDragEvent(DragEvent event) {} @Override - public void updatePointerIcon(float x, float y) {} - - @Override public void dispatchWindowShown() {} @Override diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java index 9624d46678bf..07f0c3906766 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java @@ -24,7 +24,6 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERL import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_CONSUMER; -import static com.android.input.flags.Flags.enablePointerChoreographer; import static com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_BOTTOM; import static com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_LEFT; import static com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_RIGHT; @@ -499,12 +498,8 @@ class DragResizeInputListener implements AutoCloseable { // where views in the task can receive input events because we can't set touch regions // of input sinks to have rounded corners. if (mLastCursorType != cursorType || cursorType != PointerIcon.TYPE_DEFAULT) { - if (enablePointerChoreographer()) { - mInputManager.setPointerIcon(PointerIcon.getSystemIcon(mContext, cursorType), - displayId, deviceId, pointerId, mInputChannel.getToken()); - } else { - mInputManager.setPointerIconType(cursorType); - } + mInputManager.setPointerIcon(PointerIcon.getSystemIcon(mContext, cursorType), + displayId, deviceId, pointerId, mInputChannel.getToken()); mLastCursorType = cursorType; } } diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index cbd309e1f957..308aed66b7dc 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -156,7 +156,6 @@ public class InputManagerService extends IInputManager.Stub private static final int MSG_DELIVER_INPUT_DEVICES_CHANGED = 1; private static final int MSG_RELOAD_DEVICE_ALIASES = 2; private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 3; - private static final int MSG_POINTER_DISPLAY_ID_CHANGED = 4; private static final int DEFAULT_VIBRATION_MAGNITUDE = 192; private static final AdditionalDisplayInputProperties @@ -1324,11 +1323,6 @@ public class InputManagerService extends IInputManager.Stub properties -> properties.pointerIconVisible = visible); } - private void handlePointerDisplayIdChanged(PointerDisplayIdChangedArgs args) { - mWindowManagerCallbacks.notifyPointerDisplayIdChanged( - args.mPointerDisplayId, args.mXPosition, args.mYPosition); - } - private void setDisplayEligibilityForPointerCapture(int displayId, boolean isEligible) { mNative.setDisplayEligibilityForPointerCapture(displayId, isEligible); } @@ -1612,18 +1606,6 @@ public class InputManagerService extends IInputManager.Stub // Binder call @Override - public void setPointerIconType(int iconType) { - // TODO(b/311416205): Remove. - } - - // Binder call - @Override - public void setCustomPointerIcon(PointerIcon icon) { - // TODO(b/311416205): Remove. - } - - // Binder call - @Override public boolean setPointerIcon(PointerIcon icon, int displayId, int deviceId, int pointerId, IBinder inputToken) { Objects.requireNonNull(icon); @@ -2703,9 +2685,7 @@ public class InputManagerService extends IInputManager.Stub @SuppressWarnings("unused") @VisibleForTesting void onPointerDisplayIdChanged(int pointerDisplayId, float xPosition, float yPosition) { - mHandler.obtainMessage(MSG_POINTER_DISPLAY_ID_CHANGED, - new PointerDisplayIdChangedArgs(pointerDisplayId, xPosition, - yPosition)).sendToTarget(); + // TODO(b/311416205): Remove. } @Override @@ -2860,14 +2840,6 @@ public class InputManagerService extends IInputManager.Stub */ @Nullable SurfaceControl createSurfaceForGestureMonitor(String name, int displayId); - - /** - * Notify WindowManagerService when the display of the mouse pointer changes. - * @param displayId The display on which the mouse pointer is shown. - * @param x The x coordinate of the mouse pointer. - * @param y The y coordinate of the mouse pointer. - */ - void notifyPointerDisplayIdChanged(int displayId, float x, float y); } /** @@ -2911,9 +2883,6 @@ public class InputManagerService extends IInputManager.Stub boolean inTabletMode = (boolean) args.arg1; deliverTabletModeChanged(whenNanos, inTabletMode); break; - case MSG_POINTER_DISPLAY_ID_CHANGED: - handlePointerDisplayIdChanged((PointerDisplayIdChangedArgs) msg.obj); - break; } } } diff --git a/services/core/java/com/android/server/inputmethod/HandwritingModeController.java b/services/core/java/com/android/server/inputmethod/HandwritingModeController.java index 7956e03f22a9..79f1a9c90f53 100644 --- a/services/core/java/com/android/server/inputmethod/HandwritingModeController.java +++ b/services/core/java/com/android/server/inputmethod/HandwritingModeController.java @@ -330,14 +330,10 @@ final class HandwritingModeController { mHandwritingSurface.startIntercepting(imePid, imeUid); // Unset the pointer icon for the stylus in case the app had set it. - if (com.android.input.flags.Flags.enablePointerChoreographer()) { - Objects.requireNonNull(mContext.getSystemService(InputManager.class)).setPointerIcon( - PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_NOT_SPECIFIED), - downEvent.getDisplayId(), downEvent.getDeviceId(), downEvent.getPointerId(0), - mHandwritingSurface.getInputChannel().getToken()); - } else { - InputManagerGlobal.getInstance().setPointerIconType(PointerIcon.TYPE_NOT_SPECIFIED); - } + Objects.requireNonNull(mContext.getSystemService(InputManager.class)).setPointerIcon( + PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_NOT_SPECIFIED), + downEvent.getDisplayId(), downEvent.getDeviceId(), downEvent.getPointerId(0), + mHandwritingSurface.getInputChannel().getToken()); return new HandwritingSession(mCurrentRequestId, mHandwritingSurface.getInputChannel(), mHandwritingBuffer); diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 414724963c76..8030d980a0d9 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1202,9 +1202,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mTapDetector = new TaskTapPointerEventListener(mWmService, this); registerPointerEventListener(mTapDetector); } - if (mWmService.mMousePositionTracker != null) { - registerPointerEventListener(mWmService.mMousePositionTracker); - } if (mWmService.mAtmService.getRecentTasks() != null) { registerPointerEventListener( mWmService.mAtmService.getRecentTasks().getInputListener()); diff --git a/services/core/java/com/android/server/wm/DragDropController.java b/services/core/java/com/android/server/wm/DragDropController.java index 8116f6870f66..30f2d0d64d13 100644 --- a/services/core/java/com/android/server/wm/DragDropController.java +++ b/services/core/java/com/android/server/wm/DragDropController.java @@ -21,13 +21,11 @@ import static android.view.View.DRAG_FLAG_GLOBAL; import static android.view.View.DRAG_FLAG_GLOBAL_SAME_APPLICATION; import static android.view.View.DRAG_FLAG_START_INTENT_SENDER_ON_UNHANDLED_DRAG; -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; import android.annotation.NonNull; -import android.app.ActivityManager; import android.content.ClipData; import android.content.Context; import android.hardware.input.InputManagerGlobal; @@ -266,16 +264,12 @@ 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); + 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()); } // remember the thumb offsets for later mDragState.mThumbOffsetX = thumbCenterX; diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java index 5ed343a4d028..72ae64c455fe 100644 --- a/services/core/java/com/android/server/wm/DragState.java +++ b/services/core/java/com/android/server/wm/DragState.java @@ -45,7 +45,6 @@ import android.content.ClipData; import android.content.ClipDescription; import android.graphics.Point; import android.graphics.Rect; -import android.hardware.input.InputManagerGlobal; import android.os.Binder; import android.os.Build; import android.os.IBinder; @@ -58,9 +57,7 @@ import android.view.Display; import android.view.DragEvent; import android.view.InputApplicationHandle; import android.view.InputChannel; -import android.view.InputDevice; import android.view.InputWindowHandle; -import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.WindowManager; @@ -110,7 +107,6 @@ class DragState { boolean mCrossProfileCopyAllowed; ClipData mData; ClipDescription mDataDescription; - int mTouchSource; boolean mDragResult; boolean mRelinquishDragSurfaceToDropTarget; float mAnimatedScale = 1.0f; @@ -263,12 +259,6 @@ class DragState { Trace.instant(TRACE_TAG_WINDOW_MANAGER, "DragDropController#DRAG_ENDED"); } - // Take the cursor back if it has been changed. - if (isFromSource(InputDevice.SOURCE_MOUSE)) { - mService.restorePointerIconLocked(mDisplayContent, mCurrentX, mCurrentY); - mTouchSource = 0; - } - // Clear the internal variables. if (mInputSurface != null) { mTransaction.remove(mInputSurface).apply(); @@ -762,18 +752,6 @@ class DragState { return animator; } - private boolean isFromSource(int source) { - return (mTouchSource & source) == source; - } - - void overridePointerIconLocked(int touchSource) { - mTouchSource = touchSource; - if (isFromSource(InputDevice.SOURCE_MOUSE)) { - // TODO(b/293587049): Pointer Icon Refactor: Set the pointer icon from the drag window. - InputManagerGlobal.getInstance().setPointerIconType(PointerIcon.TYPE_GRABBING); - } - } - private class AnimationListener implements ValueAnimator.AnimatorUpdateListener, Animator.AnimatorListener { @Override diff --git a/services/core/java/com/android/server/wm/InputManagerCallback.java b/services/core/java/com/android/server/wm/InputManagerCallback.java index a84ebd95cf1c..22ca82a29d59 100644 --- a/services/core/java/com/android/server/wm/InputManagerCallback.java +++ b/services/core/java/com/android/server/wm/InputManagerCallback.java @@ -290,22 +290,6 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal } } - @Override - public void notifyPointerDisplayIdChanged(int displayId, float x, float y) { - synchronized (mService.mGlobalLock) { - mService.setMousePointerDisplayId(displayId); - if (displayId == Display.INVALID_DISPLAY) return; - - final DisplayContent dc = mService.mRoot.getDisplayContent(displayId); - if (dc == null) { - Slog.wtf(TAG, "The mouse pointer was moved to display " + displayId - + " that does not have a valid DisplayContent."); - return; - } - mService.restorePointerIconLocked(dc, x, y); - } - } - /** Waits until the built-in input devices have been configured. */ public boolean waitForInputDevicesReady(long timeoutMillis) { synchronized (mInputDevicesReadyMonitor) { diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java index bb86460572af..3b3eeb496ab7 100644 --- a/services/core/java/com/android/server/wm/Session.java +++ b/services/core/java/com/android/server/wm/Session.java @@ -740,16 +740,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { } @Override - public void updatePointerIcon(IWindow window) { - final long identity = Binder.clearCallingIdentity(); - try { - mService.updatePointerIcon(window); - } finally { - Binder.restoreCallingIdentity(identity); - } - } - - @Override public void updateTapExcludeRegion(IWindow window, Region region) { final long identity = Binder.clearCallingIdentity(); try { diff --git a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java index ac244c7b048e..abf750f773f5 100644 --- a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java +++ b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java @@ -24,13 +24,10 @@ import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; import android.graphics.Rect; import android.graphics.Region; -import android.hardware.input.InputManagerGlobal; import android.view.InputDevice; import android.view.MotionEvent; import android.view.WindowManagerPolicyConstants.PointerEventListener; -import com.android.server.wm.WindowManagerService.H; - /** * 1. Adjust the top most focus display if touch down on some display. * 2. Adjust the pointer icon when cursor moves to the task bounds. @@ -56,10 +53,6 @@ public class TaskTapPointerEventListener implements PointerEventListener { private void restorePointerIcon(int x, int y) { if (mPointerIconType != TYPE_NOT_SPECIFIED) { mPointerIconType = TYPE_NOT_SPECIFIED; - // Find the underlying window and ask it to restore the pointer icon. - mService.mH.removeMessages(H.RESTORE_POINTER_ICON); - mService.mH.obtainMessage(H.RESTORE_POINTER_ICON, - x, y, mDisplayContent).sendToTarget(); } } @@ -115,15 +108,6 @@ public class TaskTapPointerEventListener implements PointerEventListener { } if (mPointerIconType != iconType) { mPointerIconType = iconType; - if (mPointerIconType == TYPE_NOT_SPECIFIED) { - // Find the underlying window and ask it restore the pointer icon. - mService.mH.removeMessages(H.RESTORE_POINTER_ICON); - mService.mH.obtainMessage(H.RESTORE_POINTER_ICON, - x, y, mDisplayContent).sendToTarget(); - } else { - InputManagerGlobal.getInstance() - .setPointerIconType(mPointerIconType); - } } } break; diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 1559be56024b..d945e5312ff5 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -203,7 +203,6 @@ import android.hardware.configstore.V1_0.OptionalBool; import android.hardware.configstore.V1_1.ISurfaceFlingerConfigs; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManagerInternal; -import android.hardware.input.InputManager; import android.hardware.input.InputSettings; import android.net.Uri; import android.os.Binder; @@ -289,8 +288,6 @@ import android.view.InsetsSourceControl; import android.view.InsetsState; import android.view.KeyEvent; import android.view.MagnificationSpec; -import android.view.MotionEvent; -import android.view.PointerIcon; import android.view.RemoteAnimationAdapter; import android.view.ScrollCaptureResponse; import android.view.Surface; @@ -5720,7 +5717,6 @@ public class WindowManagerService extends IWindowManager.Stub public static final int UPDATE_ANIMATION_SCALE = 51; public static final int WINDOW_HIDE_TIMEOUT = 52; - public static final int RESTORE_POINTER_ICON = 55; public static final int SET_HAS_OVERLAY_UI = 58; public static final int ANIMATION_FAILSAFE = 60; public static final int RECOMPUTE_FOCUS = 61; @@ -5953,12 +5949,6 @@ public class WindowManagerService extends IWindowManager.Stub } break; } - case RESTORE_POINTER_ICON: { - synchronized (mGlobalLock) { - restorePointerIconLocked((DisplayContent)msg.obj, msg.arg1, msg.arg2); - } - break; - } case SET_HAS_OVERLAY_UI: { mAmInternal.setHasOverlayUi(msg.arg1, msg.arg2 == 1); break; @@ -7578,144 +7568,6 @@ public class WindowManagerService extends IWindowManager.Stub } } - // The mouse position tracker will be obsolete after the Pointer Icon Refactor. - // TODO(b/293587049): Remove after the refactoring is fully rolled out. - @Nullable - final MousePositionTracker mMousePositionTracker = - com.android.input.flags.Flags.enablePointerChoreographer() ? null - : new MousePositionTracker(); - - private static class MousePositionTracker implements PointerEventListener { - private boolean mLatestEventWasMouse; - private float mLatestMouseX; - private float mLatestMouseY; - - /** - * The display that the pointer (mouse cursor) is currently shown on. This is updated - * directly by InputManagerService when the pointer display changes. - */ - private int mPointerDisplayId = INVALID_DISPLAY; - - /** - * Update the mouse cursor position as a result of a mouse movement. - * @return true if the position was successfully updated, false otherwise. - */ - boolean updatePosition(int displayId, float x, float y) { - synchronized (this) { - mLatestEventWasMouse = true; - - if (displayId != mPointerDisplayId) { - // The display of the position update does not match the display on which the - // mouse pointer is shown, so do not update the position. - return false; - } - mLatestMouseX = x; - mLatestMouseY = y; - return true; - } - } - - void setPointerDisplayId(int displayId) { - synchronized (this) { - mPointerDisplayId = displayId; - } - } - - @Override - public void onPointerEvent(MotionEvent motionEvent) { - if (motionEvent.isFromSource(InputDevice.SOURCE_MOUSE)) { - updatePosition(motionEvent.getDisplayId(), motionEvent.getRawX(), - motionEvent.getRawY()); - } else { - synchronized (this) { - mLatestEventWasMouse = false; - } - } - } - }; - - void updatePointerIcon(IWindow client) { - if (mMousePositionTracker == null) { - return; - } - int pointerDisplayId; - float mouseX, mouseY; - - synchronized(mMousePositionTracker) { - if (!mMousePositionTracker.mLatestEventWasMouse) { - return; - } - mouseX = mMousePositionTracker.mLatestMouseX; - mouseY = mMousePositionTracker.mLatestMouseY; - pointerDisplayId = mMousePositionTracker.mPointerDisplayId; - } - - synchronized (mGlobalLock) { - if (mDragDropController.dragDropActiveLocked()) { - // Drag cursor overrides the app cursor. - return; - } - WindowState callingWin = windowForClientLocked(null, client, false); - if (callingWin == null) { - ProtoLog.w(WM_ERROR, "Bad requesting window %s", client); - return; - } - final DisplayContent displayContent = callingWin.getDisplayContent(); - if (displayContent == null) { - return; - } - if (pointerDisplayId != displayContent.getDisplayId()) { - // Do not let the pointer icon be updated by a window on a different display. - return; - } - WindowState windowUnderPointer = - displayContent.getTouchableWinAtPointLocked(mouseX, mouseY); - if (windowUnderPointer != callingWin) { - return; - } - try { - windowUnderPointer.mClient.updatePointerIcon( - windowUnderPointer.translateToWindowX(mouseX), - windowUnderPointer.translateToWindowY(mouseY)); - } catch (RemoteException e) { - ProtoLog.w(WM_ERROR, "unable to update pointer icon"); - } - } - } - - void restorePointerIconLocked(DisplayContent displayContent, float latestX, float latestY) { - if (mMousePositionTracker == null) { - return; - } - // Mouse position tracker has not been getting updates while dragging, update it now. - if (!mMousePositionTracker.updatePosition( - displayContent.getDisplayId(), latestX, latestY)) { - // The mouse position could not be updated, so ignore this request. - return; - } - - WindowState windowUnderPointer = - displayContent.getTouchableWinAtPointLocked(latestX, latestY); - if (windowUnderPointer != null) { - try { - windowUnderPointer.mClient.updatePointerIcon( - windowUnderPointer.translateToWindowX(latestX), - windowUnderPointer.translateToWindowY(latestY)); - } catch (RemoteException e) { - ProtoLog.w(WM_ERROR, "unable to restore pointer icon"); - } - } else { - mContext.getSystemService(InputManager.class) - .setPointerIconType(PointerIcon.TYPE_DEFAULT); - } - } - void setMousePointerDisplayId(int displayId) { - if (mMousePositionTracker == null) { - return; - } - mMousePositionTracker.setPointerDisplayId(displayId); - } - /** * Update a tap exclude region in the window identified by the provided id. Touches down on this * region will not: diff --git a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java index cda26f14e766..4fc222b3e038 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java @@ -95,10 +95,6 @@ public class TestIWindow extends IWindow.Stub { } @Override - public void updatePointerIcon(float x, float y) throws RemoteException { - } - - @Override public void dispatchWindowShown() throws RemoteException { } diff --git a/tests/Input/src/com/android/server/input/InputManagerServiceTests.kt b/tests/Input/src/com/android/server/input/InputManagerServiceTests.kt index 3b9ee807077e..709f58d583a0 100644 --- a/tests/Input/src/com/android/server/input/InputManagerServiceTests.kt +++ b/tests/Input/src/com/android/server/input/InputManagerServiceTests.kt @@ -169,12 +169,6 @@ class InputManagerServiceTests { localService.setDisplayViewports(viewports) verify(native).setDisplayViewports(any(Array<DisplayViewport>::class.java)) verify(native).setPointerDisplayId(displayId) - - val x = 42f - val y = 314f - service.onPointerDisplayIdChanged(displayId, x, y) - testLooper.dispatchNext() - verify(wmCallbacks).notifyPointerDisplayIdChanged(displayId, x, y) } @Test |