Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac9a1292 authored by Alan Stokes's avatar Alan Stokes
Browse files

Allow second consecutive activity start.

If we start two activities in onCreate the second one was being
blocked - because the current activity is no longer top but the new
activity is not yet visible. So we treat an INITIALIZING activity
as being visible for this purpose.

Bug: 130645908
Test: atest BackgroundActivityLaunchTest RootWindowContainerTests \
WmTests:ActivityStarterTests \
CtsWindowManagerDeviceTestCases:ActivityStarterTests
Change-Id: I96749f8b4d385527c91725827880bd12371d2411
parent 27f23459
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.view.Display.INVALID_DISPLAY;
import static com.android.server.am.ActivityManagerService.MY_PID;
import static com.android.server.wm.ActivityStack.ActivityState.DESTROYED;
import static com.android.server.wm.ActivityStack.ActivityState.DESTROYING;
import static com.android.server.wm.ActivityStack.ActivityState.INITIALIZING;
import static com.android.server.wm.ActivityStack.ActivityState.PAUSED;
import static com.android.server.wm.ActivityStack.ActivityState.PAUSING;
import static com.android.server.wm.ActivityStack.ActivityState.RESUMED;
@@ -507,7 +508,14 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
                continue;
            }
            ActivityRecord topActivity = task.getTopActivity();
            if (topActivity != null && topActivity.visible) {
            if (topActivity == null) {
                continue;
            }
            // If an activity has just been started it will not yet be visible, but
            // is expected to be soon. We treat this as if it were already visible.
            // This ensures a subsequent activity can be started even before this one
            // becomes visible.
            if (topActivity.visible || topActivity.isState(INITIALIZING)) {
                return true;
            }
        }