Always send task stack change updates if PiP is enabled
PiP stack repositioning is triggered when task stack change
is detected. Usually these updates are sent when there was
a visibility change since last pause. In case when we're
navigating from setting back to launcher on TV there is no
visibility change. This happened to work in most cases
because PipOverlayActivity was shown or hidden somewhere
between user actions.
This CL always notifies about task stack changes if pinned
stack is present on activity pause.
Bug: 29344059
Change-Id: I5ab3f2b8a97983fcb79d58626b6494f8ec31dbf3
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 4ead64b..2673854 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1350,8 +1350,11 @@
prev.cpuTimeAtResume = 0; // reset it
}
- // Notify when the task stack has changed, but only if visibilities changed (not just focus)
- if (mStackSupervisor.mAppVisibilitiesChangedSinceLastPause) {
+ // Notify when the task stack has changed, but only if visibilities changed (not just
+ // focus). Also if there is an active pinned stack - we always want to notify it about
+ // task stack changes, because its positioning may depend on it.
+ if (mStackSupervisor.mAppVisibilitiesChangedSinceLastPause
+ || mService.mStackSupervisor.getStack(PINNED_STACK_ID) != null) {
mService.notifyTaskStackChangedLocked();
mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = false;
}