Merge "Cleanup TaskFragmentCreationParams setInitialBounds" into udc-dev
This commit is contained in:
@@ -3733,7 +3733,7 @@ package android.window {
|
|||||||
|
|
||||||
public final class TaskFragmentCreationParams implements android.os.Parcelable {
|
public final class TaskFragmentCreationParams implements android.os.Parcelable {
|
||||||
method @NonNull public android.os.IBinder getFragmentToken();
|
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.window.TaskFragmentOrganizerToken getOrganizer();
|
||||||
method @NonNull public android.os.IBinder getOwnerToken();
|
method @NonNull public android.os.IBinder getOwnerToken();
|
||||||
method public int getWindowingMode();
|
method public int getWindowingMode();
|
||||||
@@ -3743,7 +3743,7 @@ package android.window {
|
|||||||
public static final class TaskFragmentCreationParams.Builder {
|
public static final class TaskFragmentCreationParams.Builder {
|
||||||
ctor public TaskFragmentCreationParams.Builder(@NonNull android.window.TaskFragmentOrganizerToken, @NonNull android.os.IBinder, @NonNull android.os.IBinder);
|
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 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);
|
method @NonNull public android.window.TaskFragmentCreationParams.Builder setWindowingMode(int);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,13 +52,6 @@ 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.
|
|
||||||
* TODO(b/232476698): cleanup with update CTS.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
private final Rect mInitialBounds = new Rect();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initial relative bounds of the TaskFragment in parent coordinate.
|
* The initial relative bounds of the TaskFragment in parent coordinate.
|
||||||
* Fills parent if empty.
|
* Fills parent if empty.
|
||||||
@@ -66,12 +59,6 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
@NonNull
|
@NonNull
|
||||||
private final Rect mInitialRelativeBounds = new Rect();
|
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;
|
||||||
@@ -109,8 +96,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 initialRelativeBounds,
|
||||||
@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) {
|
||||||
@@ -120,9 +106,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
mOrganizer = organizer;
|
mOrganizer = organizer;
|
||||||
mFragmentToken = fragmentToken;
|
mFragmentToken = fragmentToken;
|
||||||
mOwnerToken = ownerToken;
|
mOwnerToken = ownerToken;
|
||||||
mInitialBounds.set(initialBounds);
|
|
||||||
mInitialRelativeBounds.set(initialRelativeBounds);
|
mInitialRelativeBounds.set(initialRelativeBounds);
|
||||||
mAreInitialRelativeBoundsSet = areInitialRelativeBoundsSet;
|
|
||||||
mWindowingMode = windowingMode;
|
mWindowingMode = windowingMode;
|
||||||
mPairedPrimaryFragmentToken = pairedPrimaryFragmentToken;
|
mPairedPrimaryFragmentToken = pairedPrimaryFragmentToken;
|
||||||
mPairedActivityToken = pairedActivityToken;
|
mPairedActivityToken = pairedActivityToken;
|
||||||
@@ -143,28 +127,11 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
return mOwnerToken;
|
return mOwnerToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public Rect getInitialBounds() {
|
|
||||||
return mInitialBounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO(b/232476698): remove the hide with adding CTS for this in next release.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public Rect getInitialRelativeBounds() {
|
public Rect getInitialRelativeBounds() {
|
||||||
return mInitialRelativeBounds;
|
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;
|
||||||
@@ -192,9 +159,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
mOrganizer = TaskFragmentOrganizerToken.CREATOR.createFromParcel(in);
|
mOrganizer = TaskFragmentOrganizerToken.CREATOR.createFromParcel(in);
|
||||||
mFragmentToken = in.readStrongBinder();
|
mFragmentToken = in.readStrongBinder();
|
||||||
mOwnerToken = in.readStrongBinder();
|
mOwnerToken = in.readStrongBinder();
|
||||||
mInitialBounds.readFromParcel(in);
|
|
||||||
mInitialRelativeBounds.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();
|
||||||
@@ -206,9 +171,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
mOrganizer.writeToParcel(dest, flags);
|
mOrganizer.writeToParcel(dest, flags);
|
||||||
dest.writeStrongBinder(mFragmentToken);
|
dest.writeStrongBinder(mFragmentToken);
|
||||||
dest.writeStrongBinder(mOwnerToken);
|
dest.writeStrongBinder(mOwnerToken);
|
||||||
mInitialBounds.writeToParcel(dest, flags);
|
|
||||||
mInitialRelativeBounds.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);
|
||||||
@@ -234,7 +197,6 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
+ " organizer=" + mOrganizer
|
+ " organizer=" + mOrganizer
|
||||||
+ " fragmentToken=" + mFragmentToken
|
+ " fragmentToken=" + mFragmentToken
|
||||||
+ " ownerToken=" + mOwnerToken
|
+ " ownerToken=" + mOwnerToken
|
||||||
+ " initialBounds=" + mInitialBounds
|
|
||||||
+ " initialRelativeBounds=" + mInitialRelativeBounds
|
+ " initialRelativeBounds=" + mInitialRelativeBounds
|
||||||
+ " windowingMode=" + mWindowingMode
|
+ " windowingMode=" + mWindowingMode
|
||||||
+ " pairedFragmentToken=" + mPairedPrimaryFragmentToken
|
+ " pairedFragmentToken=" + mPairedPrimaryFragmentToken
|
||||||
@@ -260,14 +222,9 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
@NonNull
|
@NonNull
|
||||||
private final IBinder mOwnerToken;
|
private final IBinder mOwnerToken;
|
||||||
|
|
||||||
@NonNull
|
|
||||||
private final Rect mInitialBounds = new Rect();
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final Rect mInitialRelativeBounds = new Rect();
|
private final Rect mInitialRelativeBounds = new Rect();
|
||||||
|
|
||||||
private boolean mAreInitialRelativeBoundsSet;
|
|
||||||
|
|
||||||
@WindowingMode
|
@WindowingMode
|
||||||
private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
|
private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
|
||||||
|
|
||||||
@@ -284,23 +241,13 @@ public final class TaskFragmentCreationParams implements Parcelable {
|
|||||||
mOwnerToken = ownerToken;
|
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.
|
* Sets the initial relative bounds for the TaskFragment in parent coordinate.
|
||||||
* Set to empty to fill parent.
|
* Set to empty to fill parent.
|
||||||
* TODO(b/232476698): remove the hide with adding CTS for this in next release.
|
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder setInitialRelativeBounds(@NonNull Rect bounds) {
|
public Builder setInitialRelativeBounds(@NonNull Rect bounds) {
|
||||||
mInitialRelativeBounds.set(bounds);
|
mInitialRelativeBounds.set(bounds);
|
||||||
mAreInitialRelativeBoundsSet = true;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,8 +302,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, mInitialRelativeBounds, mAreInitialRelativeBoundsSet,
|
mInitialRelativeBounds, mWindowingMode, mPairedPrimaryFragmentToken,
|
||||||
mWindowingMode, mPairedPrimaryFragmentToken, mPairedActivityToken);
|
mPairedActivityToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1900,16 +1900,13 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
}
|
}
|
||||||
ownerTask.addChild(taskFragment, position);
|
ownerTask.addChild(taskFragment, position);
|
||||||
taskFragment.setWindowingMode(creationParams.getWindowingMode());
|
taskFragment.setWindowingMode(creationParams.getWindowingMode());
|
||||||
if (creationParams.areInitialRelativeBoundsSet()) {
|
if (!creationParams.getInitialRelativeBounds().isEmpty()) {
|
||||||
// Set relative bounds instead of using setBounds. This will avoid unnecessary update in
|
// 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.
|
// case the parent has resized since the last time parent info is sent to the organizer.
|
||||||
taskFragment.setRelativeEmbeddedBounds(creationParams.getInitialRelativeBounds());
|
taskFragment.setRelativeEmbeddedBounds(creationParams.getInitialRelativeBounds());
|
||||||
// Recompute configuration as the bounds will be calculated based on relative bounds in
|
// Recompute configuration as the bounds will be calculated based on relative bounds in
|
||||||
// TaskFragment#resolveOverrideConfiguration.
|
// TaskFragment#resolveOverrideConfiguration.
|
||||||
taskFragment.recomputeConfiguration();
|
taskFragment.recomputeConfiguration();
|
||||||
} else {
|
|
||||||
// TODO(b/232476698): remove after remove creationParams.getInitialBounds().
|
|
||||||
taskFragment.setBounds(creationParams.getInitialBounds());
|
|
||||||
}
|
}
|
||||||
mLaunchTaskFragments.put(creationParams.getFragmentToken(), taskFragment);
|
mLaunchTaskFragments.put(creationParams.getFragmentToken(), taskFragment);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user