diff options
4 files changed, 15 insertions, 0 deletions
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 459b48fc5423..ae28797c32aa 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -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> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index fa13fbf93267..741115c6f135 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -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" /> diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 801769cc42e1..b02db18a4c86 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -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(); diff --git a/services/autofill/java/com/android/server/autofill/ui/AutoFillUI.java b/services/autofill/java/com/android/server/autofill/ui/AutoFillUI.java index 832ff9a4435c..257256dc58e7 100644 --- a/services/autofill/java/com/android/server/autofill/ui/AutoFillUI.java +++ b/services/autofill/java/com/android/server/autofill/ui/AutoFillUI.java @@ -89,6 +89,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. + */ public void showError(@Nullable CharSequence message) { mHandler.post(() -> { if (!hasCallback()) { |