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

Commit ef0c1885 authored by Svet Ganov's avatar Svet Ganov
Browse files

Move auto-fill shell command off IPC

Auto-fill has a shell command that is useful for development
which is currently exposed as a remote method allowing any app
to call it reflectively. Since only case this method is called
is when handling a shell command there is no need to expose it
to IPC over binder.

Test: manual

Change-Id: Iac20b4a39c7065e254f8aa277d1f2fd1c38b24a8
parent 02d3a616
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -34,7 +34,4 @@ oneway interface IAutoFillManagerService {
    void updateSession(in IBinder activityToken, in AutoFillId id, in Rect bounds,
    void updateSession(in IBinder activityToken, in AutoFillId id, in Rect bounds,
                       in AutoFillValue value, int flags);
                       in AutoFillValue value, int flags);
    void finishSession(in IBinder activityToken);
    void finishSession(in IBinder activityToken);

    // Methods called by ShellCommand
    void requestSaveForUser(int userId);
}
}
+7 −8
Original line number Original line Diff line number Diff line
@@ -203,6 +203,12 @@ public final class AutoFillManagerService extends SystemService {
        return service;
        return service;
    }
    }


    void requestSaveForUser(int userId) {
        mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG);
        mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageI(
                MSG_REQUEST_SAVE_FOR_USER, userId));
    }

    /**
    /**
     * Removes a cached service for a given user.
     * Removes a cached service for a given user.
     */
     */
@@ -317,13 +323,6 @@ public final class AutoFillManagerService extends SystemService {
                    UserHandle.getCallingUserId(), 0, activityToken));
                    UserHandle.getCallingUserId(), 0, activityToken));
        }
        }


        @Override
        public void requestSaveForUser(int userId) {
            mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG);
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageI(MSG_REQUEST_SAVE_FOR_USER,
                    userId));
        }

        @Override
        @Override
        public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
            if (mContext.checkCallingPermission(
            if (mContext.checkCallingPermission(
@@ -355,7 +354,7 @@ public final class AutoFillManagerService extends SystemService {
        @Override
        @Override
        public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
        public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
                String[] args, ShellCallback callback, ResultReceiver resultReceiver) {
                String[] args, ShellCallback callback, ResultReceiver resultReceiver) {
            (new AutoFillManagerServiceShellCommand(this)).exec(
            (new AutoFillManagerServiceShellCommand(AutoFillManagerService.this)).exec(
                    this, in, out, err, args, callback, resultReceiver);
                    this, in, out, err, args, callback, resultReceiver);
        }
        }
    }
    }
+2 −3
Original line number Original line Diff line number Diff line
@@ -20,15 +20,14 @@ import android.app.ActivityManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ShellCommand;
import android.os.ShellCommand;
import android.os.UserHandle;
import android.os.UserHandle;
import android.service.autofill.IAutoFillManagerService;


import java.io.PrintWriter;
import java.io.PrintWriter;


public final class AutoFillManagerServiceShellCommand extends ShellCommand {
public final class AutoFillManagerServiceShellCommand extends ShellCommand {


    private final IAutoFillManagerService.Stub mService;
    private final AutoFillManagerService mService;


    public AutoFillManagerServiceShellCommand(IAutoFillManagerService.Stub service) {
    public AutoFillManagerServiceShellCommand(AutoFillManagerService service) {
        mService = service;
        mService = service;
    }
    }