Ensure that windows are drawn before starting transition into PiP.
- Building upon ag/2125930, we ensure that all windows are drawn before
starting the enter PiP animation.
Bug: 37420370
Test: bit FrameworksServicesTests:com.android.server.wm.BoundsAnimationControllerTests
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: I73fb71681f62bbc684efedbd3d40c3e1a670db46
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 17db253..4e38e3d 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -17,6 +17,7 @@
package com.android.server.wm;
import static android.app.ActivityManager.StackId;
+import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
@@ -51,6 +52,7 @@
import android.annotation.NonNull;
import android.app.Activity;
+import android.app.ActivityManager;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Binder;
@@ -1343,9 +1345,11 @@
}
mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget();
- final TaskStack s = getStack();
- if (s != null) {
- s.onAllWindowsDrawn();
+ // Notify the pinned stack upon all windows drawn. If there was an animation in
+ // progress then this signal will resume that animation.
+ final TaskStack pinnedStack = mDisplayContent.getStackById(PINNED_STACK_ID);
+ if (pinnedStack != null) {
+ pinnedStack.onAllWindowsDrawn();
}
}
}