From fcfc1391e127a1f7ecfe8ecfebd8a3c3428778e2 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Mon, 7 Nov 2022 18:25:33 +0000 Subject: [PATCH] Migrate internal pilferPointers usages to InputManager call Bug: 257977069 Test: presubmit Change-Id: Iec7123d71a58122854ba9a2576f70b64e8d3f214 --- .../java/com/android/server/input/InputManagerInternal.java | 6 ------ .../java/com/android/server/input/InputManagerService.java | 5 ----- .../server/inputmethod/HandwritingModeController.java | 6 +++++- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/services/core/java/com/android/server/input/InputManagerInternal.java b/services/core/java/com/android/server/input/InputManagerInternal.java index 7eb5a1013f698..62344216c3dbd 100644 --- a/services/core/java/com/android/server/input/InputManagerInternal.java +++ b/services/core/java/com/android/server/input/InputManagerInternal.java @@ -135,12 +135,6 @@ public abstract class InputManagerInternal { /** Create an {@link InputChannel} that is registered to InputDispatcher. */ public abstract InputChannel createInputChannel(String inputChannelName); - /** - * Pilfer pointers from the input channel with the given token so that ongoing gestures are - * canceled for all other channels. - */ - public abstract void pilferPointers(IBinder token); - /** * Increments keyboard backlight level if the device has an associated keyboard backlight * {@see Light.LIGHT_TYPE_KEYBOARD_BACKLIGHT} diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 2e735077d74fa..d2282c3ee072e 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -3781,11 +3781,6 @@ public class InputManagerService extends IInputManager.Stub return InputManagerService.this.createInputChannel(inputChannelName); } - @Override - public void pilferPointers(IBinder token) { - mNative.pilferPointers(token); - } - @Override public void incrementKeyboardBacklight(int deviceId) { mKeyboardBacklightController.incrementKeyboardBacklight(deviceId); diff --git a/services/core/java/com/android/server/inputmethod/HandwritingModeController.java b/services/core/java/com/android/server/inputmethod/HandwritingModeController.java index a4830beecd045..1c7294f8a9d5c 100644 --- a/services/core/java/com/android/server/inputmethod/HandwritingModeController.java +++ b/services/core/java/com/android/server/inputmethod/HandwritingModeController.java @@ -18,9 +18,12 @@ package com.android.server.inputmethod; import static android.view.InputDevice.SOURCE_STYLUS; +import android.Manifest; import android.annotation.AnyThread; import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.annotation.UiThread; +import android.hardware.input.InputManager; import android.os.IBinder; import android.os.Looper; import android.util.Slog; @@ -141,6 +144,7 @@ final class HandwritingModeController { * input events and disposing the input event receiver. * @return the handwriting session to send to the IME, or null if the request was invalid. */ + @RequiresPermission(Manifest.permission.MONITOR_INPUT) @UiThread @Nullable HandwritingSession startHandwritingSession( @@ -169,7 +173,7 @@ final class HandwritingModeController { } if (DEBUG) Slog.d(TAG, "Starting handwriting session in display: " + mCurrentDisplayId); - mInputManagerInternal.pilferPointers(mHandwritingSurface.getInputChannel().getToken()); + InputManager.getInstance().pilferPointers(mHandwritingSurface.getInputChannel().getToken()); // Stop processing more events. mHandwritingEventReceiver.dispose();