diff options
author | 2017-04-19 05:05:44 +0000 | |
---|---|---|
committer | 2017-04-19 05:05:48 +0000 | |
commit | fe1bddfbb54c20156b45e99c9d18166d702c9adb (patch) | |
tree | 7ba079aee06e94eec80e3553e40432aa17eecc16 | |
parent | 9cd92959e65e829553ea808976eebff68ea09678 (diff) | |
parent | e5f9c30688f0277505fb6b50ea385e5df6271ed8 (diff) |
Merge "Some Autofill API changes." into oc-dev
-rw-r--r-- | api/current.txt | 3 | ||||
-rw-r--r-- | api/system-current.txt | 3 | ||||
-rw-r--r-- | api/test-current.txt | 3 | ||||
-rw-r--r-- | core/java/android/service/autofill/AutofillService.java | 2 | ||||
-rw-r--r-- | core/java/android/service/autofill/FillCallback.java | 10 | ||||
-rw-r--r-- | core/java/android/service/autofill/FillResponse.java | 27 | ||||
-rw-r--r-- | core/java/android/service/autofill/SaveCallback.java | 9 | ||||
-rw-r--r-- | core/java/android/service/autofill/SaveInfo.java | 4 | ||||
-rw-r--r-- | core/java/android/view/View.java | 22 | ||||
-rw-r--r-- | core/java/android/view/ViewStructure.java | 8 | ||||
-rw-r--r-- | core/java/android/view/autofill/AutofillManager.java | 1 |
11 files changed, 62 insertions, 30 deletions
diff --git a/api/current.txt b/api/current.txt index 01e6515b3dd2..afb456907b29 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37113,6 +37113,7 @@ package android.service.autofill { method public android.service.autofill.FillResponse.Builder setAuthentication(android.view.autofill.AutofillId[], android.content.IntentSender, android.widget.RemoteViews); method public android.service.autofill.FillResponse.Builder setClientState(android.os.Bundle); method public deprecated android.service.autofill.FillResponse.Builder setExtras(android.os.Bundle); + method public android.service.autofill.FillResponse.Builder setIgnoredIds(android.view.autofill.AutofillId...); method public android.service.autofill.FillResponse.Builder setSaveInfo(android.service.autofill.SaveInfo); } @@ -45942,7 +45943,9 @@ package android.view { field public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1; // 0x1 field public static final int IMPORTANT_FOR_AUTOFILL_AUTO = 0; // 0x0 field public static final int IMPORTANT_FOR_AUTOFILL_NO = 2; // 0x2 + field public static final int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS = 8; // 0x8 field public static final int IMPORTANT_FOR_AUTOFILL_YES = 1; // 0x1 + field public static final int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS = 4; // 0x4 field public static final int INVISIBLE = 4; // 0x4 field public static final int KEEP_SCREEN_ON = 67108864; // 0x4000000 field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2 diff --git a/api/system-current.txt b/api/system-current.txt index 9ad12c53ab9a..84b9da98f526 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40225,6 +40225,7 @@ package android.service.autofill { method public android.service.autofill.FillResponse.Builder setAuthentication(android.view.autofill.AutofillId[], android.content.IntentSender, android.widget.RemoteViews); method public android.service.autofill.FillResponse.Builder setClientState(android.os.Bundle); method public deprecated android.service.autofill.FillResponse.Builder setExtras(android.os.Bundle); + method public android.service.autofill.FillResponse.Builder setIgnoredIds(android.view.autofill.AutofillId...); method public android.service.autofill.FillResponse.Builder setSaveInfo(android.service.autofill.SaveInfo); } @@ -49517,7 +49518,9 @@ package android.view { field public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1; // 0x1 field public static final int IMPORTANT_FOR_AUTOFILL_AUTO = 0; // 0x0 field public static final int IMPORTANT_FOR_AUTOFILL_NO = 2; // 0x2 + field public static final int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS = 8; // 0x8 field public static final int IMPORTANT_FOR_AUTOFILL_YES = 1; // 0x1 + field public static final int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS = 4; // 0x4 field public static final int INVISIBLE = 4; // 0x4 field public static final int KEEP_SCREEN_ON = 67108864; // 0x4000000 field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2 diff --git a/api/test-current.txt b/api/test-current.txt index 907b6e6c97b7..0ca882a11795 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37266,6 +37266,7 @@ package android.service.autofill { method public android.service.autofill.FillResponse.Builder setAuthentication(android.view.autofill.AutofillId[], android.content.IntentSender, android.widget.RemoteViews); method public android.service.autofill.FillResponse.Builder setClientState(android.os.Bundle); method public deprecated android.service.autofill.FillResponse.Builder setExtras(android.os.Bundle); + method public android.service.autofill.FillResponse.Builder setIgnoredIds(android.view.autofill.AutofillId...); method public android.service.autofill.FillResponse.Builder setSaveInfo(android.service.autofill.SaveInfo); } @@ -46312,7 +46313,9 @@ package android.view { field public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1; // 0x1 field public static final int IMPORTANT_FOR_AUTOFILL_AUTO = 0; // 0x0 field public static final int IMPORTANT_FOR_AUTOFILL_NO = 2; // 0x2 + field public static final int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS = 8; // 0x8 field public static final int IMPORTANT_FOR_AUTOFILL_YES = 1; // 0x1 + field public static final int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS = 4; // 0x4 field public static final int INVISIBLE = 4; // 0x4 field public static final int KEEP_SCREEN_ON = 67108864; // 0x4000000 field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2 diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 8fcb87c5c0d0..813c54f53db9 100644 --- a/core/java/android/service/autofill/AutofillService.java +++ b/core/java/android/service/autofill/AutofillService.java @@ -247,7 +247,7 @@ public abstract class AutofillService extends Service { * @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 a009be805ce7..7774bdd4c410 100644 --- a/core/java/android/service/autofill/FillCallback.java +++ b/core/java/android/service/autofill/FillCallback.java @@ -18,7 +18,6 @@ package android.service.autofill; import android.annotation.Nullable; import android.app.Activity; -import android.os.Bundle; import android.os.RemoteException; /** @@ -38,8 +37,8 @@ public final class FillCallback { /** * 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 @@ public final class FillCallback { /** * 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 8c8060a608f0..002536517a87 100644 --- a/core/java/android/service/autofill/FillResponse.java +++ b/core/java/android/service/autofill/FillResponse.java @@ -32,8 +32,7 @@ import java.util.ArrayList; /** * 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 @@ public final class FillResponse implements Parcelable { } /** + * 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 @@ public final class FillResponse implements Parcelable { return this; } + /** + * @deprecated Use {@link #setClientState(Bundle)} instead. + */ @Deprecated public Builder setExtras(@Nullable Bundle extras) { throwIfDestroyed(); @@ -299,11 +314,9 @@ public final class FillResponse implements Parcelable { /** * 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 2c4ba6c57213..3a7013841729 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 @@ public final class SaveCallback { /** * 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 @@ public final class SaveCallback { /** * 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 915d4f792a31..f7964447fb7b 100644 --- a/core/java/android/service/autofill/SaveInfo.java +++ b/core/java/android/service/autofill/SaveInfo.java @@ -40,7 +40,7 @@ import java.util.Arrays; /** * 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 @@ import java.util.Arrays; * </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 928e365962d9..9df7de830ac9 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1135,27 +1135,39 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @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 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 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 b157709e5261..92b0d9817fc0 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -326,8 +326,8 @@ public abstract class ViewStructure { /** * 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 @@ public abstract class ViewStructure { * * <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 34e30564c10b..8ed0762a9e92 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -107,6 +107,7 @@ public final class AutofillManager { * * @deprecated Use {@link android.service.autofill.FillRequest#FLAG_MANUAL_REQUEST} */ + // TODO(b/33197203): remove @Deprecated public static final int FLAG_MANUAL_REQUEST = 0x1; |