Some Autofill API changes.
- Added View.IMPORTANT_FOR_AUTOFILL_YES_INCLUDE_DESCENDANTS
- Added View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS
- Added FillResponse.Builder.setIgnoredIds()
- Fixed javadoc links.
These changes are not implemented yet....
Bug: 37424141
Bug: 36171235
Test: m update-api
Change-Id: I604960443ab08cd3f2a84a70b0a2cece7cb0a00c
diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java
index 5e49b8f..b3d5522 100644
--- a/core/java/android/service/autofill/AutofillService.java
+++ b/core/java/android/service/autofill/AutofillService.java
@@ -247,7 +247,7 @@
* @param callback object used to notify the result of the request.
*/
public void onSaveRequest(@NonNull SaveRequest request, @NonNull SaveCallback callback) {
- List<FillContext> contexts = request.getFillContexts();
+ final List<FillContext> contexts = request.getFillContexts();
onSaveRequest(contexts.get(contexts.size() - 1).getStructure(),
request.getClientState(), callback);
}
diff --git a/core/java/android/service/autofill/FillCallback.java b/core/java/android/service/autofill/FillCallback.java
index a009be8..7774bdd 100644
--- a/core/java/android/service/autofill/FillCallback.java
+++ b/core/java/android/service/autofill/FillCallback.java
@@ -18,7 +18,6 @@
import android.annotation.Nullable;
import android.app.Activity;
-import android.os.Bundle;
import android.os.RemoteException;
/**
@@ -38,8 +37,8 @@
/**
* Notifies the Android System that an
- * {@link AutofillService#onFillRequest(android.app.assist.AssistStructure, Bundle,
- * int, android.os.CancellationSignal, FillCallback)} was successfully fulfilled by the service.
+ * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
+ * FillCallback)} was successfully fulfilled by the service.
*
* @param response autofill information for that activity, or {@code null} when the activity
* cannot be autofilled (for example, if it only contains read-only fields). See
@@ -57,9 +56,8 @@
/**
* Notifies the Android System that an
- * {@link AutofillService#onFillRequest(android.app.assist.AssistStructure,
- * Bundle, int, android.os.CancellationSignal, FillCallback)}
- * could not be fulfilled by the service.
+ * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
+ * FillCallback)} could not be fulfilled by the service.
*
* @param message error message to be displayed to the user.
*/
diff --git a/core/java/android/service/autofill/FillResponse.java b/core/java/android/service/autofill/FillResponse.java
index 8c8060a..0025365 100644
--- a/core/java/android/service/autofill/FillResponse.java
+++ b/core/java/android/service/autofill/FillResponse.java
@@ -32,8 +32,7 @@
/**
* Response for a {@link
- * AutofillService#onFillRequest(android.app.assist.AssistStructure,
- * Bundle, int, android.os.CancellationSignal, FillCallback)}.
+ * AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)}.
*
* <p>The response typically contains one or more {@link Dataset}s, each representing a set of
* fields that can be autofilled together, and the Android system displays a dataset picker UI
@@ -258,6 +257,19 @@
}
/**
+ * Specifies views that should not trigger new
+ * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
+ * FillCallback)} requests.
+ *
+ * <p>This is typically used when the service cannot autofill the view; for example, an
+ * {@code EditText} representing a captcha.
+ */
+ public Builder setIgnoredIds(AutofillId...ids) {
+ // TODO: implement
+ return this;
+ }
+
+ /**
* Adds a new {@link Dataset} to this response.
*
* @return This builder.
@@ -289,6 +301,9 @@
return this;
}
+ /**
+ * @deprecated Use {@link #setClientState(Bundle)} instead.
+ */
@Deprecated
public Builder setExtras(@Nullable Bundle extras) {
throwIfDestroyed();
@@ -299,11 +314,9 @@
/**
* Sets a {@link Bundle state} that will be passed to subsequent APIs that
* manipulate this response. For example, they are passed to subsequent
- * calls to {@link AutofillService#onFillRequest(
- * android.app.assist.AssistStructure, Bundle, int,
- * android.os.CancellationSignal, FillCallback)} and {@link AutofillService#onSaveRequest(
- * android.app.assist.AssistStructure, Bundle, SaveCallback)}. You can use
- * this to store intermediate state that is persistent across multiple
+ * calls to {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
+ * FillCallback)} and {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)}.
+ * You can use this to store intermediate state that is persistent across multiple
* fill requests and the subsequent save request.
*
* <p>If this method is called on multiple {@link FillResponse} objects for the same
diff --git a/core/java/android/service/autofill/SaveCallback.java b/core/java/android/service/autofill/SaveCallback.java
index 2c4ba6c..3a70138 100644
--- a/core/java/android/service/autofill/SaveCallback.java
+++ b/core/java/android/service/autofill/SaveCallback.java
@@ -17,7 +17,6 @@
package android.service.autofill;
import android.app.Activity;
-import android.os.Bundle;
import android.os.RemoteException;
/**
@@ -35,8 +34,8 @@
/**
* Notifies the Android System that an
- * {@link AutofillService#onSaveRequest (android.app.assist.AssistStructure, Bundle,
- * SaveCallback)} was successfully fulfilled by the service.
+ * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)} was successfully fulfilled
+ * by the service.
*
* @throws RuntimeException if an error occurred while calling the Android System.
*/
@@ -52,8 +51,8 @@
/**
* Notifies the Android System that an
- * {@link AutofillService#onSaveRequest(android.app.assist.AssistStructure, Bundle,
- * SaveCallback)} could not be fulfilled by the service.
+ * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)} could not be fulfilled
+ * by the service.
*
* @param message error message to be displayed to the user.
*
diff --git a/core/java/android/service/autofill/SaveInfo.java b/core/java/android/service/autofill/SaveInfo.java
index 915d4f7..f796444 100644
--- a/core/java/android/service/autofill/SaveInfo.java
+++ b/core/java/android/service/autofill/SaveInfo.java
@@ -40,7 +40,7 @@
/**
* Information used to indicate that an {@link AutofillService} is interested on saving the
* user-inputed data for future use, through a
- * {@link AutofillService#onSaveRequest(android.app.assist.AssistStructure, Bundle, SaveCallback)}
+ * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)}
* call.
*
* <p>A {@link SaveInfo} is always associated with a {@link FillResponse}, and it contains at least
@@ -94,7 +94,7 @@
* </pre>
*
* The
- * {@link AutofillService#onSaveRequest(android.app.assist.AssistStructure, Bundle, SaveCallback)}
+ * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)}
* is triggered after a call to {@link AutofillManager#commit()}, but only when all conditions
* below are met:
*
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 928e3659..9df7de8 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1135,27 +1135,39 @@
@IntDef({
IMPORTANT_FOR_AUTOFILL_AUTO,
IMPORTANT_FOR_AUTOFILL_YES,
- IMPORTANT_FOR_AUTOFILL_NO
+ IMPORTANT_FOR_AUTOFILL_NO,
+ IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS,
+ IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS
})
@Retention(RetentionPolicy.SOURCE)
public @interface AutofillImportance {}
/**
- * Automatically determine whether a view is important for auto-fill.
+ * Automatically determine whether a view is important for autofill.
*/
public static final int IMPORTANT_FOR_AUTOFILL_AUTO = 0x0;
/**
- * The view is important for important for auto-fill.
+ * The view is important for autofill, and its children (if any) will be traversed.
*/
public static final int IMPORTANT_FOR_AUTOFILL_YES = 0x1;
/**
- * The view is not important for auto-fill.
+ * The view is not important for autofill, and its children (if any) will be traversed.
*/
public static final int IMPORTANT_FOR_AUTOFILL_NO = 0x2;
/**
+ * The view is important for autofill, but its children (if any) will not be traversed.
+ */
+ public static final int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS = 0x4;
+
+ /**
+ * The view is not important for autofill, and its children (if any) will not be traversed.
+ */
+ public static final int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS = 0x8;
+
+ /**
* This view is enabled. Interpretation varies by subclass.
* Use with ENABLED_MASK when calling setFlags.
* {@hide}
@@ -7568,7 +7580,7 @@
* should use {@link #setImportantForAutofill(int)} instead.
*
* <p><strong>Note:</strong> returning {@code false} does not guarantee the view will be
- * excluded from the structure; for example, if the user explicitly requested auto-fill, the
+ * excluded from the structure; for example, if the user explicitly requested autofill, the
* View might be always included.
*
* <p>This decision applies just for the view, not its children - if the view children are not
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
index b157709..92b0d98 100644
--- a/core/java/android/view/ViewStructure.java
+++ b/core/java/android/view/ViewStructure.java
@@ -326,8 +326,8 @@
/**
* Sets whether the data on this node is sensitive; if it is, then its content (text, autofill
* value, etc..) is striped before calls to {@link
- * android.service.autofill.AutofillService#onFillRequest(android.app.assist.AssistStructure,
- * Bundle, int, android.os.CancellationSignal, android.service.autofill.FillCallback)}.
+ * android.service.autofill.AutofillService#onFillRequest(android.service.autofill.FillRequest,
+ * android.os.CancellationSignal, android.service.autofill.FillCallback)}.
*
* <p>By default, all nodes are assumed to be sensitive, and only nodes that does not have PII
* (Personally Identifiable Information - sensitive data such as email addresses, credit card
@@ -336,8 +336,8 @@
*
* <p>Notice that the content of even sensitive nodes are sent to the service (through the
* {@link
- * android.service.autofill.AutofillService#onSaveRequest(android.app.assist.AssistStructure,
- * Bundle, android.service.autofill.SaveCallback)} call) when the user consented to save
+ * android.service.autofill.AutofillService#onSaveRequest(android.service.autofill.SaveRequest,
+ * android.service.autofill.SaveCallback)} call) when the user consented to save
* thedata, so it is important to set the content of sensitive nodes as well, but mark them as
* sensitive.
*
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index f9f400d..8f0b6c1 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -105,6 +105,7 @@
*
* @deprecated Use {@link android.service.autofill.FillRequest#FLAG_MANUAL_REQUEST}
*/
+ // TODO(b/33197203): remove
@Deprecated
public static final int FLAG_MANUAL_REQUEST = 0x1;