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

Commit adcf46d6 authored by Evan Rosky's avatar Evan Rosky
Browse files

Don't applyReady immediately if WCT is launching activity

In this case, we need to wait for the activity lifecycle
callbacks or else we just immediately make a no-op. This
is a temporary fix until we address readiness properly.

Bug: 294624260
Test: start transition w/ launchtask (eg. with fullscreen app,
      go to recents, start entering split w/ that app, "cancel"
      split by tapping app preview to launch it in fullscreen).
Change-Id: If0852d184fe440f52f91b489a786201f86e41d59
parent 191f2fd4
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -309,6 +309,14 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                                applyTransaction(wct, -1 /* syncId */, nextTransition, caller,
                                        deferred);
                                if (needsSetReady) {
                                    // TODO(b/294925498): Remove this once we have accurate ready
                                    //                    tracking.
                                    if (hasActivityLaunch(wct) && !mService.mRootWindowContainer
                                            .allPausedActivitiesComplete()) {
                                        // WCT is launching an activity, so we need to wait for its
                                        // lifecycle events.
                                        return;
                                    }
                                    nextTransition.setAllReady();
                                }
                            });
@@ -344,6 +352,15 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
        }
    }

    private static boolean hasActivityLaunch(WindowContainerTransaction wct) {
        for (int i = 0; i < wct.getHierarchyOps().size(); ++i) {
            if (wct.getHierarchyOps().get(i).getType() == HIERARCHY_OP_TYPE_LAUNCH_TASK) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int startLegacyTransition(int type, @NonNull RemoteAnimationAdapter adapter,
            @NonNull IWindowContainerTransactionCallback callback,