Add API to disallow entering PiP when launching a new activity
- Use this API when launching the camera from a double tap gesture where
the user expects the camera to start for immediate use.
- Fix missing case of restoring the enter pip state.
Bug: 63916952
Test: Double tap to launch the camera, and ensure it does not trigger
the current activity to enter PiP (if it supports it)
Change-Id: I2acf44984bcc57dff75701d0e9cbd6b798a97cd8
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 5b51dff..4eedb25 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -59,7 +59,6 @@
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_STATES;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_TASKS;
-import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_CONTAINERS;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_IDLE;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LOCKTASK;
@@ -137,7 +136,6 @@
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
-import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
@@ -2992,7 +2990,7 @@
// while pausing because that changes the focused stack and may prevent the new
// starting activity from resuming.
if (moveHomeStackToFront && task.getTaskToReturnTo() == HOME_ACTIVITY_TYPE
- && (r.state == RESUMED || !r.supportsPictureInPictureWhilePausing)) {
+ && (r.state == RESUMED || !r.supportsEnterPipOnTaskSwitch)) {
// Move the home stack forward if the task we just moved to the pinned stack
// was launched from home so home should be visible behind it.
moveHomeStackToFront(reason);
@@ -3021,7 +3019,7 @@
// Reset the state that indicates it can enter PiP while pausing after we've moved it
// to the pinned stack
- r.supportsPictureInPictureWhilePausing = false;
+ r.supportsEnterPipOnTaskSwitch = false;
} finally {
mWindowManager.continueSurfaceLayout();
}