Disallow task snapshot starting window for intent != ACTION_MAIN
We don't want to show a task snapshot if the intent wasn't the
launcher intent. Likely the app will show something different, so
we shouldn't show a snapshot in this case.
Test: AppWindowContainerControllerTests
Test: Open app, make sure we get snapshot window
Test: Open Chrome, go home, Open chrome incognito from shortcut,
make sure no flash
Change-Id: Ib608ba8070ce09f418f1036248d81eebfa354128
Fixes: 35099602
diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java
index e26914e..0b90bad 100644
--- a/services/core/java/com/android/server/wm/AppWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java
@@ -449,7 +449,8 @@
public boolean addStartingWindow(String pkg, int theme, CompatibilityInfo compatInfo,
CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags,
- IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning) {
+ IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning,
+ boolean allowTaskSnapshot) {
synchronized(mWindowMap) {
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "setAppStartingWindow: token=" + mToken
+ " pkg=" + pkg + " transferFrom=" + transferFrom);
@@ -469,7 +470,8 @@
return false;
}
- final int type = getStartingWindowType(newTask, taskSwitch, processRunning);
+ final int type = getStartingWindowType(newTask, taskSwitch, processRunning,
+ allowTaskSnapshot);
if (type == STARTING_WINDOW_TYPE_SNAPSHOT) {
return createSnapshot();
@@ -539,10 +541,11 @@
return true;
}
- private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning) {
+ private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning,
+ boolean allowTaskSnapshot) {
if (newTask || !processRunning) {
return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
- } else if (taskSwitch) {
+ } else if (taskSwitch && allowTaskSnapshot) {
return STARTING_WINDOW_TYPE_SNAPSHOT;
} else {
return STARTING_WINDOW_TYPE_NONE;
@@ -612,13 +615,13 @@
}
}
- public void notifyAppResumed(boolean wasStopped, boolean allowSavedSurface) {
+ public void notifyAppResumed(boolean wasStopped) {
synchronized(mWindowMap) {
if (mContainer == null) {
Slog.w(TAG_WM, "Attempted to notify resumed of non-existing app token: " + mToken);
return;
}
- mContainer.notifyAppResumed(wasStopped, allowSavedSurface);
+ mContainer.notifyAppResumed(wasStopped);
}
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index a8664a5..f4f6b63 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -582,16 +582,13 @@
* Notify that the app is now resumed, and it was not stopped before, perform a clean
* up of the surfaces
*/
- void notifyAppResumed(boolean wasStopped, boolean allowSavedSurface) {
+ void notifyAppResumed(boolean wasStopped) {
if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped
- + " allowSavedSurface=" + allowSavedSurface + " " + this);
+ + " " + this);
mAppStopped = false;
if (!wasStopped) {
destroySurfaces(true /*cleanupOnResume*/);
}
- if (!allowSavedSurface) {
- destroySavedSurfaces();
- }
}
/**