Sets accessibility title for autofill dataset picker.

Bug: 34219631
Test: CtsAutoFillServiceTestCases (with new tests) pass

Change-Id: I9bda820a41ef82e008f2a1ffd32c286b91841c10
This commit is contained in:
Felipe Leme
2017-03-16 14:36:47 -07:00
parent 180f5e918c
commit b4f868deca
4 changed files with 39 additions and 11 deletions

View File

@@ -4567,22 +4567,25 @@
<!-- Accessibility string used for describing the button in time picker that changes the dialog to circular clock mode. [CHAR LIMIT=NONE] -->
<string name="time_picker_radial_mode_description">Switch to clock mode for the time input.</string>
<!-- Title for the auto-fill save dialog shown when the the contents of the activity can be saved
by an auto-fill service, but the service does not know what the activity represents [CHAR LIMIT=NONE] -->
<!-- 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>
<!-- 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>
<!-- Title for the auto-fill save dialog shown when the the contents of the activity can be saved
by an auto-fill service, and the service does knows what the activity represents (for example, credit card info) [CHAR LIMIT=NONE] -->
<!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
by an autofill service, and the service does knows what the activity represents (for example, credit card info) [CHAR LIMIT=NONE] -->
<string name="autofill_save_title_with_type">Save <xliff:g id="type" example="Credit Card">%1$s</xliff:g> to <xliff:g id="label" example="MyPass">%2$s</xliff:g>?</string>
<!-- Label for the auto-fill save button [CHAR LIMIT=NONE] -->
<!-- Label for the autofill save button [CHAR LIMIT=NONE] -->
<string name="autofill_save_yes">Save</string>
<!-- Label for the auto-fill cancel button [CHAR LIMIT=NONE] -->
<!-- Label for the autofill cancel button [CHAR LIMIT=NONE] -->
<string name="autofill_save_no">No thanks</string>
<!-- Label for the type of data being saved for auto-fill when it represent user credentials with a password [CHAR LIMIT=NONE] -->
<!-- Label for the type of data being saved for autofill when it represent user credentials with a password [CHAR LIMIT=NONE] -->
<string name="autofill_save_type_password">password</string>
<!-- Label for the type of data being saved for auto-fill when it represent an address (street, city, etc.) [CHAR LIMIT=NONE] -->
<!-- Label for the type of data being saved for autofill when it represent an address (street, city, etc.) [CHAR LIMIT=NONE] -->
<string name="autofill_save_type_address">address</string>
<!-- Label for the type of data being saved for auto-fill when it represents a credit card [CHAR LIMIT=NONE] -->
<!-- Label for the type of data being saved for autofill when it represents a credit card [CHAR LIMIT=NONE] -->
<string name="autofill_save_type_credit_card">credit card</string>
</resources>

View File

@@ -2848,6 +2848,7 @@
<java-symbol type="id" name="autofill_save_yes" />
<java-symbol type="id" name="autofill_save_close" />
<java-symbol type="string" name="autofill" />
<java-symbol type="string" name="autofill_picker_accessibility_title " />
<java-symbol type="string" name="autofill_save_title" />
<java-symbol type="string" name="autofill_save_title_with_type" />
<java-symbol type="string" name="autofill_save_yes" />

View File

@@ -247,11 +247,17 @@ public final class AutoFillUI {
}
public void dump(PrintWriter pw) {
pw.println("AufoFill UI");
pw.println("Autofill UI");
final String prefix = " ";
pw.print(prefix); pw.print("showsFillUi: "); pw.println(mFillUi != null);
final String prefix2 = " ";
pw.print(prefix); pw.print("showsSaveUi: "); pw.println(mSaveUi != null);
pw.print(prefix); pw.print("save timeout: "); pw.println(mSaveTimeoutMs);
if (mFillUi != null) {
pw.print(prefix); pw.println("showsFillUi: true");
mFillUi.dump(pw, prefix2);
} else {
pw.print(prefix); pw.println("showsFillUi: false");
}
}
@android.annotation.UiThread

View File

@@ -39,6 +39,7 @@ import android.widget.ListView;
import com.android.internal.R;
import libcore.util.Objects;
import java.io.PrintWriter;
import java.util.ArrayList;
final class FillUi {
@@ -63,6 +64,7 @@ final class FillUi {
private final @Nullable ArrayAdapter<ViewItem> mAdapter;
private @Nullable String mFilterText;
private final String mAccessibilityTitle;
private int mContentWidth;
private int mContentHeight;
@@ -76,6 +78,8 @@ final class FillUi {
mAnchorBounds.set(anchorBounds);
mCallback = callback;
mAccessibilityTitle = context.getString(R.string.autofill_picker_accessibility_title);
if (response.getAuthentication() != null) {
mListView = null;
mAdapter = null;
@@ -319,6 +323,7 @@ final class FillUi {
public void show(int desiredWidth, int desiredHeight, Rect anchorBounds) {
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.setTitle("FillUi");
params.token = mActivityToken;
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
@@ -327,6 +332,7 @@ final class FillUi {
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
params.accessibilityTitle = mAccessibilityTitle;
mWm.getDefaultDisplay().getRealSize(mTempPoint);
final int screenWidth = mTempPoint.x;
@@ -377,4 +383,16 @@ final class FillUi {
}
}
}
public void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("mAnchorBounds: "); pw.println(mAnchorBounds);
pw.print(prefix); pw.print("mCallback: "); pw.println(mCallback != null);
pw.print(prefix); pw.print("mListView: "); pw.println(mListView);
pw.print(prefix); pw.print("mAdapter: "); pw.println(mAdapter != null);
pw.print(prefix); pw.print("mFilterText: "); pw.println(mFilterText);
pw.print(prefix); pw.print("mAccessibilityTitle: "); pw.println(mAccessibilityTitle);
pw.print(prefix); pw.print("mContentWidth: "); pw.println(mContentWidth);
pw.print(prefix); pw.print("mContentHeight: "); pw.println(mContentHeight);
pw.print(prefix); pw.print("mDestroyed: "); pw.println(mDestroyed);
}
}