diff options
| author | 2024-05-14 14:14:28 +0800 | |
|---|---|---|
| committer | 2024-05-16 17:22:48 +0800 | |
| commit | ff03ff29a84d0bd57bdf44339c629765aa83464c (patch) | |
| tree | 0afe93605db0f38aaa1b6c2db58c5819f2debe01 | |
| parent | 3fec6be0d735fd9119e27d3dd77d9775d4729084 (diff) | |
Migrate to use TaskFragmentParentInfo in CTS
Test: presubmit
Fixes: 241043377
Flag: TEST_ONLY
Change-Id: Ifce45e10bf039036403c2b95f6069b2ce4bcd6ff
| -rw-r--r-- | core/api/test-current.txt | 9 | ||||
| -rw-r--r-- | core/java/android/window/TaskFragmentParentInfo.java | 36 | ||||
| -rw-r--r-- | core/java/android/window/TaskFragmentTransaction.java | 23 |
3 files changed, 43 insertions, 25 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 624227dc26f3..14ae3f543436 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -4260,6 +4260,12 @@ package android.window { field @NonNull public static final android.os.Parcelable.Creator<android.window.TaskFragmentOrganizerToken> CREATOR; } + public final class TaskFragmentParentInfo implements android.os.Parcelable { + method public int describeContents(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.window.TaskFragmentParentInfo> CREATOR; + } + public final class TaskFragmentTransaction implements android.os.Parcelable { ctor public TaskFragmentTransaction(); method public void addChange(@Nullable android.window.TaskFragmentTransaction.Change); @@ -4284,8 +4290,8 @@ package android.window { method @Nullable public android.os.IBinder getActivityToken(); method @NonNull public android.os.Bundle getErrorBundle(); method @Nullable public android.os.IBinder getErrorCallbackToken(); - method @Nullable public android.content.res.Configuration getTaskConfiguration(); method @Nullable public android.window.TaskFragmentInfo getTaskFragmentInfo(); + method @Nullable public android.window.TaskFragmentParentInfo getTaskFragmentParentInfo(); method @Nullable public android.os.IBinder getTaskFragmentToken(); method public int getTaskId(); method public int getType(); @@ -4293,7 +4299,6 @@ package android.window { method @NonNull public android.window.TaskFragmentTransaction.Change setActivityToken(@NonNull android.os.IBinder); method @NonNull public android.window.TaskFragmentTransaction.Change setErrorBundle(@NonNull android.os.Bundle); method @NonNull public android.window.TaskFragmentTransaction.Change setErrorCallbackToken(@Nullable android.os.IBinder); - method @NonNull public android.window.TaskFragmentTransaction.Change setTaskConfiguration(@NonNull android.content.res.Configuration); method @NonNull public android.window.TaskFragmentTransaction.Change setTaskFragmentInfo(@NonNull android.window.TaskFragmentInfo); method @NonNull public android.window.TaskFragmentTransaction.Change setTaskFragmentToken(@NonNull android.os.IBinder); method @NonNull public android.window.TaskFragmentTransaction.Change setTaskId(int); diff --git a/core/java/android/window/TaskFragmentParentInfo.java b/core/java/android/window/TaskFragmentParentInfo.java index a77c23475c60..15554167c702 100644 --- a/core/java/android/window/TaskFragmentParentInfo.java +++ b/core/java/android/window/TaskFragmentParentInfo.java @@ -18,6 +18,8 @@ package android.window; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SuppressLint; +import android.annotation.TestApi; import android.app.WindowConfiguration; import android.content.res.Configuration; import android.os.Parcel; @@ -27,10 +29,13 @@ import android.view.SurfaceControl; import java.util.Objects; /** - * The information about the parent Task of a particular TaskFragment + * The information about the parent Task of a particular TaskFragment. + * * @hide */ -public class TaskFragmentParentInfo implements Parcelable { +@SuppressLint("UnflaggedApi") // @TestApi to replace legacy usages. +@TestApi +public final class TaskFragmentParentInfo implements Parcelable { @NonNull private final Configuration mConfiguration = new Configuration(); @@ -42,6 +47,7 @@ public class TaskFragmentParentInfo implements Parcelable { @Nullable private final SurfaceControl mDecorSurface; + /** @hide */ public TaskFragmentParentInfo(@NonNull Configuration configuration, int displayId, boolean visible, boolean hasDirectActivity, @Nullable SurfaceControl decorSurface) { mConfiguration.setTo(configuration); @@ -51,6 +57,7 @@ public class TaskFragmentParentInfo implements Parcelable { mDecorSurface = decorSurface; } + /** @hide */ public TaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { mConfiguration.setTo(info.getConfiguration()); mDisplayId = info.mDisplayId; @@ -59,7 +66,11 @@ public class TaskFragmentParentInfo implements Parcelable { mDecorSurface = info.mDecorSurface; } - /** The {@link Configuration} of the parent Task */ + /** + * The {@link Configuration} of the parent Task + * + * @hide + */ @NonNull public Configuration getConfiguration() { return mConfiguration; @@ -68,19 +79,27 @@ public class TaskFragmentParentInfo implements Parcelable { /** * The display ID of the parent Task. {@link android.view.Display#INVALID_DISPLAY} means the * Task is detached from previously associated display. + * + * @hide */ public int getDisplayId() { return mDisplayId; } - /** Whether the parent Task is visible or not */ + /** + * Whether the parent Task is visible or not + * + * @hide + */ public boolean isVisible() { return mVisible; } /** * Whether the parent Task has any direct child activity, which is not embedded in any - * TaskFragment, or not + * TaskFragment, or not. + * + * @hide */ public boolean hasDirectActivity() { return mHasDirectActivity; @@ -93,6 +112,8 @@ public class TaskFragmentParentInfo implements Parcelable { * {@link com.android.server.wm.WindowOrganizerController#configurationsAreEqualForOrganizer( * Configuration, Configuration)} to determine if this {@link TaskFragmentParentInfo} should * be dispatched to the client. + * + * @hide */ public boolean equalsForTaskFragmentOrganizer(@Nullable TaskFragmentParentInfo that) { if (that == null) { @@ -103,6 +124,7 @@ public class TaskFragmentParentInfo implements Parcelable { && mDecorSurface == that.mDecorSurface; } + /** @hide */ @Nullable public SurfaceControl getDecorSurface() { return mDecorSurface; @@ -156,6 +178,7 @@ public class TaskFragmentParentInfo implements Parcelable { return result; } + @SuppressLint("UnflaggedApi") // @TestApi to replace legacy usages. @Override public void writeToParcel(@NonNull Parcel dest, int flags) { mConfiguration.writeToParcel(dest, flags); @@ -173,6 +196,8 @@ public class TaskFragmentParentInfo implements Parcelable { mDecorSurface = in.readTypedObject(SurfaceControl.CREATOR); } + @SuppressLint("UnflaggedApi") // @TestApi to replace legacy usages. + @NonNull public static final Creator<TaskFragmentParentInfo> CREATOR = new Creator<TaskFragmentParentInfo>() { @Override @@ -186,6 +211,7 @@ public class TaskFragmentParentInfo implements Parcelable { } }; + @SuppressLint("UnflaggedApi") // @TestApi to replace legacy usages. @Override public int describeContents() { return 0; diff --git a/core/java/android/window/TaskFragmentTransaction.java b/core/java/android/window/TaskFragmentTransaction.java index 4dada108c4c6..32e3f5ad10ca 100644 --- a/core/java/android/window/TaskFragmentTransaction.java +++ b/core/java/android/window/TaskFragmentTransaction.java @@ -24,7 +24,6 @@ import android.annotation.Nullable; import android.annotation.SuppressLint; import android.annotation.TestApi; import android.content.Intent; -import android.content.res.Configuration; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; @@ -248,13 +247,6 @@ public final class TaskFragmentTransaction implements Parcelable { return this; } - // TODO(b/241043377): Keep this API to prevent @TestApi changes. Remove in the next release. - /** Configuration of the parent Task. */ - @NonNull - public Change setTaskConfiguration(@NonNull Configuration configuration) { - return this; - } - /** * If the {@link #TYPE_TASK_FRAGMENT_ERROR} is from a {@link WindowContainerTransaction} * from the {@link TaskFragmentOrganizer}, it may come with an error callback token to @@ -299,12 +291,11 @@ public final class TaskFragmentTransaction implements Parcelable { return this; } - // TODO(b/241043377): Hide this API to prevent @TestApi changes. Remove in the next release. /** * Sets info of the parent Task of the embedded TaskFragment. * @see TaskFragmentParentInfo * - * @hide pending unhide + * @hide */ @NonNull public Change setTaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { @@ -338,12 +329,6 @@ public final class TaskFragmentTransaction implements Parcelable { return mTaskId; } - // TODO(b/241043377): Keep this API to prevent @TestApi changes. Remove in the next release. - @Nullable - public Configuration getTaskConfiguration() { - return mTaskFragmentParentInfo.getConfiguration(); - } - @Nullable public IBinder getErrorCallbackToken() { return mErrorCallbackToken; @@ -365,8 +350,10 @@ public final class TaskFragmentTransaction implements Parcelable { return mActivityToken; } - // TODO(b/241043377): Hide this API to prevent @TestApi changes. Remove in the next release. - /** @hide pending unhide */ + /** + * Obtains the {@link TaskFragmentParentInfo} for this transaction. + */ + @SuppressLint("UnflaggedApi") // @TestApi to replace legacy usages. @Nullable public TaskFragmentParentInfo getTaskFragmentParentInfo() { return mTaskFragmentParentInfo; |