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

Commit c7ed8c39 authored by Felipe Leme's avatar Felipe Leme
Browse files

Shows a Toast when manual autofill request cannot be fulfilled.

Bug: 35708229
Test: manual verification
Change-Id: If4fa6556dd94a805727329f0aebc4b37f548b3a1
parent fe0277c0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4585,6 +4585,9 @@
    <!-- Accessibility title for the autofill dialog used to select a list of options to autofill an activity. [CHAR LIMIT=NONE] -->
    <string name="autofill_picker_accessibility_title">Autofill options</string>

    <!-- Toast message shown when user manually request autofill but service could not figure out the data that would autofill the screen contents. [CHAR LIMIT=NONE] -->
    <string name="autofill_error_cannot_autofill">Contents can\u2019t be autofilled</string>

    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, but the service does not know what the activity represents [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title">Save to <xliff:g id="label" example="MyPass">%1$s</xliff:g>?</string>
+1 −0
Original line number Diff line number Diff line
@@ -2874,6 +2874,7 @@
  <java-symbol type="id" name="autofill_save_no" />
  <java-symbol type="id" name="autofill_save_yes" />
  <java-symbol type="id" name="autofill_save_close" />
  <java-symbol type="string" name="autofill_error_cannot_autofill" />
  <java-symbol type="string" name="autofill" />
  <java-symbol type="string" name="autofill_picker_accessibility_title " />
  <java-symbol type="string" name="autofill_save_title" />
+4 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.view.autofill.AutofillValue;
import android.view.autofill.IAutoFillManagerClient;
import android.view.autofill.IAutofillWindowPresenter;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -181,6 +182,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    public void onFillRequestSuccess(@Nullable FillResponse response,
            @NonNull String servicePackageName) {
        if (response == null) {
            if ((mFlags & FLAG_MANUAL_REQUEST) != 0) {
                getUiForShowing().showError(R.string.autofill_error_cannot_autofill);
            }
            // Nothing to be done, but need to notify client.
            notifyUnavailableToClient();
            removeSelf();
+7 −0
Original line number Diff line number Diff line
@@ -86,6 +86,13 @@ public final class AutoFillUI {
        });
    }

    /**
     * Displays an error message to the user.
     */
    public void showError(int resId) {
        showError(mContext.getString(resId));
    }

    /**
     * Displays an error message to the user.
     */