Cleanup TaskFragmentCreationParams setInitialBounds

It has been replaced with setInitialRelativeBounds.

Bug: 265271880
Test: pass existing tests
Change-Id: Id14907129ded757833a7484b1cd6ec20df3c1af5
This commit is contained in:
Chris Li
2023-02-13 17:44:04 +08:00
parent dd76f4b3fc
commit 62cc0b4a10
3 changed files with 6 additions and 62 deletions

View File

@@ -3716,7 +3716,7 @@ package android.window {
public final class TaskFragmentCreationParams implements android.os.Parcelable {
method @NonNull public android.os.IBinder getFragmentToken();
method @NonNull public android.graphics.Rect getInitialBounds();
method @NonNull public android.graphics.Rect getInitialRelativeBounds();
method @NonNull public android.window.TaskFragmentOrganizerToken getOrganizer();
method @NonNull public android.os.IBinder getOwnerToken();
method public int getWindowingMode();
@@ -3726,7 +3726,7 @@ package android.window {
public static final class TaskFragmentCreationParams.Builder {
ctor public TaskFragmentCreationParams.Builder(@NonNull android.window.TaskFragmentOrganizerToken, @NonNull android.os.IBinder, @NonNull android.os.IBinder);
method @NonNull public android.window.TaskFragmentCreationParams build();
method @NonNull public android.window.TaskFragmentCreationParams.Builder setInitialBounds(@NonNull android.graphics.Rect);
method @NonNull public android.window.TaskFragmentCreationParams.Builder setInitialRelativeBounds(@NonNull android.graphics.Rect);
method @NonNull public android.window.TaskFragmentCreationParams.Builder setWindowingMode(int);
}

View File

@@ -52,13 +52,6 @@ public final class TaskFragmentCreationParams implements Parcelable {
@NonNull
private final IBinder mOwnerToken;
/**
* The initial bounds of the TaskFragment. Fills parent if empty.
* TODO(b/232476698): cleanup with update CTS.
*/
@NonNull
private final Rect mInitialBounds = new Rect();
/**
* The initial relative bounds of the TaskFragment in parent coordinate.
* Fills parent if empty.
@@ -66,12 +59,6 @@ public final class TaskFragmentCreationParams implements Parcelable {
@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. */
@WindowingMode
private final int mWindowingMode;
@@ -109,8 +96,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
private TaskFragmentCreationParams(
@NonNull TaskFragmentOrganizerToken organizer, @NonNull IBinder fragmentToken,
@NonNull IBinder ownerToken, @NonNull Rect initialBounds,
@NonNull Rect initialRelativeBounds, boolean areInitialRelativeBoundsSet,
@NonNull IBinder ownerToken, @NonNull Rect initialRelativeBounds,
@WindowingMode int windowingMode, @Nullable IBinder pairedPrimaryFragmentToken,
@Nullable IBinder pairedActivityToken) {
if (pairedPrimaryFragmentToken != null && pairedActivityToken != null) {
@@ -120,9 +106,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
mOrganizer = organizer;
mFragmentToken = fragmentToken;
mOwnerToken = ownerToken;
mInitialBounds.set(initialBounds);
mInitialRelativeBounds.set(initialRelativeBounds);
mAreInitialRelativeBoundsSet = areInitialRelativeBoundsSet;
mWindowingMode = windowingMode;
mPairedPrimaryFragmentToken = pairedPrimaryFragmentToken;
mPairedActivityToken = pairedActivityToken;
@@ -143,28 +127,11 @@ public final class TaskFragmentCreationParams implements Parcelable {
return mOwnerToken;
}
@NonNull
public Rect getInitialBounds() {
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
public int getWindowingMode() {
return mWindowingMode;
@@ -192,9 +159,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
mOrganizer = TaskFragmentOrganizerToken.CREATOR.createFromParcel(in);
mFragmentToken = in.readStrongBinder();
mOwnerToken = in.readStrongBinder();
mInitialBounds.readFromParcel(in);
mInitialRelativeBounds.readFromParcel(in);
mAreInitialRelativeBoundsSet = in.readBoolean();
mWindowingMode = in.readInt();
mPairedPrimaryFragmentToken = in.readStrongBinder();
mPairedActivityToken = in.readStrongBinder();
@@ -206,9 +171,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
mOrganizer.writeToParcel(dest, flags);
dest.writeStrongBinder(mFragmentToken);
dest.writeStrongBinder(mOwnerToken);
mInitialBounds.writeToParcel(dest, flags);
mInitialRelativeBounds.writeToParcel(dest, flags);
dest.writeBoolean(mAreInitialRelativeBoundsSet);
dest.writeInt(mWindowingMode);
dest.writeStrongBinder(mPairedPrimaryFragmentToken);
dest.writeStrongBinder(mPairedActivityToken);
@@ -234,7 +197,6 @@ public final class TaskFragmentCreationParams implements Parcelable {
+ " organizer=" + mOrganizer
+ " fragmentToken=" + mFragmentToken
+ " ownerToken=" + mOwnerToken
+ " initialBounds=" + mInitialBounds
+ " initialRelativeBounds=" + mInitialRelativeBounds
+ " windowingMode=" + mWindowingMode
+ " pairedFragmentToken=" + mPairedPrimaryFragmentToken
@@ -260,14 +222,9 @@ public final class TaskFragmentCreationParams implements Parcelable {
@NonNull
private final IBinder mOwnerToken;
@NonNull
private final Rect mInitialBounds = new Rect();
@NonNull
private final Rect mInitialRelativeBounds = new Rect();
private boolean mAreInitialRelativeBoundsSet;
@WindowingMode
private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
@@ -284,23 +241,13 @@ public final class TaskFragmentCreationParams implements Parcelable {
mOwnerToken = ownerToken;
}
/** Sets the initial bounds for the TaskFragment. */
@NonNull
public Builder setInitialBounds(@NonNull Rect bounds) {
mInitialBounds.set(bounds);
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;
}
@@ -355,8 +302,8 @@ public final class TaskFragmentCreationParams implements Parcelable {
@NonNull
public TaskFragmentCreationParams build() {
return new TaskFragmentCreationParams(mOrganizer, mFragmentToken, mOwnerToken,
mInitialBounds, mInitialRelativeBounds, mAreInitialRelativeBoundsSet,
mWindowingMode, mPairedPrimaryFragmentToken, mPairedActivityToken);
mInitialRelativeBounds, mWindowingMode, mPairedPrimaryFragmentToken,
mPairedActivityToken);
}
}
}

View File

@@ -1900,16 +1900,13 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
}
ownerTask.addChild(taskFragment, position);
taskFragment.setWindowingMode(creationParams.getWindowingMode());
if (creationParams.areInitialRelativeBoundsSet()) {
if (!creationParams.getInitialRelativeBounds().isEmpty()) {
// Set relative bounds instead of using setBounds. This will avoid unnecessary update in
// case the parent has resized since the last time parent info is sent to the organizer.
taskFragment.setRelativeEmbeddedBounds(creationParams.getInitialRelativeBounds());
// Recompute configuration as the bounds will be calculated based on relative bounds in
// TaskFragment#resolveOverrideConfiguration.
taskFragment.recomputeConfiguration();
} else {
// TODO(b/232476698): remove after remove creationParams.getInitialBounds().
taskFragment.setBounds(creationParams.getInitialBounds());
}
mLaunchTaskFragments.put(creationParams.getFragmentToken(), taskFragment);