Remove foreground user check in shell commands for IMMS
In general adb shell command takes an optional user ID parameter when
we want to request something for a certain user. With that, checking
whether the caller is a foreground user or not does not make much
sense when handling shell commands. The entire point is whether the
caller os such shell commmands has sufficient permission or not.
Bug: 34886274
Test: 'adb shell ime reset' still works
Change-Id: I0aca79a33440f3636990ed9ef0efbbe0e4a42f77
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index a7b6c8b..38f3ba5 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -4913,11 +4913,6 @@
@RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
private int handleShellCommandEnableDisableInputMethod(
@NonNull ShellCommand shellCommand, boolean enabled) {
- if (!calledFromValidUser()) {
- shellCommand.getErrPrintWriter().print(
- "Must be called from the foreground user or with INTERACT_ACROSS_USERS_FULL");
- return ShellCommandResult.FAILURE;
- }
final String id = shellCommand.getNextArgRequired();
final boolean previouslyEnabled;
@@ -4974,11 +4969,6 @@
@ShellCommandResult
@RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
private int handleShellCommandResetInputMethod(@NonNull ShellCommand shellCommand) {
- if (!calledFromValidUser()) {
- shellCommand.getErrPrintWriter().print(
- "Must be called from the foreground user or with INTERACT_ACROSS_USERS_FULL");
- return ShellCommandResult.FAILURE;
- }
synchronized (mMethodMap) {
if (mContext.checkCallingOrSelfPermission(
android.Manifest.permission.WRITE_SECURE_SETTINGS)