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
This commit is contained in:
@@ -34,7 +34,4 @@ oneway interface IAutoFillManagerService {
|
||||
void updateSession(in IBinder activityToken, in AutoFillId id, in Rect bounds,
|
||||
in AutoFillValue value, int flags);
|
||||
void finishSession(in IBinder activityToken);
|
||||
|
||||
// Methods called by ShellCommand
|
||||
void requestSaveForUser(int userId);
|
||||
}
|
||||
|
||||
@@ -203,6 +203,12 @@ public final class AutoFillManagerService extends SystemService {
|
||||
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.
|
||||
*/
|
||||
@@ -317,13 +323,6 @@ public final class AutoFillManagerService extends SystemService {
|
||||
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
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (mContext.checkCallingPermission(
|
||||
@@ -355,7 +354,7 @@ public final class AutoFillManagerService extends SystemService {
|
||||
@Override
|
||||
public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
|
||||
String[] args, ShellCallback callback, ResultReceiver resultReceiver) {
|
||||
(new AutoFillManagerServiceShellCommand(this)).exec(
|
||||
(new AutoFillManagerServiceShellCommand(AutoFillManagerService.this)).exec(
|
||||
this, in, out, err, args, callback, resultReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,14 @@ import android.app.ActivityManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ShellCommand;
|
||||
import android.os.UserHandle;
|
||||
import android.service.autofill.IAutoFillManagerService;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user