From 842a2cbeb0e2730e2717677a4fc2c48417bd1ff2 Mon Sep 17 00:00:00 2001 From: Nikolas Havrikov Date: Thu, 10 Feb 2022 14:44:26 +0100 Subject: [PATCH] Recycle obtained TypedArrays Bug: 218835043 Test: make Change-Id: I0419652b1eb4aa219ea028e7659f123e747d36f3 --- .../src/com/android/systemui/PluginInflateContainer.java | 1 + packages/SystemUI/src/com/android/systemui/ResizingSpace.java | 1 + .../SystemUI/src/com/android/systemui/tuner/TunerSwitch.java | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java b/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java index c7f1006a40423..95f666c5d0eb3 100644 --- a/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java +++ b/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java @@ -60,6 +60,7 @@ public class PluginInflateContainer extends AutoReinflateContainer super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PluginInflateContainer); String viewType = a.getString(R.styleable.PluginInflateContainer_viewType); + a.recycle(); try { mClass = (Class) Class.forName(viewType); } catch (Exception e) { diff --git a/packages/SystemUI/src/com/android/systemui/ResizingSpace.java b/packages/SystemUI/src/com/android/systemui/ResizingSpace.java index c2bc53e7d553a..bb4176d64802d 100644 --- a/packages/SystemUI/src/com/android/systemui/ResizingSpace.java +++ b/packages/SystemUI/src/com/android/systemui/ResizingSpace.java @@ -35,6 +35,7 @@ public class ResizingSpace extends View { TypedArray a = context.obtainStyledAttributes(attrs, android.R.styleable.ViewGroup_Layout); mWidth = a.getResourceId(android.R.styleable.ViewGroup_Layout_layout_width, 0); mHeight = a.getResourceId(android.R.styleable.ViewGroup_Layout_layout_height, 0); + a.recycle(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerSwitch.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerSwitch.java index 52b58d4510639..71355bbb23e1a 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerSwitch.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerSwitch.java @@ -23,6 +23,7 @@ public class TunerSwitch extends SwitchPreference implements Tunable { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TunerSwitch); mDefault = a.getBoolean(R.styleable.TunerSwitch_defValue, false); mAction = a.getInt(R.styleable.TunerSwitch_metricsAction, -1); + a.recycle(); } @Override