Add additional guards to ensure input consumer is re-registered.
- Also removing some old code related to menu start, which is already
called when the menu is shown.
Bug: 34240533
Test: Open PIP, ensure that you can drag it after the menu fades out.
Change-Id: Ia16b405f8507f5c3d81fdf4f1049ce9359298672
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 7e275d8..a2d7d6b 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -30,6 +30,9 @@
import android.view.IWindowManager;
import android.view.WindowManagerGlobal;
+import com.android.systemui.recents.misc.SystemServicesProxy;
+import com.android.systemui.recents.misc.SystemServicesProxy.TaskStackListener;
+
/**
* Manages the picture-in-picture (PIP) UI and states for Phones.
*/
@@ -49,6 +52,26 @@
private PipTouchHandler mTouchHandler;
/**
+ * Handler for system task stack changes.
+ */
+ TaskStackListener mTaskStackListener = new TaskStackListener() {
+ @Override
+ public void onActivityPinned() {
+ mTouchHandler.onActivityPinned();
+ }
+
+ @Override
+ public void onPinnedStackAnimationEnded() {
+ // TODO(winsonc): Disable touch interaction with the PiP until the animation ends
+ }
+
+ @Override
+ public void onPinnedActivityRestartAttempt() {
+ // TODO(winsonc): Hide the menu and expand the PiP
+ }
+ };
+
+ /**
* Handler for messages from the PIP controller.
*/
private class PinnedStackListener extends IPinnedStackListener.Stub {
@@ -102,6 +125,7 @@
} catch (RemoteException e) {
Log.e(TAG, "Failed to register pinned stack listener", e);
}
+ SystemServicesProxy.getInstance(mContext).registerTaskStackListener(mTaskStackListener);
mMenuController = new PipMenuActivityController(context, mActivityManager, mWindowManager);
mTouchHandler = new PipTouchHandler(context, mMenuController, mActivityManager,