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

Commit 971ad7aa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clarified FillCallback and SaveCallback behaviors." into pi-dev

parents 82b41342 deff81b1
Loading
Loading
Loading
Loading
+30 −9
Original line number Diff line number Diff line
@@ -39,13 +39,20 @@ public final class FillCallback {
    }

    /**
     * Notifies the Android System that an
     * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
     * FillCallback)} was successfully fulfilled by the service.
     * Notifies the Android System that a fill request
     * ({@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
     * FillCallback)}) was successfully fulfilled by the service.
     *
     * <p>This method should always be called, even if the service doesn't have the heuristics to
     * fulfill the request (in which case it should be called with {@code null}).
     *
     * <p>See the main {@link AutofillService} documentation for more details and examples.
     *
     * @param response autofill information for that activity, or {@code null} when the service
     * cannot autofill the activity.
     *
     * @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
     * {@link FillResponse} for examples.
     * @throws IllegalStateException if this method or {@link #onFailure(CharSequence)} was already
     * called.
     */
    public void onSuccess(@Nullable FillResponse response) {
        assertNotCalled();
@@ -63,11 +70,25 @@ public final class FillCallback {
    }

    /**
     * Notifies the Android System that an
     * Notifies the Android System that a fill request (
     * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
     * FillCallback)} could not be fulfilled by the service.
     * FillCallback)}) could not be fulfilled by the service (for example, because the user data was
     * not available yet), so the request could be retried later.
     *
     * <p><b>Note: </b>this method should not be used when the service didn't have the heursitics to
     * fulfill the request; in this case, the service should call {@link #onSuccess(FillResponse)
     * onSuccess(null)} instead.
     *
     * <p><b>Note: </b>on Android versions up to {@link android.os.Build.VERSION_CODES#P}, this
     * method is not working as intended, and the service should call
     * {@link #onSuccess(FillResponse) onSuccess(null)} instead.
     *
     * @param message error message to be displayed to the user. <b>Note: </b> this message is
     * displayed on {@code logcat} logs and should not contain PII (Personally Identifiable
     * Information, such as username or email address).
     *
     * @param message error message to be displayed to the user.
     * @throws IllegalStateException if this method or {@link #onSuccess(FillResponse)} was already
     * called.
     */
    public void onFailure(@Nullable CharSequence message) {
        assertNotCalled();
+12 −1
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ public final class SaveCallback {
     * Notifies the Android System that an
     * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)} was successfully handled
     * by the service.
     *
     * @throws IllegalStateException if this method, {@link #onSuccess(IntentSender)}, or
     * {@link #onFailure(CharSequence)} was already called.
     */
    public void onSuccess() {
        onSuccessInternal(null);
@@ -58,6 +61,9 @@ public final class SaveCallback {
     *
     * @param intentSender intent that will be launched from the context of activity being
     * autofilled.
     *
     * @throws IllegalStateException if this method, {@link #onSuccess()},
     * or {@link #onFailure(CharSequence)} was already called.
     */
    public void onSuccess(@NonNull IntentSender intentSender) {
        onSuccessInternal(Preconditions.checkNotNull(intentSender));
@@ -86,7 +92,12 @@ public final class SaveCallback {
     * you prefer to show your own message, call {@link #onSuccess()} or
     * {@link #onSuccess(IntentSender)} instead.
     *
     * @param message error message to be displayed to the user.
     * @param message error message to be displayed to the user. <b>Note: </b> this message is
     * displayed on {@code logcat} logs and should not contain PII (Personally Identifiable
     * Information, such as username or email address).
     *
     * @throws IllegalStateException if this method, {@link #onSuccess()},
     * or {@link #onSuccess(IntentSender)} was already called.
     */
    public void onFailure(CharSequence message) {
        assertNotCalled();