Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca2d3b6c authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 2655c186
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -4913,11 +4913,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @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)