Fix leaks in sysui
Add support for testing for PluginManager and TunerService leaks
and add tests for the known leaks and fix them. Also port PluginManager
and TunerService to Dependency to make them easier to handle in
tests.
Test: runtest systemui
Change-Id: I5642539ee24dd72f802905106decd0c87b41b4eb
Fixes: 34846972
diff --git a/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java b/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java
index efddf20..9cc6613 100644
--- a/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java
@@ -76,7 +76,7 @@
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mAction != null) {
- PluginManager.getInstance(getContext()).addPluginListener(mAction, this, mVersion);
+ Dependency.get(PluginManager.class).addPluginListener(mAction, this, mVersion);
}
}
@@ -84,7 +84,7 @@
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mAction != null) {
- PluginManager.getInstance(getContext()).removePluginListener(this);
+ Dependency.get(PluginManager.class).removePluginListener(this);
}
}