From a03f67e257a44fd471f60db662f8cba4abe3d477 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Thu, 23 Sep 2021 10:50:10 -0400 Subject: [PATCH] Properly store values to pass to constant state There's no way to retrieve the last set tint list, so store it (as we were passing it to the constant state). Test: manual Fixes: 198413369 Change-Id: I665f9f955ff90accd6dcda275521715039641a6b --- .../android/systemui/util/AlphaTintDrawableWrapper.java | 6 ++++++ .../systemui/util/RoundedCornerProgressDrawable.kt | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/util/AlphaTintDrawableWrapper.java b/packages/SystemUI/src/com/android/systemui/util/AlphaTintDrawableWrapper.java index a22793b050709..516efc06386a6 100644 --- a/packages/SystemUI/src/com/android/systemui/util/AlphaTintDrawableWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/util/AlphaTintDrawableWrapper.java @@ -109,6 +109,12 @@ public class AlphaTintDrawableWrapper extends InsetDrawable { } } + @Override + public void setTintList(ColorStateList tint) { + super.setTintList(tint); + mTint = tint; + } + private void applyTint() { if (getDrawable() != null && mTint != null) { getDrawable().mutate().setTintList(mTint); diff --git a/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt b/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt index 3b64f9f953c3e..1059d6c61287c 100644 --- a/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt +++ b/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt @@ -69,6 +69,10 @@ class RoundedCornerProgressDrawable @JvmOverloads constructor( return super.getChangingConfigurations() or ActivityInfo.CONFIG_DENSITY } + override fun canApplyTheme(): Boolean { + return (drawable?.canApplyTheme() ?: false) || super.canApplyTheme() + } + private class RoundedCornerState(private val wrappedState: ConstantState) : ConstantState() { override fun newDrawable(): Drawable { return newDrawable(null, null) @@ -82,5 +86,9 @@ class RoundedCornerProgressDrawable @JvmOverloads constructor( override fun getChangingConfigurations(): Int { return wrappedState.changingConfigurations } + + override fun canApplyTheme(): Boolean { + return true + } } } \ No newline at end of file