diff options
| author | 2022-07-15 21:44:29 -0700 | |
|---|---|---|
| committer | 2022-07-15 21:44:29 -0700 | |
| commit | 80b2911d01b7c56f7b877d37e8e11324f22bed0c (patch) | |
| tree | bbc3cd9de93938ccefed23d028df7aa4c7f27702 | |
| parent | 351e6778539ea6b4b2af2abb6f656cd6106e88a8 (diff) | |
Use @EnforcePermission for IIMM#addVirtualStylusIdForTestSession()
This CL manually migrates
IInputMethodManager#addVirtualStylusIdForTestSession(),
which was added recently [1], from manual permission check with
Context#enforceCallingPermission(INJECT_EVENTS)
to code-generation check with
@EnforcePermission("INJECT_EVENTS").
There should be no observable semantic behavior change in this CL.
[1]: I7399c0a56c04f024d65c16d459818cc2c5cdbc7f
d96ef57bc4f87f82395c4eb456b4c11c6faf912b
Bug: 34886274
Bug: 210039666
Bug: 232058525
Bug: 237316307
Test: atest CtsInputMethodTestCases:InputMethodManagerTest#testShowInputMethodPickerFromSystemProtection
Change-Id: Ida227d417496dd91c071c38ca0be003529764de4
| -rw-r--r-- | core/java/com/android/internal/view/IInputMethodManager.aidl | 1 | ||||
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 5 |
2 files changed, 2 insertions, 4 deletions
diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index dd9fcb07283a..53b7ba5bb670 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -123,6 +123,7 @@ interface IInputMethodManager { boolean isStylusHandwritingAvailableAsUser(int userId); /** add virtual stylus id for test Stylus handwriting session **/ + @EnforcePermission("INJECT_EVENTS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INJECT_EVENTS)") void addVirtualStylusIdForTestSession(in IInputMethodClient client); diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 2e8729363ce9..8e0952129d7e 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -4465,12 +4465,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub * a stylus deviceId is not already registered on device. */ @BinderThread - @RequiresPermission(Manifest.permission.INJECT_EVENTS) + @EnforcePermission(Manifest.permission.INJECT_EVENTS) @Override public void addVirtualStylusIdForTestSession(IInputMethodClient client) { - mContext.enforceCallingPermission( - Manifest.permission.INJECT_EVENTS, - "Using addVirtualStylusIdForTestSession() requires INJECT_EVENTS."); int uid = Binder.getCallingUid(); synchronized (ImfLock.class) { if (!canInteractWithImeLocked(uid, client, "addVirtualStylusIdForTestSession")) { |