Merge "Shows a Toast when manual autofill request cannot be fulfilled." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-06 21:06:43 +00:00
committed by Android (Google) Code Review
4 changed files with 15 additions and 0 deletions

View File

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

View File

@@ -2875,6 +2875,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" />

View File

@@ -57,6 +57,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;
@@ -190,6 +191,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();

View File

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