From 381f7d3e3436c7c281c62440ddd701eb38768ebf Mon Sep 17 00:00:00 2001 From: Dave Mankoff Date: Fri, 25 Jun 2021 10:38:28 -0400 Subject: [PATCH] Redraw brightness slider on density change. Without this, the drawable we use for the brightness slider gets drawn at the wrong size whenever the screen density changes. This also appears to ensure that the brightness icon gets drawn in the correct color. Fixes: 191738397 Test: manual Change-Id: I21929985935299e14043482dd0496684642e5004 --- .../systemui/settings/brightness/BrightnessSliderView.java | 2 ++ .../android/systemui/util/RoundedCornerProgressDrawable.kt | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java index 8dd6c8926434d..15aa2b730adf9 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java +++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java @@ -180,6 +180,8 @@ public class BrightnessSliderView extends FrameLayout { * Sets the scale for the progress bar (for brightness_progress_drawable.xml) * * This will only scale the thick progress bar and not the icon inside + * + * Used in {@link com.android.systemui.qs.QSAnimator}. */ public void setSliderScaleY(float scale) { if (scale != mScale) { diff --git a/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt b/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt index dc86d5893adb8..3b64f9f953c3e 100644 --- a/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt +++ b/packages/SystemUI/src/com/android/systemui/util/RoundedCornerProgressDrawable.kt @@ -16,6 +16,7 @@ package com.android.systemui.util +import android.content.pm.ActivityInfo import android.content.res.Resources import android.graphics.Rect import android.graphics.drawable.Drawable @@ -64,6 +65,10 @@ class RoundedCornerProgressDrawable @JvmOverloads constructor( return RoundedCornerState(super.getConstantState()!!) } + override fun getChangingConfigurations(): Int { + return super.getChangingConfigurations() or ActivityInfo.CONFIG_DENSITY + } + private class RoundedCornerState(private val wrappedState: ConstantState) : ConstantState() { override fun newDrawable(): Drawable { return newDrawable(null, null)