Cleanup TaskFragmentCreationParams setInitialBounds
It has been replaced with setInitialRelativeBounds.
Bug: 265271880
Test: pass existing tests
Change-Id: Id14907129ded757833a7484b1cd6ec20df3c1af5
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index c0cd638..170e1c7 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -3716,7 +3716,7 @@
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 @@
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);
}
diff --git a/core/java/android/window/TaskFragmentCreationParams.java b/core/java/android/window/TaskFragmentCreationParams.java
index c19abf9..5dbf328 100644
--- a/core/java/android/window/TaskFragmentCreationParams.java
+++ b/core/java/android/window/TaskFragmentCreationParams.java
@@ -53,25 +53,12 @@
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.
*/
@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 @@
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 @@
mOrganizer = organizer;
mFragmentToken = fragmentToken;
mOwnerToken = ownerToken;
- mInitialBounds.set(initialBounds);
mInitialRelativeBounds.set(initialRelativeBounds);
- mAreInitialRelativeBoundsSet = areInitialRelativeBoundsSet;
mWindowingMode = windowingMode;
mPairedPrimaryFragmentToken = pairedPrimaryFragmentToken;
mPairedActivityToken = pairedActivityToken;
@@ -144,27 +128,10 @@
}
@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 @@
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 @@
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 @@
+ " organizer=" + mOrganizer
+ " fragmentToken=" + mFragmentToken
+ " ownerToken=" + mOwnerToken
- + " initialBounds=" + mInitialBounds
+ " initialRelativeBounds=" + mInitialRelativeBounds
+ " windowingMode=" + mWindowingMode
+ " pairedFragmentToken=" + mPairedPrimaryFragmentToken
@@ -261,13 +223,8 @@
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 @@
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 @@
@NonNull
public TaskFragmentCreationParams build() {
return new TaskFragmentCreationParams(mOrganizer, mFragmentToken, mOwnerToken,
- mInitialBounds, mInitialRelativeBounds, mAreInitialRelativeBoundsSet,
- mWindowingMode, mPairedPrimaryFragmentToken, mPairedActivityToken);
+ mInitialRelativeBounds, mWindowingMode, mPairedPrimaryFragmentToken,
+ mPairedActivityToken);
}
}
}
diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java
index f9592cc..1cd8e5c 100644
--- a/services/core/java/com/android/server/wm/WindowOrganizerController.java
+++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java
@@ -1900,16 +1900,13 @@
}
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);