Inject PipBoundsHandler and PipSnapAlgorithm using Dagger2
Allows vendors to override either with custom implementations.
Bug: 143703251
Test: atest PipBoundsHandlerTest
Change-Id: Ib083cf2c4cff95098bdfbbfee670c6e5df27be1a
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 8ada3c3..4b97d13 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -41,6 +41,7 @@
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.pip.BasePipManager;
import com.android.systemui.pip.PipBoundsHandler;
+import com.android.systemui.pip.PipSnapAlgorithm;
import com.android.systemui.pip.PipTaskOrganizer;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -205,7 +206,9 @@
public PipManager(Context context, BroadcastDispatcher broadcastDispatcher,
DisplayController displayController,
FloatingContentCoordinator floatingContentCoordinator,
- DeviceConfigProxy deviceConfig) {
+ DeviceConfigProxy deviceConfig,
+ PipBoundsHandler pipBoundsHandler,
+ PipSnapAlgorithm pipSnapAlgorithm) {
mContext = context;
mActivityManager = ActivityManager.getService();
@@ -218,7 +221,7 @@
ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
final IActivityTaskManager activityTaskManager = ActivityTaskManager.getService();
- mPipBoundsHandler = new PipBoundsHandler(context);
+ mPipBoundsHandler = pipBoundsHandler;
mPipTaskOrganizer = new PipTaskOrganizer(mContext, mPipBoundsHandler);
mPipTaskOrganizer.registerPipTransitionCallback(this);
mInputConsumerController = InputConsumerController.getPipInputConsumer();
@@ -227,7 +230,7 @@
mInputConsumerController);
mTouchHandler = new PipTouchHandler(context, mActivityManager, activityTaskManager,
mMenuController, mInputConsumerController, mPipBoundsHandler, mPipTaskOrganizer,
- floatingContentCoordinator, deviceConfig);
+ floatingContentCoordinator, deviceConfig, pipSnapAlgorithm);
mAppOpsListener = new PipAppOpsListener(context, mActivityManager,
mTouchHandler.getMotionHelper());
displayController.addDisplayChangingController(mRotationController);