Merge "Some Autofill API changes." into oc-dev

am: fe1bddfbb5

Change-Id: I682065cd5fcfb2de9639874705fefdeaed06d343
This commit is contained in:
Felipe Leme
2017-04-19 05:13:19 +00:00
committed by android-build-merger
11 changed files with 62 additions and 30 deletions

View File

@@ -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);
}
@@ -45943,7 +45944,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

View File

@@ -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);
}
@@ -49518,7 +49519,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

View File

@@ -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);
}
@@ -46329,7 +46330,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

View File

@@ -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);
}

View File

@@ -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.
*/

View File

@@ -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
@@ -257,6 +256,19 @@ public final class FillResponse implements Parcelable {
return setAuthentication(null, authentication, presentation);
}
/**
* 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.
*
@@ -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

View File

@@ -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.
*

View File

@@ -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:
*

View File

@@ -1135,26 +1135,38 @@ 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.
@@ -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

View File

@@ -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.
*

View File

@@ -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;