From 85cee7ab388fda5393bac3b268cc15780579da39 Mon Sep 17 00:00:00 2001 From: Jiaquan He Date: Tue, 18 Apr 2017 15:39:59 -0700 Subject: [PATCH] Opt out default focus highlight for TV. Test: Checked that the default focus highlight doesn't show on TV. Bug: 37160940 Change-Id: Id3719ce1aa602ba6792cc94c9fa034670509cda0 --- core/java/android/view/View.java | 9 ++++++++- core/res/res/values-television/config.xml | 3 +++ core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 4f0aa32f59bb2..9ab6775310f4f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3887,6 +3887,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private Drawable mDefaultFocusHighlight; private Drawable mDefaultFocusHighlightCache; private boolean mDefaultFocusHighlightSizeChanged; + /** + * True if the default focus highlight is needed on the target device. + */ + private static boolean sUseDefaultFocusHighlight; private String mTransitionName; @@ -4464,6 +4468,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, sAutoFocusableOffUIThreadWontNotifyParents = targetSdkVersion < Build.VERSION_CODES.O; + sUseDefaultFocusHighlight = context.getResources().getBoolean( + com.android.internal.R.bool.config_useDefaultFocusHighlight); + sCompatibilityDone = true; } } @@ -19677,7 +19684,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, final boolean hasFocusStateSpecified = background == null || !background.isStateful() || !background.hasFocusStateSpecified(); return !isInTouchMode() && getDefaultFocusHighlightEnabled() && hasFocusStateSpecified - && isAttachedToWindow(); + && isAttachedToWindow() && sUseDefaultFocusHighlight; } /** diff --git a/core/res/res/values-television/config.xml b/core/res/res/values-television/config.xml index 78eeee99150a6..d62b93efc1a19 100644 --- a/core/res/res/values-television/config.xml +++ b/core/res/res/values-television/config.xml @@ -36,4 +36,7 @@ 0x55 + + + false diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6a31e161842be..5feed65bd8d23 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2830,4 +2830,7 @@ specified name exists on the device, autofill will be disabled by default. --> + + + true diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 907294d744f7b..1dd8227edafda 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -427,6 +427,7 @@ +