OSDN Git Service

Provide support for optimized ACTION_REQUEST_SET_AUTOFILL_SERVICE.
authorFelipe Leme <felipeal@google.com>
Tue, 25 Apr 2017 22:54:06 +0000 (15:54 -0700)
committerFelipe Leme <felipeal@google.com>
Wed, 26 Apr 2017 19:07:17 +0000 (12:07 -0700)
Also removed obsolete 'cmd autofill save'

Bug: 2153814
Test: manual verification

Change-Id: I082e6bb098e9be5d9e26d0941efcf6f28ab01e1d

core/java/android/view/View.java
core/java/android/view/autofill/AutofillManager.java
services/autofill/java/com/android/server/autofill/AutofillManagerService.java
services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java

index 64489b4..34aecdc 100644 (file)
@@ -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;
 
index caf188d..6e02a84 100644 (file)
@@ -1081,7 +1081,8 @@ public final class AutofillManager {
         return view;
     }
 
-    private boolean hasAutofillFeature() {
+    /** @hide */
+    public boolean hasAutofillFeature() {
         return mService != null;
     }
 
index 88adbf4..d424d38 100644 (file)
@@ -220,24 +220,6 @@ public final class AutofillManagerService extends SystemService {
     }
 
     // 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);
         mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG);
index 6debc2f..62226e3 100644 (file)
@@ -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;