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

Commit 35b2942b authored by Chris Li's avatar Chris Li
Browse files

Fix ActivityEmbedding flicker when dragging freeform window

Before, when dragging freeform window without resizing,
TaskFragmentOrganizer would update the TaskFragment bounds to abosulte
bounds, which can have a racing condition when the freeform Task is also
repositioning.
Now, TaskFragmentOrganizer only set relative bounds, so that it won't
trigger unnecessary change transition.

Also, don't start change transition when the Task isDragResizing.

Bug: 256967281
Test: atest WMJetpackUnitTests:SplitPresenterTest
Test: atest WmTests:TaskFragmentTest
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Test: manually verify dragging freeform with ActivityEmbedding
Change-Id: I87535036c9f69a7b50b2fe6bdf3e996ae73a8a64
parent 845df38b
Loading
Loading
Loading
Loading
+62 −3
Original line number Original line Diff line number Diff line
@@ -52,10 +52,26 @@ public final class TaskFragmentCreationParams implements Parcelable {
    @NonNull
    @NonNull
    private final IBinder mOwnerToken;
    private final IBinder mOwnerToken;


    /** The initial bounds of the TaskFragment. Fills parent if empty. */
    /**
     * The initial bounds of the TaskFragment. Fills parent if empty.
     * TODO(b/232476698): cleanup with update CTS.
     */
    @NonNull
    @NonNull
    private final Rect mInitialBounds = new Rect();
    private final Rect mInitialBounds = new Rect();


    /**
     * The initial relative bounds of the TaskFragment in parent coordinate.
     * Fills parent if empty.
     */
    @NonNull
    private final Rect mInitialRelativeBounds = new Rect();

    /**
     * Whether the params are using {@link Builder#setInitialRelativeBounds(Rect)}.
     * TODO(b/232476698): remove after remove mInitialBounds
     */
    private final boolean mAreInitialRelativeBoundsSet;

    /** The initial windowing mode of the TaskFragment. Inherits from parent if not set. */
    /** The initial windowing mode of the TaskFragment. Inherits from parent if not set. */
    @WindowingMode
    @WindowingMode
    private final int mWindowingMode;
    private final int mWindowingMode;
@@ -94,6 +110,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
    private TaskFragmentCreationParams(
    private TaskFragmentCreationParams(
            @NonNull TaskFragmentOrganizerToken organizer, @NonNull IBinder fragmentToken,
            @NonNull TaskFragmentOrganizerToken organizer, @NonNull IBinder fragmentToken,
            @NonNull IBinder ownerToken, @NonNull Rect initialBounds,
            @NonNull IBinder ownerToken, @NonNull Rect initialBounds,
            @NonNull Rect initialRelativeBounds, boolean areInitialRelativeBoundsSet,
            @WindowingMode int windowingMode, @Nullable IBinder pairedPrimaryFragmentToken,
            @WindowingMode int windowingMode, @Nullable IBinder pairedPrimaryFragmentToken,
            @Nullable IBinder pairedActivityToken) {
            @Nullable IBinder pairedActivityToken) {
        if (pairedPrimaryFragmentToken != null && pairedActivityToken != null) {
        if (pairedPrimaryFragmentToken != null && pairedActivityToken != null) {
@@ -104,6 +121,8 @@ public final class TaskFragmentCreationParams implements Parcelable {
        mFragmentToken = fragmentToken;
        mFragmentToken = fragmentToken;
        mOwnerToken = ownerToken;
        mOwnerToken = ownerToken;
        mInitialBounds.set(initialBounds);
        mInitialBounds.set(initialBounds);
        mInitialRelativeBounds.set(initialRelativeBounds);
        mAreInitialRelativeBoundsSet = areInitialRelativeBoundsSet;
        mWindowingMode = windowingMode;
        mWindowingMode = windowingMode;
        mPairedPrimaryFragmentToken = pairedPrimaryFragmentToken;
        mPairedPrimaryFragmentToken = pairedPrimaryFragmentToken;
        mPairedActivityToken = pairedActivityToken;
        mPairedActivityToken = pairedActivityToken;
@@ -129,6 +148,23 @@ public final class TaskFragmentCreationParams implements Parcelable {
        return mInitialBounds;
        return mInitialBounds;
    }
    }


    /**
     * TODO(b/232476698): remove the hide with adding CTS for this in next release.
     * @hide
     */
    @NonNull
    public Rect getInitialRelativeBounds() {
        return mInitialRelativeBounds;
    }

    /**
     * TODO(b/232476698): remove after remove mInitialBounds.
     * @hide
     */
    public boolean areInitialRelativeBoundsSet() {
        return mAreInitialRelativeBoundsSet;
    }

    @WindowingMode
    @WindowingMode
    public int getWindowingMode() {
    public int getWindowingMode() {
        return mWindowingMode;
        return mWindowingMode;
@@ -157,6 +193,8 @@ public final class TaskFragmentCreationParams implements Parcelable {
        mFragmentToken = in.readStrongBinder();
        mFragmentToken = in.readStrongBinder();
        mOwnerToken = in.readStrongBinder();
        mOwnerToken = in.readStrongBinder();
        mInitialBounds.readFromParcel(in);
        mInitialBounds.readFromParcel(in);
        mInitialRelativeBounds.readFromParcel(in);
        mAreInitialRelativeBoundsSet = in.readBoolean();
        mWindowingMode = in.readInt();
        mWindowingMode = in.readInt();
        mPairedPrimaryFragmentToken = in.readStrongBinder();
        mPairedPrimaryFragmentToken = in.readStrongBinder();
        mPairedActivityToken = in.readStrongBinder();
        mPairedActivityToken = in.readStrongBinder();
@@ -169,6 +207,8 @@ public final class TaskFragmentCreationParams implements Parcelable {
        dest.writeStrongBinder(mFragmentToken);
        dest.writeStrongBinder(mFragmentToken);
        dest.writeStrongBinder(mOwnerToken);
        dest.writeStrongBinder(mOwnerToken);
        mInitialBounds.writeToParcel(dest, flags);
        mInitialBounds.writeToParcel(dest, flags);
        mInitialRelativeBounds.writeToParcel(dest, flags);
        dest.writeBoolean(mAreInitialRelativeBoundsSet);
        dest.writeInt(mWindowingMode);
        dest.writeInt(mWindowingMode);
        dest.writeStrongBinder(mPairedPrimaryFragmentToken);
        dest.writeStrongBinder(mPairedPrimaryFragmentToken);
        dest.writeStrongBinder(mPairedActivityToken);
        dest.writeStrongBinder(mPairedActivityToken);
@@ -195,6 +235,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
                + " fragmentToken=" + mFragmentToken
                + " fragmentToken=" + mFragmentToken
                + " ownerToken=" + mOwnerToken
                + " ownerToken=" + mOwnerToken
                + " initialBounds=" + mInitialBounds
                + " initialBounds=" + mInitialBounds
                + " initialRelativeBounds=" + mInitialRelativeBounds
                + " windowingMode=" + mWindowingMode
                + " windowingMode=" + mWindowingMode
                + " pairedFragmentToken=" + mPairedPrimaryFragmentToken
                + " pairedFragmentToken=" + mPairedPrimaryFragmentToken
                + " pairedActivityToken=" + mPairedActivityToken
                + " pairedActivityToken=" + mPairedActivityToken
@@ -222,6 +263,11 @@ public final class TaskFragmentCreationParams implements Parcelable {
        @NonNull
        @NonNull
        private final Rect mInitialBounds = new Rect();
        private final Rect mInitialBounds = new Rect();


        @NonNull
        private final Rect mInitialRelativeBounds = new Rect();

        private boolean mAreInitialRelativeBoundsSet;

        @WindowingMode
        @WindowingMode
        private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
        private int mWindowingMode = WINDOWING_MODE_UNDEFINED;


@@ -245,6 +291,19 @@ public final class TaskFragmentCreationParams implements Parcelable {
            return this;
            return this;
        }
        }


        /**
         * Sets the initial relative bounds for the TaskFragment in parent coordinate.
         * Set to empty to fill parent.
         * TODO(b/232476698): remove the hide with adding CTS for this in next release.
         * @hide
         */
        @NonNull
        public Builder setInitialRelativeBounds(@NonNull Rect bounds) {
            mInitialRelativeBounds.set(bounds);
            mAreInitialRelativeBoundsSet = true;
            return this;
        }

        /** Sets the initial windowing mode for the TaskFragment. */
        /** Sets the initial windowing mode for the TaskFragment. */
        @NonNull
        @NonNull
        public Builder setWindowingMode(@WindowingMode int windowingMode) {
        public Builder setWindowingMode(@WindowingMode int windowingMode) {
@@ -296,8 +355,8 @@ public final class TaskFragmentCreationParams implements Parcelable {
        @NonNull
        @NonNull
        public TaskFragmentCreationParams build() {
        public TaskFragmentCreationParams build() {
            return new TaskFragmentCreationParams(mOrganizer, mFragmentToken, mOwnerToken,
            return new TaskFragmentCreationParams(mOrganizer, mFragmentToken, mOwnerToken,
                    mInitialBounds, mWindowingMode, mPairedPrimaryFragmentToken,
                    mInitialBounds, mInitialRelativeBounds, mAreInitialRelativeBoundsSet,
                    mPairedActivityToken);
                    mWindowingMode, mPairedPrimaryFragmentToken, mPairedActivityToken);
        }
        }
    }
    }
}
}
+43 −0
Original line number Original line Diff line number Diff line
@@ -305,6 +305,26 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
        return this;
    }
    }


    /**
     * Resizes a container by providing a bounds in its parent coordinate.
     * This is only used by {@link TaskFragmentOrganizer}.
     * @hide
     */
    @NonNull
    public WindowContainerTransaction setRelativeBounds(
            @NonNull WindowContainerToken container, @NonNull Rect relBounds) {
        Change chg = getOrCreateChange(container.asBinder());
        if (chg.mRelativeBounds == null) {
            chg.mRelativeBounds = new Rect();
        }
        chg.mRelativeBounds.set(relBounds);
        chg.mChangeMask |= Change.CHANGE_RELATIVE_BOUNDS;
        // Bounds will be overridden.
        chg.mConfigSetMask |= ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
        chg.mWindowSetMask |= WindowConfiguration.WINDOW_CONFIG_BOUNDS;
        return this;
    }

    /**
    /**
     * Reparents a container into another one. The effect of a {@code null} parent can vary. For
     * Reparents a container into another one. The effect of a {@code null} parent can vary. For
     * example, reparenting a stack to {@code null} will reparent it to its display.
     * example, reparenting a stack to {@code null} will reparent it to its display.
@@ -979,6 +999,7 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int CHANGE_FORCE_NO_PIP = 1 << 6;
        public static final int CHANGE_FORCE_NO_PIP = 1 << 6;
        public static final int CHANGE_FORCE_TRANSLUCENT = 1 << 7;
        public static final int CHANGE_FORCE_TRANSLUCENT = 1 << 7;
        public static final int CHANGE_DRAG_RESIZING = 1 << 8;
        public static final int CHANGE_DRAG_RESIZING = 1 << 8;
        public static final int CHANGE_RELATIVE_BOUNDS = 1 << 9;


        private final Configuration mConfiguration = new Configuration();
        private final Configuration mConfiguration = new Configuration();
        private boolean mFocusable = true;
        private boolean mFocusable = true;
@@ -994,6 +1015,8 @@ public final class WindowContainerTransaction implements Parcelable {
        private Rect mPinnedBounds = null;
        private Rect mPinnedBounds = null;
        private SurfaceControl.Transaction mBoundsChangeTransaction = null;
        private SurfaceControl.Transaction mBoundsChangeTransaction = null;
        private Rect mBoundsChangeSurfaceBounds = null;
        private Rect mBoundsChangeSurfaceBounds = null;
        @Nullable
        private Rect mRelativeBounds = null;


        private int mActivityWindowingMode = -1;
        private int mActivityWindowingMode = -1;
        private int mWindowingMode = -1;
        private int mWindowingMode = -1;
@@ -1022,6 +1045,10 @@ public final class WindowContainerTransaction implements Parcelable {
                mBoundsChangeSurfaceBounds = new Rect();
                mBoundsChangeSurfaceBounds = new Rect();
                mBoundsChangeSurfaceBounds.readFromParcel(in);
                mBoundsChangeSurfaceBounds.readFromParcel(in);
            }
            }
            if ((mChangeMask & Change.CHANGE_RELATIVE_BOUNDS) != 0) {
                mRelativeBounds = new Rect();
                mRelativeBounds.readFromParcel(in);
            }


            mWindowingMode = in.readInt();
            mWindowingMode = in.readInt();
            mActivityWindowingMode = in.readInt();
            mActivityWindowingMode = in.readInt();
@@ -1069,6 +1096,11 @@ public final class WindowContainerTransaction implements Parcelable {
                mBoundsChangeSurfaceBounds = transfer ? other.mBoundsChangeSurfaceBounds
                mBoundsChangeSurfaceBounds = transfer ? other.mBoundsChangeSurfaceBounds
                        : new Rect(other.mBoundsChangeSurfaceBounds);
                        : new Rect(other.mBoundsChangeSurfaceBounds);
            }
            }
            if (other.mRelativeBounds != null) {
                mRelativeBounds = transfer
                        ? other.mRelativeBounds
                        : new Rect(other.mRelativeBounds);
            }
        }
        }


        public int getWindowingMode() {
        public int getWindowingMode() {
@@ -1156,6 +1188,11 @@ public final class WindowContainerTransaction implements Parcelable {
            return mBoundsChangeSurfaceBounds;
            return mBoundsChangeSurfaceBounds;
        }
        }


        @Nullable
        public Rect getRelativeBounds() {
            return mRelativeBounds;
        }

        @Override
        @Override
        public String toString() {
        public String toString() {
            final boolean changesBounds =
            final boolean changesBounds =
@@ -1196,6 +1233,9 @@ public final class WindowContainerTransaction implements Parcelable {
            if ((mChangeMask & CHANGE_IGNORE_ORIENTATION_REQUEST) != 0) {
            if ((mChangeMask & CHANGE_IGNORE_ORIENTATION_REQUEST) != 0) {
                sb.append("ignoreOrientationRequest:" + mIgnoreOrientationRequest + ",");
                sb.append("ignoreOrientationRequest:" + mIgnoreOrientationRequest + ",");
            }
            }
            if ((mChangeMask & CHANGE_RELATIVE_BOUNDS) != 0) {
                sb.append("relativeBounds:").append(mRelativeBounds).append(",");
            }
            sb.append("}");
            sb.append("}");
            return sb.toString();
            return sb.toString();
        }
        }
@@ -1221,6 +1261,9 @@ public final class WindowContainerTransaction implements Parcelable {
            if (mBoundsChangeSurfaceBounds != null) {
            if (mBoundsChangeSurfaceBounds != null) {
                mBoundsChangeSurfaceBounds.writeToParcel(dest, flags);
                mBoundsChangeSurfaceBounds.writeToParcel(dest, flags);
            }
            }
            if (mRelativeBounds != null) {
                mRelativeBounds.writeToParcel(dest, flags);
            }


            dest.writeInt(mWindowingMode);
            dest.writeInt(mWindowingMode);
            dest.writeInt(mActivityWindowingMode);
            dest.writeInt(mActivityWindowingMode);
+18 −17
Original line number Original line Diff line number Diff line
@@ -109,38 +109,38 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
     *                                  be resized based on {@param launchingFragmentBounds}.
     *                                  be resized based on {@param launchingFragmentBounds}.
     *                                  Otherwise, we will create a new TaskFragment with the given
     *                                  Otherwise, we will create a new TaskFragment with the given
     *                                  token for the {@param launchingActivity}.
     *                                  token for the {@param launchingActivity}.
     * @param launchingFragmentBounds   the initial bounds for the launching TaskFragment.
     * @param launchingRelBounds    the initial relative bounds for the launching TaskFragment.
     * @param launchingActivity the Activity to put on the left hand side of the split as the
     * @param launchingActivity the Activity to put on the left hand side of the split as the
     *                          primary.
     *                          primary.
     * @param secondaryFragmentToken    token to create the secondary TaskFragment with.
     * @param secondaryFragmentToken    token to create the secondary TaskFragment with.
     * @param secondaryFragmentBounds   the initial bounds for the secondary TaskFragment
     * @param secondaryRelBounds    the initial relative bounds for the secondary TaskFragment
     * @param activityIntent    Intent to start the secondary Activity with.
     * @param activityIntent    Intent to start the secondary Activity with.
     * @param activityOptions   ActivityOptions to start the secondary Activity with.
     * @param activityOptions   ActivityOptions to start the secondary Activity with.
     * @param windowingMode     the windowing mode to set for the TaskFragments.
     * @param windowingMode     the windowing mode to set for the TaskFragments.
     * @param splitAttributes   the {@link SplitAttributes} to represent the split.
     * @param splitAttributes   the {@link SplitAttributes} to represent the split.
     */
     */
    void startActivityToSide(@NonNull WindowContainerTransaction wct,
    void startActivityToSide(@NonNull WindowContainerTransaction wct,
            @NonNull IBinder launchingFragmentToken, @NonNull Rect launchingFragmentBounds,
            @NonNull IBinder launchingFragmentToken, @NonNull Rect launchingRelBounds,
            @NonNull Activity launchingActivity, @NonNull IBinder secondaryFragmentToken,
            @NonNull Activity launchingActivity, @NonNull IBinder secondaryFragmentToken,
            @NonNull Rect secondaryFragmentBounds, @NonNull Intent activityIntent,
            @NonNull Rect secondaryRelBounds, @NonNull Intent activityIntent,
            @Nullable Bundle activityOptions, @NonNull SplitRule rule,
            @Nullable Bundle activityOptions, @NonNull SplitRule rule,
            @WindowingMode int windowingMode, @NonNull SplitAttributes splitAttributes) {
            @WindowingMode int windowingMode, @NonNull SplitAttributes splitAttributes) {
        final IBinder ownerToken = launchingActivity.getActivityToken();
        final IBinder ownerToken = launchingActivity.getActivityToken();


        // Create or resize the launching TaskFragment.
        // Create or resize the launching TaskFragment.
        if (mFragmentInfos.containsKey(launchingFragmentToken)) {
        if (mFragmentInfos.containsKey(launchingFragmentToken)) {
            resizeTaskFragment(wct, launchingFragmentToken, launchingFragmentBounds);
            resizeTaskFragment(wct, launchingFragmentToken, launchingRelBounds);
            updateWindowingMode(wct, launchingFragmentToken, windowingMode);
            updateWindowingMode(wct, launchingFragmentToken, windowingMode);
        } else {
        } else {
            createTaskFragmentAndReparentActivity(wct, launchingFragmentToken, ownerToken,
            createTaskFragmentAndReparentActivity(wct, launchingFragmentToken, ownerToken,
                    launchingFragmentBounds, windowingMode, launchingActivity);
                    launchingRelBounds, windowingMode, launchingActivity);
        }
        }
        updateAnimationParams(wct, launchingFragmentToken, splitAttributes);
        updateAnimationParams(wct, launchingFragmentToken, splitAttributes);


        // Create a TaskFragment for the secondary activity.
        // Create a TaskFragment for the secondary activity.
        final TaskFragmentCreationParams fragmentOptions = new TaskFragmentCreationParams.Builder(
        final TaskFragmentCreationParams fragmentOptions = new TaskFragmentCreationParams.Builder(
                getOrganizerToken(), secondaryFragmentToken, ownerToken)
                getOrganizerToken(), secondaryFragmentToken, ownerToken)
                .setInitialBounds(secondaryFragmentBounds)
                .setInitialRelativeBounds(secondaryRelBounds)
                .setWindowingMode(windowingMode)
                .setWindowingMode(windowingMode)
                // Make sure to set the paired fragment token so that the new TaskFragment will be
                // Make sure to set the paired fragment token so that the new TaskFragment will be
                // positioned right above the paired TaskFragment.
                // positioned right above the paired TaskFragment.
@@ -190,8 +190,9 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
     *                   have to be a child of this task fragment, but must belong to the same task.
     *                   have to be a child of this task fragment, but must belong to the same task.
     */
     */
    void createTaskFragment(@NonNull WindowContainerTransaction wct, @NonNull IBinder fragmentToken,
    void createTaskFragment(@NonNull WindowContainerTransaction wct, @NonNull IBinder fragmentToken,
            @NonNull IBinder ownerToken, @NonNull Rect bounds, @WindowingMode int windowingMode) {
            @NonNull IBinder ownerToken, @NonNull Rect relBounds,
        createTaskFragment(wct, fragmentToken, ownerToken, bounds, windowingMode,
            @WindowingMode int windowingMode) {
        createTaskFragment(wct, fragmentToken, ownerToken, relBounds, windowingMode,
                null /* pairedActivityToken */);
                null /* pairedActivityToken */);
    }
    }


@@ -203,11 +204,11 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
     *                            positioned right above it.
     *                            positioned right above it.
     */
     */
    void createTaskFragment(@NonNull WindowContainerTransaction wct, @NonNull IBinder fragmentToken,
    void createTaskFragment(@NonNull WindowContainerTransaction wct, @NonNull IBinder fragmentToken,
            @NonNull IBinder ownerToken, @NonNull Rect bounds, @WindowingMode int windowingMode,
            @NonNull IBinder ownerToken, @NonNull Rect relBounds, @WindowingMode int windowingMode,
            @Nullable IBinder pairedActivityToken) {
            @Nullable IBinder pairedActivityToken) {
        final TaskFragmentCreationParams fragmentOptions = new TaskFragmentCreationParams.Builder(
        final TaskFragmentCreationParams fragmentOptions = new TaskFragmentCreationParams.Builder(
                getOrganizerToken(), fragmentToken, ownerToken)
                getOrganizerToken(), fragmentToken, ownerToken)
                .setInitialBounds(bounds)
                .setInitialRelativeBounds(relBounds)
                .setWindowingMode(windowingMode)
                .setWindowingMode(windowingMode)
                .setPairedActivityToken(pairedActivityToken)
                .setPairedActivityToken(pairedActivityToken)
                .build();
                .build();
@@ -229,10 +230,10 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
     *                   have to be a child of this task fragment, but must belong to the same task.
     *                   have to be a child of this task fragment, but must belong to the same task.
     */
     */
    private void createTaskFragmentAndReparentActivity(@NonNull WindowContainerTransaction wct,
    private void createTaskFragmentAndReparentActivity(@NonNull WindowContainerTransaction wct,
            @NonNull IBinder fragmentToken, @NonNull IBinder ownerToken, @NonNull Rect bounds,
            @NonNull IBinder fragmentToken, @NonNull IBinder ownerToken, @NonNull Rect relBounds,
            @WindowingMode int windowingMode, @NonNull Activity activity) {
            @WindowingMode int windowingMode, @NonNull Activity activity) {
        final IBinder reparentActivityToken = activity.getActivityToken();
        final IBinder reparentActivityToken = activity.getActivityToken();
        createTaskFragment(wct, fragmentToken, ownerToken, bounds, windowingMode,
        createTaskFragment(wct, fragmentToken, ownerToken, relBounds, windowingMode,
                reparentActivityToken);
                reparentActivityToken);
        wct.reparentActivityToTaskFragment(fragmentToken, reparentActivityToken);
        wct.reparentActivityToTaskFragment(fragmentToken, reparentActivityToken);
    }
    }
@@ -280,15 +281,15 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
    }
    }


    void resizeTaskFragment(@NonNull WindowContainerTransaction wct, @NonNull IBinder fragmentToken,
    void resizeTaskFragment(@NonNull WindowContainerTransaction wct, @NonNull IBinder fragmentToken,
            @Nullable Rect bounds) {
            @Nullable Rect relBounds) {
        if (!mFragmentInfos.containsKey(fragmentToken)) {
        if (!mFragmentInfos.containsKey(fragmentToken)) {
            throw new IllegalArgumentException(
            throw new IllegalArgumentException(
                    "Can't find an existing TaskFragment with fragmentToken=" + fragmentToken);
                    "Can't find an existing TaskFragment with fragmentToken=" + fragmentToken);
        }
        }
        if (bounds == null) {
        if (relBounds == null) {
            bounds = new Rect();
            relBounds = new Rect();
        }
        }
        wct.setBounds(mFragmentInfos.get(fragmentToken).getToken(), bounds);
        wct.setRelativeBounds(mFragmentInfos.get(fragmentToken).getToken(), relBounds);
    }
    }


    void updateWindowingMode(@NonNull WindowContainerTransaction wct,
    void updateWindowingMode(@NonNull WindowContainerTransaction wct,
+44 −37

File changed.

Preview size limit exceeded, changes collapsed.

+9 −0
Original line number Original line Diff line number Diff line
@@ -243,6 +243,15 @@ class TaskContainer {
            return mConfiguration;
            return mConfiguration;
        }
        }


        /** Translates the given absolute bounds to relative bounds in this Task coordinate. */
        void translateAbsoluteBoundsToRelativeBounds(@NonNull Rect inOutBounds) {
            if (inOutBounds.isEmpty()) {
                return;
            }
            final Rect taskBounds = mConfiguration.windowConfiguration.getBounds();
            inOutBounds.offset(-taskBounds.left, -taskBounds.top);
        }

        /**
        /**
         * Obtains the {@link TaskProperties} for the task that the provided {@link Activity} is
         * Obtains the {@link TaskProperties} for the task that the provided {@link Activity} is
         * associated with.
         * associated with.
Loading