From 04a442e53639efcac948c36947c798d679d3279c Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Fri, 17 Sep 2021 10:10:10 -0400 Subject: [PATCH] Prevent nesting of ContextThemeWrapper brightness_mirror_container sets android:theme, causing the inflating context to be wrapped in a ContextThemeWrapper every time it's reinflated (because we used the old view context). Instead, use the context of the parent for reinflation (same context every time), so we only have one layer or theming. Fixes: 200054259 Test: manual, dump heap after triggering reinflate many times Change-Id: I0af5648bfc8b20dc53cb0a9064eb7b93d1f10941 --- .../systemui/statusbar/policy/BrightnessMirrorController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java index a0edc7c494bc4..1e5251196379b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java @@ -149,7 +149,7 @@ public class BrightnessMirrorController private void reinflate() { int index = mStatusBarWindow.indexOfChild(mBrightnessMirror); mStatusBarWindow.removeView(mBrightnessMirror); - mBrightnessMirror = (FrameLayout) LayoutInflater.from(mBrightnessMirror.getContext()) + mBrightnessMirror = (FrameLayout) LayoutInflater.from(mStatusBarWindow.getContext()) .inflate(R.layout.brightness_mirror_container, mStatusBarWindow, false); mToggleSliderController = setMirrorLayout(); mStatusBarWindow.addView(mBrightnessMirror, index);