Provide PipManager through injection.
Adds a controller for PipControlsView so that depdencies can be provided
via injection.
Adds a TvPipComponent to allow injection of PIP related views into related
classes.
Bug: 146660939
Test: atest SystemUITests
Change-Id: Ic1a8f8f0f8e5506f354bb1f07b179db1d7e89577
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index 239ef36..b5c8d66 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -51,14 +51,16 @@
import java.io.PrintWriter;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/**
* Manages the picture-in-picture (PIP) UI and states for Phones.
*/
+@Singleton
public class PipManager implements BasePipManager {
private static final String TAG = "PipManager";
- private static PipManager sPipController;
-
private Context mContext;
private IActivityManager mActivityManager;
private IActivityTaskManager mActivityTaskManager;
@@ -225,12 +227,8 @@
}
}
- private PipManager() {}
-
- /**
- * Initializes {@link PipManager}.
- */
- public void initialize(Context context, BroadcastDispatcher broadcastDispatcher,
+ @Inject
+ public PipManager(Context context, BroadcastDispatcher broadcastDispatcher,
DisplayController displayController) {
mContext = context;
mActivityManager = ActivityManager.getService();
@@ -329,16 +327,6 @@
mTmpDisplayInfo.rotation);
}
- /**
- * Gets an instance of {@link PipManager}.
- */
- public static PipManager getInstance() {
- if (sPipController == null) {
- sPipController = new PipManager();
- }
- return sPipController;
- }
-
public void dump(PrintWriter pw) {
final String innerPrefix = " ";
pw.println(TAG);