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

Commit bb81092a authored by Felipe Leme's avatar Felipe Leme
Browse files

Provide support for optimized ACTION_REQUEST_SET_AUTOFILL_SERVICE.

Also removed obsolete 'cmd autofill save'

Bug: 2153814
Test: manual verification

Change-Id: I082e6bb098e9be5d9e26d0941efcf6f28ab01e1d
parent 5f797922
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1159,7 +1159,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    public static final int IMPORTANT_FOR_AUTOFILL_YES = 0x1;
    /**
     * The view is not important for autofill, and its children (if any) will be traversed.
     * The view is not important for autofill, but its children (if any) will be traversed.
     */
    public static final int IMPORTANT_FOR_AUTOFILL_NO = 0x2;
+2 −1
Original line number Diff line number Diff line
@@ -1081,7 +1081,8 @@ public final class AutofillManager {
        return view;
    }

    private boolean hasAutofillFeature() {
    /** @hide */
    public boolean hasAutofillFeature() {
        return mService != null;
    }

+0 −18
Original line number Diff line number Diff line
@@ -219,24 +219,6 @@ public final class AutofillManagerService extends SystemService {
        return mServicesCache.get(resolvedUserId);
    }

    // Called by Shell command.
    void requestSaveForUser(int userId) {
        Slog.i(TAG, "requestSaveForUser(): " + userId);
        mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG);
        final IBinder activityToken = getTopActivityForUser();
        if (activityToken != null) {
            synchronized (mLock) {
                final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
                if (service == null) {
                    Log.w(TAG, "handleSaveForUser(): no cached service for userId " + userId);
                    return;
                }

                service.requestSaveForUserLocked(activityToken);
            }
        }
    }

    // Called by Shell command.
    void destroySessions(int userId, IResultReceiver receiver) {
        Slog.i(TAG, "destroySessions() for userId " + userId);
+0 −11
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand {
        }
        final PrintWriter pw = getOutPrintWriter();
        switch (cmd) {
            case "save":
                return requestSave();
            case "list":
                return requestList(pw);
            case "destroy":
@@ -71,21 +69,12 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand {
            pw.println("  destroy sessions [--user USER_ID]");
            pw.println("    Destroy all pending sessions.");
            pw.println("");
            pw.println("  save [--user USER_ID]");
            pw.println("    Request provider to save contents of the top activity.");
            pw.println("");
            pw.println("  reset");
            pw.println("    Reset all pending sessions and cached service connections.");
            pw.println("");
        }
    }

    private int requestSave() {
        final int userId = getUserIdFromArgsOrCurrentUser();
        mService.requestSaveForUser(userId);
        return 0;
    }

    private int requestDestroy(PrintWriter pw) {
        if (!isNextArgSessions(pw)) {
            return -1;