Fixing missing movement bounds notification to SystemUI.
- When WM updates from a configuration change, ensure that we update the
pinned stack controller even if there is currently no pinned stack.
- Also finish the menu activity once an activity is unpinned.
Bug: 36879891
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: I789945c1783693cf4b4e3d6663548c8669784001
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 114a594..c565373 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -86,6 +86,7 @@
ComponentName topPipActivity = PipUtils.getTopPinnedActivity(mContext,
mActivityManager);
+ mMenuController.hideMenu();
mNotificationController.onActivityUnpinned(topPipActivity);
SystemServicesProxy.getInstance(mContext).setPipVisibility(topPipActivity != null);
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 2f64cd4..058fdae 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1420,6 +1420,13 @@
changedStackList.add(stack.mStackId);
}
}
+
+ // If there was no pinned stack, we still need to notify the controller of the display info
+ // update as a result of the config change. We do this here to consolidate the flow between
+ // changes when there is and is not a stack.
+ if (getStackById(PINNED_STACK_ID) == null) {
+ mPinnedStackControllerLocked.onDisplayInfoChanged();
+ }
}
@Override
diff --git a/services/core/java/com/android/server/wm/PinnedStackController.java b/services/core/java/com/android/server/wm/PinnedStackController.java
index fb660e7..1684878 100644
--- a/services/core/java/com/android/server/wm/PinnedStackController.java
+++ b/services/core/java/com/android/server/wm/PinnedStackController.java
@@ -147,7 +147,6 @@
void onConfigurationChanged() {
reloadResources();
- notifyMovementBoundsChanged(false /* fromImeAdjustment */);
}
/**
@@ -241,6 +240,16 @@
}
/**
+ * In the case where the display rotation is changed but there is no stack, we can't depend on
+ * onTaskStackBoundsChanged() to be called. But we still should update our known display info
+ * with the new state so that we can update SystemUI.
+ */
+ synchronized void onDisplayInfoChanged() {
+ mDisplayInfo.copyFrom(mDisplayContent.getDisplayInfo());
+ notifyMovementBoundsChanged(false /* fromImeAdjustment */);
+ }
+
+ /**
* Updates the display info, calculating and returning the new stack and movement bounds in the
* new orientation of the device if necessary.
*/