From 7a46c28d4571e037e26a28ea8e2a01312d916d47 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Sun, 10 Dec 2017 18:15:19 -0800 Subject: [PATCH] Simplify IMMS#startVrInputMethodNoCheck a bit This is a follow up CL to a recent CL [1] that added VR-IME support. Currently, IMMS#startVrInputMethodNoCheck() internally calls IMMS#setInputMethodEnabled(), which enforces the caller user ID check and caller permission check for WRITE_SECURE_SETTINGS. This appears to make sense for IMMS#startVrInputMethodNoCheck(), but in reallity IMMS#startVrInputMethodNoCheck() always gets called on non-binder system server thread hence those checks will never fail. Note that such a call path is fine and not a security issue. What this CL tries to address is just replace IMMS#setInputMethodEnabledLocked() to make it clear that IMMS allows such an operation for callers that have RESTRICTED_VR_ACCESS is intentional. To summarize, this CL just removes redundant operations and there should be no visible behavior change. [1]: I1db7981b5198e7e203d4578cae7e5b6d20037d0d 89a6c48a8b2e54f9b93211c20a126edab0eefe35 Bug: 63037786 Test: compile Change-Id: Iec43177bd698de6efa453d64ceafec3164538151 --- .../java/com/android/server/InputMethodManagerService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index dc35051d2dfeb..37f1dc490fe37 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -889,7 +889,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub /** * Start a VR InputMethod that matches IME with package name of {@param component}. - * Note: This method is called from {@link VrManager}. + * Note: This method is called from {@link android.app.VrManager}. */ private void startVrInputMethodNoCheck(@Nullable ComponentName component) { if (component == null) { @@ -903,7 +903,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub for (InputMethodInfo info : mMethodList) { if (TextUtils.equals(info.getPackageName(), packageName) && info.isVrOnly()) { // set this is as current inputMethod without updating settings. - setInputMethodEnabled(info.getId(), true); + setInputMethodEnabledLocked(info.getId(), true); setInputMethodLocked(info.getId(), NOT_A_SUBTYPE_ID); break; }