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

Commit a45333e7 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Cleanup allowMultipleAdjacentTaskFragments" into main

parents e9f5231c c2dd5e1d
Loading
Loading
Loading
Loading
+5 −27
Original line number Diff line number Diff line
@@ -688,12 +688,6 @@ public final class WindowContainerTransaction implements Parcelable {
    @NonNull
    public WindowContainerTransaction setAdjacentRoots(
            @NonNull WindowContainerToken root1, @NonNull WindowContainerToken root2) {
        if (!Flags.allowMultipleAdjacentTaskFragments()) {
            mHierarchyOps.add(HierarchyOp.createForAdjacentRoots(
                    root1.asBinder(),
                    root2.asBinder()));
            return this;
        }
        return setAdjacentRootSet(root1, root2);
    }

@@ -714,10 +708,6 @@ public final class WindowContainerTransaction implements Parcelable {
     */
    @NonNull
    public WindowContainerTransaction setAdjacentRootSet(@NonNull WindowContainerToken... roots) {
        if (!Flags.allowMultipleAdjacentTaskFragments()) {
            throw new IllegalArgumentException("allowMultipleAdjacentTaskFragments is not enabled."
                    + " Use #setAdjacentRoots instead.");
        }
        if (roots.length < 2) {
            throw new IllegalArgumentException("setAdjacentRootSet must have size >= 2");
        }
@@ -1973,13 +1963,6 @@ public final class WindowContainerTransaction implements Parcelable {
            return mContainers;
        }

        /** @deprecated b/373709676 replace with {@link #getContainers()}. */
        @Deprecated
        @NonNull
        public IBinder getAdjacentRoot() {
            return mReparent;
        }

        public boolean getToTop() {
            return mToTop;
        }
@@ -2127,7 +2110,6 @@ public final class WindowContainerTransaction implements Parcelable {
                    sb.append(mContainer).append(" to ").append(mToTop ? "top" : "bottom");
                    break;
                case HIERARCHY_OP_TYPE_SET_ADJACENT_ROOTS:
                    if (Flags.allowMultipleAdjacentTaskFragments()) {
                    for (IBinder container : mContainers) {
                        if (container == mContainers[0]) {
                            sb.append("adjacentRoots=").append(container);
@@ -2135,10 +2117,6 @@ public final class WindowContainerTransaction implements Parcelable {
                            sb.append(", ").append(container);
                        }
                    }
                    } else {
                        sb.append("container=").append(mContainer)
                                .append(" adjacentRoot=").append(mReparent);
                    }
                    break;
                case HIERARCHY_OP_TYPE_LAUNCH_TASK:
                    sb.append(mLaunchOptions);
+2 −9
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ import com.android.server.FgThread;
import com.android.server.LocalServices;
import com.android.server.apphibernation.AppHibernationManagerInternal;
import com.android.server.apphibernation.AppHibernationService;
import com.android.window.flags.Flags;

import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
@@ -807,14 +806,8 @@ class ActivityMetricsLogger {
            }
            final Task otherTask = otherInfo.mLastLaunchedActivity.getTask();
            // The adjacent task is the split root in which activities are started
            final boolean isDescendantOfAdjacent;
            if (Flags.allowMultipleAdjacentTaskFragments()) {
                isDescendantOfAdjacent = launchedSplitRootTask.forOtherAdjacentTasks(
            final boolean isDescendantOfAdjacent = launchedSplitRootTask.forOtherAdjacentTasks(
                    otherTask::isDescendantOf);
            } else {
                isDescendantOfAdjacent = otherTask.isDescendantOf(
                        launchedSplitRootTask.getAdjacentTask());
            }
            if (isDescendantOfAdjacent) {
                if (DEBUG_METRICS) {
                    Slog.i(TAG, "Found adjacent tasks t1=" + launchedActivityTask.mTaskId
+4 −18
Original line number Diff line number Diff line
@@ -3801,19 +3801,10 @@ final class ActivityRecord extends WindowToken {
        final TaskFragment taskFragment = getTaskFragment();
        if (next != null && taskFragment != null && taskFragment.isEmbedded()) {
            final TaskFragment organized = taskFragment.getOrganizedTaskFragment();
            if (Flags.allowMultipleAdjacentTaskFragments()) {
            delayRemoval = organized != null
                    && organized.topRunningActivity() == null
                    && organized.isDelayLastActivityRemoval()
                    && organized.forOtherAdjacentTaskFragments(next::isDescendantOf);
            } else {
                final TaskFragment adjacent =
                        organized != null ? organized.getAdjacentTaskFragment() : null;
                if (adjacent != null && next.isDescendantOf(adjacent)
                        && organized.topRunningActivity() == null) {
                    delayRemoval = organized.isDelayLastActivityRemoval();
                }
            }
        }

        // isNextNotYetVisible is to check if the next activity is invisible, or it has been
@@ -4787,11 +4778,6 @@ final class ActivityRecord extends WindowToken {
        }

        // Make sure the embedded adjacent can also be shown.
        if (!Flags.allowMultipleAdjacentTaskFragments()) {
            final ActivityRecord adjacentActivity = taskFragment.getAdjacentTaskFragment()
                    .getTopNonFinishingActivity();
            return canShowWhenLocked(adjacentActivity);
        }
        final boolean hasAdjacentNotAllowToShow = taskFragment.forOtherAdjacentTaskFragments(
                adjacentTF -> !canShowWhenLocked(adjacentTF.getTopNonFinishingActivity()));
        return !hasAdjacentNotAllowToShow;
+0 −21
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import android.window.TaskSnapshot;

import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wm.BaseAppSnapshotPersister.PersistInfoProvider;
import com.android.window.flags.Flags;

import java.io.File;
import java.io.PrintWriter;
@@ -532,26 +531,6 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
        final int currentIndex = currTF.asTask() != null
                ? currentTask.mChildren.indexOf(currentActivity)
                : currentTask.mChildren.indexOf(currTF);
        if (!Flags.allowMultipleAdjacentTaskFragments()) {
            final int prevAdjacentIndex = currentTask.mChildren.indexOf(
                    prevTF.getAdjacentTaskFragment());
            if (prevAdjacentIndex > currentIndex) {
                // PrevAdjacentTF already above currentActivity
                return;
            }
            // Add both the one below, and its adjacent.
            if (!inTransition || isInParticipant(initPrev, mTmpTransitionParticipants)) {
                result.add(initPrev);
            }
            final ActivityRecord prevAdjacentActivity = prevTF.getAdjacentTaskFragment()
                    .getTopMostActivity();
            if (prevAdjacentActivity != null && (!inTransition
                    || isInParticipant(prevAdjacentActivity, mTmpTransitionParticipants))) {
                result.add(prevAdjacentActivity);
            }
            return;
        }

        final boolean hasAdjacentAboveCurrent = prevTF.forOtherAdjacentTaskFragments(
                prevAdjacentTF -> {
                    final int prevAdjacentIndex = currentTask.mChildren.indexOf(prevAdjacentTF);
+3 −12
Original line number Diff line number Diff line
@@ -164,7 +164,6 @@ import com.android.server.companion.virtual.VirtualDeviceManagerInternal;
import com.android.server.pm.SaferIntentUtils;
import com.android.server.utils.Slogf;
import com.android.server.wm.ActivityMetricsLogger.LaunchingState;
import com.android.window.flags.Flags;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -2991,17 +2990,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {

                if (child.asTaskFragment() != null
                        && child.asTaskFragment().hasAdjacentTaskFragment()) {
                    final boolean isAnyTranslucent;
                    if (Flags.allowMultipleAdjacentTaskFragments()) {
                        final TaskFragment.AdjacentSet set =
                                child.asTaskFragment().getAdjacentTaskFragments();
                        isAnyTranslucent = set.forAllTaskFragments(
                                tf -> !isOpaque(tf), null);
                    } else {
                        final TaskFragment adjacent = child.asTaskFragment()
                                .getAdjacentTaskFragment();
                        isAnyTranslucent = !isOpaque(child) || !isOpaque(adjacent);
                    }
                    final boolean isAnyTranslucent = !isOpaque(child)
                            || child.asTaskFragment().forOtherAdjacentTaskFragments(
                                    tf -> !isOpaque(tf));
                    if (!isAnyTranslucent) {
                        // This task fragment and all its adjacent task fragments are opaque,
                        // consider it opaque even if it doesn't fill its parent.
Loading