diff options
| author | 2021-01-15 21:56:54 +0000 | |
|---|---|---|
| committer | 2021-01-15 21:56:54 +0000 | |
| commit | 3b59bf746e07dbcdabb849b40528eca19cfe0e91 (patch) | |
| tree | cbdc53e3b47cda3c4603d9e3fa0766543b1fc404 | |
| parent | 8cd1b0c242c141cbac55f286fefd5434b3cea56a (diff) | |
| parent | 98fcc0850d0ef2702ab700498d9297afd839b526 (diff) | |
Merge "Enable Content Capture for ImageViews by default"
| -rw-r--r-- | core/java/android/widget/ImageView.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index e4de4001c3e2..ed20d26a8b47 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -196,11 +196,6 @@ public class ImageView extends View { initImageView(); - // ImageView is not important by default, unless app developer overrode attribute. - if (getImportantForAutofill() == IMPORTANT_FOR_AUTOFILL_AUTO) { - setImportantForAutofill(IMPORTANT_FOR_AUTOFILL_NO); - } - final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.ImageView, defStyleAttr, defStyleRes); saveAttributeDataForStyleable(context, R.styleable.ImageView, @@ -265,6 +260,15 @@ public class ImageView extends View { sCompatDrawableVisibilityDispatch = targetSdkVersion < Build.VERSION_CODES.N; sCompatDone = true; } + + // By default, ImageView is not important for autofill but important for content capture. + // Developers can override these defaults via the corresponding attributes. + if (getImportantForAutofill() == IMPORTANT_FOR_AUTOFILL_AUTO) { + setImportantForAutofill(IMPORTANT_FOR_AUTOFILL_NO); + } + if (getImportantForContentCapture() == IMPORTANT_FOR_CONTENT_CAPTURE_AUTO) { + setImportantForContentCapture(IMPORTANT_FOR_CONTENT_CAPTURE_YES); + } } @Override |