Ignores Resources.NotFoundException when setting ViewStructure.setTestIdEntry().
Test: manual verification using com.facebook.katana
Fixes: 71695541
Change-Id: Idefc7d3799f2ef5525a5050d63ca29a19cab730a
(cherry picked from commit 01f4f03188588d917f59d1c2737ee7bd27891dda)
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 73d53d4..dc54127 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -311,7 +311,6 @@
public class TextView extends View implements ViewTreeObserver.OnPreDrawListener {
static final String LOG_TAG = "TextView";
static final boolean DEBUG_EXTRACT = false;
- static final boolean DEBUG_AUTOFILL = false;
private static final float[] TEMP_POSITION = new float[2];
// Enum for the "typeface" XML parameter.
@@ -9516,7 +9515,7 @@
}
final AutofillManager afm = mContext.getSystemService(AutofillManager.class);
if (afm != null) {
- if (DEBUG_AUTOFILL) {
+ if (android.view.autofill.Helper.sVerbose) {
Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + mText);
}
afm.notifyValueChanged(TextView.this);
@@ -10296,7 +10295,14 @@
if (forAutofill) {
structure.setDataIsSensitive(!mSetFromXmlOrResourceId);
if (mTextId != ResourceId.ID_NULL) {
- structure.setTextIdEntry(getResources().getResourceEntryName(mTextId));
+ try {
+ structure.setTextIdEntry(getResources().getResourceEntryName(mTextId));
+ } catch (Resources.NotFoundException e) {
+ if (android.view.autofill.Helper.sVerbose) {
+ Log.v(LOG_TAG, "onProvideAutofillStructure(): cannot set name for text id "
+ + mTextId + ": " + e.getMessage());
+ }
+ }
}
}