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

Commit 2f0d73ca authored by Andrii Kulian's avatar Andrii Kulian
Browse files

Skip updating stack config if it is detached from a display

Ensuring visibility or configuration of activities in a stack can be
triggered from outside of system service by a client callback, e.g.
ActivityManagerService#activityPaused(). We should skip doing that
whenever we see that a stack is no longer attached to a display.

This CL restores the behavior that was in place where the error might
happen before switching to using
ActivityStackSupervisor#ensureVisibilityAndConfig() and will only
ensure system-wide activity visibility without updating config.

Bug: 110074206
Test: Build and run
Change-Id: Ib347b56b66ce27e4ed8c263ffb425d336012a4ff
parent f910fdb1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
     * @param markFrozenIfConfigChanged Whether to set {@link ActivityRecord#frozenBeforeDestroy} to
     *                                  {@code true} if config changed.
     * @param deferResume Whether to defer resume while updating config.
     * @return 'true' if starting activity was kept or wasn't provided, 'false' if it was relaunched
     *         because of configuration update.
     */
    boolean ensureVisibilityAndConfig(ActivityRecord starting, int displayId,
            boolean markFrozenIfConfigChanged, boolean deferResume) {
@@ -1644,6 +1646,11 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        ensureActivitiesVisibleLocked(null /* starting */, 0 /* configChanges */,
                false /* preserveWindows */, false /* notifyClients */);

        if (displayId == INVALID_DISPLAY) {
            // The caller didn't provide a valid display id, skip updating config.
            return true;
        }

        // Force-update the orientation from the WindowManager, since we need the true configuration
        // to send to the client now.
        final Configuration config = mWindowManager.updateOrientationFromAppTokens(