diff options
author | Vadim Caen <caen@google.com> | 2019-07-24 16:24:33 +0200 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-07-25 04:11:38 +0000 |
commit | 64aa6e1ba1f5c96a4e5dc85a755f709b7c4b0e85 (patch) | |
tree | 6e660a75da71f15312972e0cf46a0600876570a6 | |
parent | 8756e456e67edbf4b604446f1ba2570391bf0204 (diff) | |
download | base-64aa6e1ba1f5c96a4e5dc85a755f709b7c4b0e85.tar.gz |
DO NOT MERGE Do not call drawableChanged pre Q
Some apps rely on not updating the window format when changing the
background of the DecorView. To keep the compatibilty with these app we
add only call DecoreView.drawableChanged() when the window background is
changed on app targetting Q and above.
Test: Manually test by lunching Instagram TV and pressing return twice.
The window should aninate with no flickering.
Bug: 136987724
Change-Id: I3593d30dc6f10519008151974e475f0dad86fc64
(cherry picked from commit 843f9dee8b3fa4ce5ba8981c74cf666c4db712cb)
-rw-r--r-- | core/java/android/view/View.java | 15 | ||||
-rw-r--r-- | core/java/com/android/internal/policy/DecorView.java | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index bf6191ec61eb..1275e46ed421 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -967,6 +967,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static boolean sBrokenInsetsDispatch; + /** + * Prior to Q, calling + * {@link com.android.internal.policy.DecorView#setBackgroundDrawable(Drawable)} + * did not call update the window format so the opacity of the background was not correctly + * applied to the window. Some applications rely on this misbehavior to work properly. + * <p> + * From Q, {@link com.android.internal.policy.DecorView#setBackgroundDrawable(Drawable)} is + * the same as {@link com.android.internal.policy.DecorView#setWindowBackground(Drawable)} + * which updates the window format. + * @hide + */ + protected static boolean sBrokenWindowBackground; + /** @hide */ @IntDef({NOT_FOCUSABLE, FOCUSABLE, FOCUSABLE_AUTO}) @Retention(RetentionPolicy.SOURCE) @@ -5104,6 +5117,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, sBrokenInsetsDispatch = ViewRootImpl.sNewInsetsMode != NEW_INSETS_MODE_FULL || targetSdkVersion < Build.VERSION_CODES.Q; + sBrokenWindowBackground = targetSdkVersion < Build.VERSION_CODES.Q; + sCompatibilityDone = true; } } diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index fe66cf9aab7d..7c52a40d4494 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -983,13 +983,14 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void setBackgroundDrawable(Drawable background) { - // TODO: This should route through setWindowBackground, but late in the release to make this // change. if (mOriginalBackgroundDrawable != background) { mOriginalBackgroundDrawable = background; updateBackgroundDrawable(); - drawableChanged(); + if (!View.sBrokenWindowBackground) { + drawableChanged(); + } } } |