summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yohei Yukawa <yukawa@google.com> 2022-10-05 15:37:45 -0700
committer Yohei Yukawa <yukawa@google.com> 2022-10-05 15:37:45 -0700
commit3cec57b92d708d146e7b17cbcc6f8b146b2ce2e5 (patch)
tree882b6adca6d452e2f1a7229582129b0445b8c8ee
parentfc48388a5bd359bff444799b2013f6f069183a27 (diff)
Use UserManagerInternal#hasUserRestriction() in IMMS
This is a simple clean-up to our previous CL [1], which made InputMethodManagerService#onShellCommand() take DISALLOW_DEBUGGING_FEATURES into account for several commands. With this CL, InputMethodManagerService#userHasDebugPriv() starts using UserManagerInternal#hasUserRestriction() rather than UserManager#hasUserRestriction() for consistency and thinner abstraction. There should be no observable behavior change in this CL. [1]: I7714294a1bf7d0322c34e1d3bfba7f2e7fc8766e 87e2e51467d1ade2e94c1fdd8eb3208dbe51b098 Bug: 234882948 Test: Manually tested as follows. 1. adb shell pm create-user test -> Success: created user id 10 2. adb root 3. adb shell pm set-user-restriction --user 10 no_debugging_features 1 4. adb shell am switch-user 10 5. adb shell cmd input_method ime reset -> User #10 is restricted with DISALLOW_DEBUGGING_FEATURES. Change-Id: I10cfc44465db110a89e7166ab7a60510e72533ea
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index ab05e034562b..542f381c937c 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -6406,9 +6406,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
* @return {@code true} if userId has debugging privileges.
* i.e. {@link UserManager#DISALLOW_DEBUGGING_FEATURES} is {@code false}.
*/
- private boolean userHasDebugPriv(int userId, final ShellCommand shellCommand) {
- if (mUserManager.hasUserRestriction(
- UserManager.DISALLOW_DEBUGGING_FEATURES, UserHandle.of(userId))) {
+ private boolean userHasDebugPriv(@UserIdInt int userId, ShellCommand shellCommand) {
+ if (mUserManagerInternal.hasUserRestriction(
+ UserManager.DISALLOW_DEBUGGING_FEATURES, userId)) {
shellCommand.getErrPrintWriter().println("User #" + userId
+ " is restricted with DISALLOW_DEBUGGING_FEATURES.");
return false;