Ensure profile-specific PiP notification is shown.
- Pipe through user id when an activity is pinned, to ensure we show the
right notification with the correct profile badge that launches into the
correct profile's PiP settings.
Bug: 65417722
Test: Enter PiP for work profile app, ensure that it shows the notification
for that profile, and launches the profile-specific PiP settings.
Change-Id: I62b8e1b23cb81bfc60c93f452cf950ab06cbf32d
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 b3f992d..bae9ef8a 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,7 @@
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
+import android.util.Pair;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
import android.view.IWindowManager;
@@ -70,11 +71,11 @@
*/
TaskStackListener mTaskStackListener = new TaskStackListener() {
@Override
- public void onActivityPinned(String packageName, int taskId) {
+ public void onActivityPinned(String packageName, int userId, int taskId) {
mTouchHandler.onActivityPinned();
mMediaController.onActivityPinned();
mMenuController.onActivityPinned();
- mNotificationController.onActivityPinned(packageName,
+ mNotificationController.onActivityPinned(packageName, userId,
true /* deferUntilAnimationEnds */);
SystemServicesProxy.getInstance(mContext).setPipVisibility(true);
@@ -82,13 +83,15 @@
@Override
public void onActivityUnpinned() {
- ComponentName topPipActivity = PipUtils.getTopPinnedActivity(mContext,
- mActivityManager);
- mMenuController.onActivityUnpinned(topPipActivity);
- mTouchHandler.onActivityUnpinned(topPipActivity);
- mNotificationController.onActivityUnpinned(topPipActivity);
+ final Pair<ComponentName, Integer> topPipActivityInfo = PipUtils.getTopPinnedActivity(
+ mContext, mActivityManager);
+ final ComponentName topActivity = topPipActivityInfo.first;
+ final int userId = topActivity != null ? topPipActivityInfo.second : 0;
+ mMenuController.onActivityUnpinned();
+ mTouchHandler.onActivityUnpinned(topActivity);
+ mNotificationController.onActivityUnpinned(topActivity, userId);
- SystemServicesProxy.getInstance(mContext).setPipVisibility(topPipActivity != null);
+ SystemServicesProxy.getInstance(mContext).setPipVisibility(topActivity != null);
}
@Override