From 55fed16929d9fb98e96e78042c08bd4b2dd3cf82 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 4 Apr 2017 03:30:01 +0000 Subject: [PATCH] Revert "Refresh opacity and statefulness on tint change" This reverts commit 1eda069f7c9a36e58c17ecf185a5c0906be5df95. Reason to revert: The setup wizard started throwing android.view.InflateException due to I89f6d804fb025f426aefdee67559778cf03015bb. Temporarily reverting that change until we figure out what is going on. Change-Id: I9344a3402f2fab02f4fe49a6a8ad91970b2d3b3e Test: Manually verified that the setup wizard no longer crashes. Bug: 33124798 Bug: 36870685 --- .../graphics/drawable/DrawableContainer.java | 25 +++---------------- .../graphics/drawable/LayerDrawable.java | 10 +------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java index 04864bdcfa57c..d88aee93fae23 100644 --- a/graphics/java/android/graphics/drawable/DrawableContainer.java +++ b/graphics/java/android/graphics/drawable/DrawableContainer.java @@ -88,9 +88,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { } @Override - public - @Config - int getChangingConfigurations() { + public @Config int getChangingConfigurations() { return super.getChangingConfigurations() | mDrawableContainerState.getChangingConfigurations(); } @@ -212,7 +210,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { /** * Change the global fade duration when a new drawable is entering * the scene. - * * @param ms The amount of time to fade in milliseconds. */ public void setEnterFadeDuration(int ms) { @@ -222,7 +219,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { /** * Change the global fade duration when a new drawable is leaving * the scene. - * * @param ms The amount of time to fade in milliseconds. */ public void setExitFadeDuration(int ms) { @@ -379,13 +375,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { @Override public void invalidateDrawable(@NonNull Drawable who) { - // This may have been called as the result of a tint changing, in - // which case we may need to refresh the cached statefulness or - // opacity. - if (mDrawableContainerState != null) { - mDrawableContainerState.invalidateCache(); - } - if (who == mCurrDrawable && getCallback() != null) { getCallback().invalidateDrawable(this); } @@ -833,8 +822,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { mDrawables[pos] = dr; mNumChildren++; mChildrenChangingConfigurations |= dr.getChangingConfigurations(); - - invalidateCache(); + mCheckedStateful = false; + mCheckedOpacity = false; mConstantPadding = null; mCheckedPadding = false; @@ -844,14 +833,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { return pos; } - /** - * Invalidates the cached opacity and statefulness. - */ - void invalidateCache() { - mCheckedOpacity = false; - mCheckedStateful = false; - } - final int getCapacity() { return mDrawables.length; } diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index 322e55b3e9f6b..355e45e70a6b7 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -986,11 +986,6 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { if (mSuspendChildInvalidation) { mChildRequestedInvalidation = true; } else { - // This may have been called as the result of a tint changing, in - // which case we may need to refresh the cached statefulness or - // opacity. - mLayerState.invalidateCache(); - invalidateSelf(); } } @@ -2126,10 +2121,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { return true; } - /** - * Invalidates the cached opacity and statefulness. - */ - void invalidateCache() { + public void invalidateCache() { mCheckedOpacity = false; mCheckedStateful = false; }