From 4288311d5381c87c3e85f6f9cbe087f162cc84a9 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 24 Apr 2017 15:14:11 -0700 Subject: [PATCH] Ensuring that isPictureInPictureMode() mirrors dispatched mode. - When transitioning out of picture-in-picture, we schedule onPictureInPictureModeChanged() when the animation starts, so the check in isInPictureInPicture() should match this as well. Bug: 36845078 Test: Updated android.server.cts.ActivityManagerPinnedStackTests to also whenever PipActivity PiP mode changes, that it matches the activity state as well. Change-Id: I31d7a3307b01b818e867f86a4553a363c7f11307 --- .../java/com/android/server/am/ActivityManagerService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index d99601c815f7..099894cb3131 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -411,6 +411,7 @@ import com.android.server.pm.Installer; import com.android.server.pm.Installer.InstallerException; import com.android.server.statusbar.StatusBarManagerInternal; import com.android.server.vr.VrManagerInternal; +import com.android.server.wm.PinnedStackWindowController; import com.android.server.wm.WindowManagerService; import org.xmlpull.v1.XmlPullParser; @@ -7818,10 +7819,15 @@ public class ActivityManagerService extends IActivityManager.Stub try { synchronized(this) { final ActivityStack stack = ActivityRecord.getStackLocked(token); - if (stack == null) { + if (stack == null || stack.mStackId != PINNED_STACK_ID) { return false; } - return stack.mStackId == PINNED_STACK_ID; + + // If we are animating to fullscreen then we have already dispatched the PIP mode + // changed, so we should reflect that check here as well. + final PinnedStackWindowController windowController = + ((PinnedActivityStack) stack).getWindowContainerController(); + return !windowController.isAnimatingBoundsToFullscreen(); } } finally { Binder.restoreCallingIdentity(origId); -- 2.11.0