Merge "Also add starting window when activity is not alive" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6a5e68f784
@@ -2165,7 +2165,8 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
|
||||
final boolean shown = mWindowContainerController.addStartingWindow(packageName, theme,
|
||||
compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags,
|
||||
prev != null ? prev.appToken : null, newTask, taskSwitch, isProcessRunning(),
|
||||
allowTaskSnapshot());
|
||||
allowTaskSnapshot(),
|
||||
state.ordinal() >= RESUMED.ordinal() && state.ordinal() <= STOPPED.ordinal());
|
||||
if (shown) {
|
||||
mStartingWindowState = STARTING_WINDOW_SHOWN;
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ public class AppWindowContainerController
|
||||
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,
|
||||
boolean allowTaskSnapshot) {
|
||||
boolean allowTaskSnapshot, boolean activityCreated) {
|
||||
synchronized(mWindowMap) {
|
||||
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "setAppStartingWindow: token=" + mToken
|
||||
+ " pkg=" + pkg + " transferFrom=" + transferFrom);
|
||||
@@ -475,7 +475,7 @@ public class AppWindowContainerController
|
||||
}
|
||||
|
||||
final int type = getStartingWindowType(newTask, taskSwitch, processRunning,
|
||||
allowTaskSnapshot);
|
||||
allowTaskSnapshot, activityCreated);
|
||||
|
||||
if (type == STARTING_WINDOW_TYPE_SNAPSHOT) {
|
||||
return createSnapshot();
|
||||
@@ -546,8 +546,9 @@ public class AppWindowContainerController
|
||||
}
|
||||
|
||||
private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning,
|
||||
boolean allowTaskSnapshot) {
|
||||
if (newTask || !processRunning) {
|
||||
boolean allowTaskSnapshot, boolean activityCreated) {
|
||||
if (newTask || !processRunning
|
||||
|| (taskSwitch && !activityCreated)) {
|
||||
return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
|
||||
} else if (taskSwitch && allowTaskSnapshot) {
|
||||
return STARTING_WINDOW_TYPE_SNAPSHOT;
|
||||
|
||||
@@ -97,7 +97,8 @@ public class AppWindowContainerControllerTests extends WindowTestsBase {
|
||||
final WindowTestUtils.TestAppWindowContainerController controller =
|
||||
createAppWindowController();
|
||||
controller.addStartingWindow(InstrumentationRegistry.getContext().getPackageName(),
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true);
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
|
||||
false);
|
||||
waitUntilHandlersIdle();
|
||||
final AppWindowToken atoken = controller.getAppWindowToken(mDisplayContent);
|
||||
assertHasStartingWindow(atoken);
|
||||
@@ -113,11 +114,12 @@ public class AppWindowContainerControllerTests extends WindowTestsBase {
|
||||
final WindowTestUtils.TestAppWindowContainerController controller2 =
|
||||
createAppWindowController();
|
||||
controller1.addStartingWindow(InstrumentationRegistry.getContext().getPackageName(),
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true);
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
|
||||
false);
|
||||
waitUntilHandlersIdle();
|
||||
controller2.addStartingWindow(InstrumentationRegistry.getContext().getPackageName(),
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, controller1.mToken.asBinder(),
|
||||
true, true, false, true);
|
||||
true, true, false, true, false);
|
||||
waitUntilHandlersIdle();
|
||||
assertNoStartingWindow(controller1.getAppWindowToken(mDisplayContent));
|
||||
assertHasStartingWindow(controller2.getAppWindowToken(mDisplayContent));
|
||||
@@ -134,10 +136,11 @@ public class AppWindowContainerControllerTests extends WindowTestsBase {
|
||||
// Surprise, ...! Transfer window in the middle of the creation flow.
|
||||
controller2.addStartingWindow(InstrumentationRegistry.getContext().getPackageName(),
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, controller1.mToken.asBinder(),
|
||||
true, true, false, true);
|
||||
true, true, false, true, false);
|
||||
});
|
||||
controller1.addStartingWindow(InstrumentationRegistry.getContext().getPackageName(),
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true);
|
||||
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
|
||||
false);
|
||||
waitUntilHandlersIdle();
|
||||
assertNoStartingWindow(controller1.getAppWindowToken(mDisplayContent));
|
||||
assertHasStartingWindow(controller2.getAppWindowToken(mDisplayContent));
|
||||
|
||||
Reference in New Issue
Block a user