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

Commit 1fd7ea10 authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Collect embedded TaskFragment window changes" into tm-qpr-dev am: d0208d92 am: 929e5378

parents cbdf853f 929e5378
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -3217,12 +3217,6 @@
      "group": "WM_DEBUG_LOCKTASK",
      "at": "com\/android\/server\/wm\/LockTaskController.java"
    },
    "956467125": {
      "message": "Reparenting Activity to embedded TaskFragment, but the Activity is not collected",
      "level": "WARN",
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "at": "com\/android\/server\/wm\/WindowOrganizerController.java"
    },
    "958338552": {
      "message": "grantEmbeddedWindowFocus win=%s dropped focus so setting focus to null since no candidate was found",
      "level": "VERBOSE",
+1 −4
Original line number Diff line number Diff line
@@ -2712,10 +2712,7 @@ class ActivityStarter {
                newParent = candidateTf;
            }
        }
        if (newParent.canHaveEmbeddingActivityTransition(mStartActivity)) {
            // Make sure the embedded TaskFragment is included in the start activity transition.
            newParent.collectEmbeddedTaskFragmentIfNeeded();
        }
        newParent.mTransitionController.collect(newParent);
        if (mStartActivity.getTaskFragment() == null
                || mStartActivity.getTaskFragment() == newParent) {
            newParent.addChild(mStartActivity, POSITION_TOP);
+25 −28
Original line number Diff line number Diff line
@@ -2275,19 +2275,33 @@ class TaskFragment extends WindowContainer<WindowContainer> {

        super.onConfigurationChanged(newParentConfig);

        if (shouldStartChangeTransition(mTmpPrevBounds)) {
        final boolean shouldStartChangeTransition = shouldStartChangeTransition(mTmpPrevBounds);
        if (shouldStartChangeTransition) {
            initializeChangeTransition(mTmpPrevBounds);
        } else if (mTaskFragmentOrganizer != null) {
        }
        if (mTaskFragmentOrganizer != null) {
            if (mTransitionController.isShellTransitionsEnabled()
                    && !mTransitionController.isCollecting(this)) {
                // TaskFragmentOrganizer doesn't have access to the surface for security reasons, so
                // update the surface here if it is not collected by Shell transition.
                updateOrganizedTaskFragmentSurface();
            } else if (!mTransitionController.isShellTransitionsEnabled()
                    && !shouldStartChangeTransition) {
                // Update the surface here instead of in the organizer so that we can make sure
            // it can be synced with the surface freezer.
            final SurfaceControl.Transaction t = getSyncTransaction();
            updateSurfacePosition(t);
            updateOrganizedTaskFragmentSurfaceSize(t, false /* forceUpdate */);
                // it can be synced with the surface freezer for legacy app transition.
                updateOrganizedTaskFragmentSurface();
            }
        }

        sendTaskFragmentInfoChanged();
    }

    private void updateOrganizedTaskFragmentSurface() {
        final SurfaceControl.Transaction t = getSyncTransaction();
        updateSurfacePosition(t);
        updateOrganizedTaskFragmentSurfaceSize(t, false /* forceUpdate */);
    }

    /** Updates the surface size so that the sub windows cannot be shown out of bounds. */
    private void updateOrganizedTaskFragmentSurfaceSize(SurfaceControl.Transaction t,
            boolean forceUpdate) {
@@ -2342,33 +2356,16 @@ class TaskFragment extends WindowContainer<WindowContainer> {
                || endBounds.height() != startBounds.height();
    }

    boolean canHaveEmbeddingActivityTransition(@NonNull ActivityRecord child) {
        if (!isOrganizedTaskFragment() || !mTransitionController.isShellTransitionsEnabled()) {
            return false;
        }
        // The activity should request open transition when it is becoming visible.
        return child.isVisibleRequested();
    }

    void collectEmbeddedTaskFragmentIfNeeded() {
        if (!isOrganizedTaskFragment() || mTransitionController.isCollecting(this)) {
            return;
        }
        if (getChildCount() == 0) {
            // The TaskFragment is new created, and just becoming non-empty.
            mTransitionController.collectExistenceChange(this);
        } else {
            mTransitionController.collect(this);
        }
    @Override
    boolean isSyncFinished() {
        return super.isSyncFinished() && isReadyToTransit();
    }

    @Override
    void setSurfaceControl(SurfaceControl sc) {
        super.setSurfaceControl(sc);
        if (mTaskFragmentOrganizer != null) {
            final SurfaceControl.Transaction t = getSyncTransaction();
            updateSurfacePosition(t);
            updateOrganizedTaskFragmentSurfaceSize(t, false /* forceUpdate */);
            updateOrganizedTaskFragmentSurface();
            // If the TaskFragmentOrganizer was set before we created the SurfaceControl, we need to
            // emit the callbacks now.
            sendTaskFragmentAppeared();
+8 −0
Original line number Diff line number Diff line
@@ -226,6 +226,14 @@ class TransitionController {
        return mCollectingTransition != null;
    }

    /**
     * @return the collecting transition. {@code null} if there is no collecting transition.
     */
    @Nullable
    Transition getCollectingTransition() {
        return mCollectingTransition;
    }

    /**
     * @return the collecting transition sync Id. This should only be called when there is a
     * collecting transition.
+0 −1
Original line number Diff line number Diff line
@@ -2831,7 +2831,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    void initializeChangeTransition(Rect startBounds, @Nullable SurfaceControl freezeTarget) {
        if (mDisplayContent.mTransitionController.isShellTransitionsEnabled()) {
            mDisplayContent.mTransitionController.collectVisibleChange(this);
            // TODO(b/207070762): request shell transition for activityEmbedding change.
            return;
        }
        mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
Loading