Fixed transition animation from pipable activities
- Defer telling the client it is hidden if it can enter Pip and isn't
current stopped or stopping. This gives it a chance to enter Pip in
onPause().
- Once pause is complete set the visiblity to false to stop deferring
hiding client.
- Don't allow FLAG_RESUME_WHILE_PAUSING activity to resume until the
currently resumed activity is puased if the currently resumed activity
can enter Pip.
- Detach child surfaces added by the client process in
WindowState.sendAppVisibilityToClients() right before we notify the
client.
Test: manual
Change-Id: I3848f2b93f4f1d3ceec5a1ccd2e127c614f70fe4
Fixes: 37370508
Fixes: 37622341
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 7634644..31fdacd 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -126,7 +126,11 @@
boolean hiddenRequested;
// Have we told the window clients to hide themselves?
- boolean clientHidden;
+ private boolean mClientHidden;
+
+ // If true we will defer setting mClientHidden to true and reporting to the client that it is
+ // hidden.
+ boolean mDeferHidingClient;
// Last visibility state we reported to the app token.
boolean reportedVisible;
@@ -307,16 +311,25 @@
}
}
+ boolean isClientHidden() {
+ return mClientHidden;
+ }
+
+ void setClientHidden(boolean hideClient) {
+ if (mClientHidden == hideClient || (hideClient && mDeferHidingClient)) {
+ return;
+ }
+ mClientHidden = hideClient;
+ sendAppVisibilityToClients();
+ }
+
boolean setVisibility(WindowManager.LayoutParams lp,
boolean visible, int transit, boolean performLayout, boolean isVoiceInteraction) {
boolean delayed = false;
inPendingTransaction = false;
- if (clientHidden == visible) {
- clientHidden = !visible;
- sendAppVisibilityToClients();
- }
+ setClientHidden(!visible);
// Allow for state changes and animation to be applied if:
// * token is transitioning visibility state
@@ -1143,10 +1156,7 @@
hidden = false;
hiddenRequested = false;
}
- if (clientHidden != fromToken.clientHidden) {
- clientHidden = fromToken.clientHidden;
- sendAppVisibilityToClients();
- }
+ setClientHidden(fromToken.mClientHidden);
fromToken.mAppAnimator.transferCurrentAnimation(
mAppAnimator, tStartingWindow.mWinAnimator);
@@ -1511,10 +1521,9 @@
pw.print(prefix); pw.print("task="); pw.println(getTask());
pw.print(prefix); pw.print(" mFillsParent="); pw.print(mFillsParent);
pw.print(" mOrientation="); pw.println(mOrientation);
- pw.print(prefix); pw.print("hiddenRequested="); pw.print(hiddenRequested);
- pw.print(" clientHidden="); pw.print(clientHidden);
- pw.print(" reportedDrawn="); pw.print(reportedDrawn);
- pw.print(" reportedVisible="); pw.println(reportedVisible);
+ pw.println(prefix + "hiddenRequested=" + hiddenRequested + " mClientHidden=" + mClientHidden
+ + ((mDeferHidingClient) ? " mDeferHidingClient=" + mDeferHidingClient : "")
+ + " reportedDrawn=" + reportedDrawn + " reportedVisible=" + reportedVisible);
if (paused) {
pw.print(prefix); pw.print("paused="); pw.println(paused);
}