diff options
4 files changed, 60 insertions, 66 deletions
diff --git a/core/java/android/window/RemoteTransition.java b/core/java/android/window/RemoteTransition.java index 4cc7ec598dbf..15b3c4490f94 100644 --- a/core/java/android/window/RemoteTransition.java +++ b/core/java/android/window/RemoteTransition.java @@ -22,15 +22,12 @@ import android.app.IApplicationThread; import android.os.IBinder; import android.os.Parcelable; -import com.android.internal.util.DataClass; - /** * Represents a remote transition animation and information required to run it (eg. the app thread * that needs to be boosted). * @hide */ -@DataClass(genToString = true, genSetters = true, genAidl = true) -public class RemoteTransition implements Parcelable { +public final class RemoteTransition implements Parcelable { /** The actual remote-transition interface used to run the transition animation. */ private @NonNull IRemoteTransition mRemoteTransition; @@ -41,12 +38,18 @@ public class RemoteTransition implements Parcelable { /** A name for this that can be used for debugging. */ private @Nullable String mDebugName; - /** Constructs with no app thread (animation runs in shell). */ + /** + * Constructs with no app thread (animation runs in shell). + * @hide + */ public RemoteTransition(@NonNull IRemoteTransition remoteTransition) { this(remoteTransition, null /* appThread */, null /* debugName */); } - /** Constructs with no app thread (animation runs in shell). */ + /** + * Constructs with no app thread (animation runs in shell). + * @hide + */ public RemoteTransition(@NonNull IRemoteTransition remoteTransition, @Nullable String debugName) { this(remoteTransition, null /* appThread */, debugName); @@ -57,21 +60,6 @@ public class RemoteTransition implements Parcelable { return mRemoteTransition.asBinder(); } - - - // Code below generated by codegen v1.0.23. - // - // DO NOT MODIFY! - // CHECKSTYLE:OFF Generated code - // - // To regenerate run: - // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/window/RemoteTransition.java - // - // To exclude the generated code from IntelliJ auto-formatting enable (one-time): - // Settings > Editor > Code Style > Formatter Control - //@formatter:off - - /** * Creates a new RemoteTransition. * @@ -81,8 +69,8 @@ public class RemoteTransition implements Parcelable { * The application thread that will be running the remote transition. * @param debugName * A name for this that can be used for debugging. + * @hide */ - @DataClass.Generated.Member public RemoteTransition( @NonNull IRemoteTransition remoteTransition, @Nullable IApplicationThread appThread, @@ -98,16 +86,16 @@ public class RemoteTransition implements Parcelable { /** * The actual remote-transition interface used to run the transition animation. + * @hide */ - @DataClass.Generated.Member public @NonNull IRemoteTransition getRemoteTransition() { return mRemoteTransition; } /** * The application thread that will be running the remote transition. + * @hide */ - @DataClass.Generated.Member public @Nullable IApplicationThread getAppThread() { return mAppThread; } @@ -115,15 +103,14 @@ public class RemoteTransition implements Parcelable { /** * A name for this that can be used for debugging. */ - @DataClass.Generated.Member public @Nullable String getDebugName() { return mDebugName; } /** * The actual remote-transition interface used to run the transition animation. + * @hide */ - @DataClass.Generated.Member public @NonNull RemoteTransition setRemoteTransition(@NonNull IRemoteTransition value) { mRemoteTransition = value; com.android.internal.util.AnnotationValidations.validate( @@ -133,8 +120,8 @@ public class RemoteTransition implements Parcelable { /** * The application thread that will be running the remote transition. + * @hide */ - @DataClass.Generated.Member public @NonNull RemoteTransition setAppThread(@NonNull IApplicationThread value) { mAppThread = value; return this; @@ -143,14 +130,12 @@ public class RemoteTransition implements Parcelable { /** * A name for this that can be used for debugging. */ - @DataClass.Generated.Member public @NonNull RemoteTransition setDebugName(@NonNull String value) { mDebugName = value; return this; } @Override - @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } @@ -163,7 +148,6 @@ public class RemoteTransition implements Parcelable { } @Override - @DataClass.Generated.Member public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } @@ -178,12 +162,10 @@ public class RemoteTransition implements Parcelable { } @Override - @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) - @DataClass.Generated.Member protected RemoteTransition(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } @@ -198,11 +180,8 @@ public class RemoteTransition implements Parcelable { NonNull.class, null, mRemoteTransition); this.mAppThread = appThread; this.mDebugName = debugName; - - // onConstructed(); // You can define this method to get a callback } - @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<RemoteTransition> CREATOR = new Parcelable.Creator<RemoteTransition>() { @Override @@ -215,17 +194,4 @@ public class RemoteTransition implements Parcelable { return new RemoteTransition(in); } }; - - @DataClass.Generated( - time = 1678926409863L, - codegenVersion = "1.0.23", - sourceFile = "frameworks/base/core/java/android/window/RemoteTransition.java", - inputSignatures = "private @android.annotation.NonNull android.window.IRemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.app.IApplicationThread mAppThread\nprivate @android.annotation.Nullable java.lang.String mDebugName\npublic @android.annotation.Nullable android.os.IBinder asBinder()\nclass RemoteTransition extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)") - @Deprecated - private void __metadata() {} - - - //@formatter:on - // End of generated code - } diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index bcae571201a8..4ffd88093531 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -54,6 +54,8 @@ import android.view.Surface; import android.view.SurfaceControl; import android.view.WindowManager; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -69,6 +71,7 @@ public final class TransitionInfo implements Parcelable { * Modes are only a sub-set of all the transit-types since they are per-container * @hide */ + @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = { "TRANSIT_" }, value = { TRANSIT_NONE, TRANSIT_OPEN, @@ -102,11 +105,11 @@ public final class TransitionInfo implements Parcelable { /** The container is the display. */ public static final int FLAG_IS_DISPLAY = 1 << 5; + // TODO(b/194540864): Once we can include all windows in transition, then replace this with + // something like FLAG_IS_SYSTEM_ALERT instead. Then we can do mixed rotations. /** * Only for IS_DISPLAY containers. Is set if the display has system alert windows. This is * used to prevent seamless rotation. - * TODO(b/194540864): Once we can include all windows in transition, then replace this with - * something like FLAG_IS_SYSTEM_ALERT instead. Then we can do mixed rotations. */ public static final int FLAG_DISPLAY_HAS_ALERT_WINDOWS = 1 << 7; @@ -173,6 +176,7 @@ public final class TransitionInfo implements Parcelable { public static final int FLAGS_IS_OCCLUDED_NO_ANIMATION = FLAG_IS_OCCLUDED | FLAG_NO_ANIMATION; /** @hide */ + @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = { "FLAG_" }, value = { FLAG_NONE, FLAG_SHOW_WALLPAPER, @@ -267,11 +271,11 @@ public final class TransitionInfo implements Parcelable { } /** @see #getRoot */ - public void addRoot(Root other) { + public void addRoot(@NonNull Root other) { mRoots.add(other); } - public void setAnimationOptions(AnimationOptions options) { + public void setAnimationOptions(@Nullable AnimationOptions options) { mOptions = options; } @@ -336,6 +340,7 @@ public final class TransitionInfo implements Parcelable { return mRoots.get(0).mLeash; } + @Nullable public AnimationOptions getAnimationOptions() { return mOptions; } @@ -601,7 +606,7 @@ public final class TransitionInfo implements Parcelable { * Updates the callsites of all the surfaces in this transition, which aids in the debugging of * lingering surfaces. */ - public void setUnreleasedWarningCallSiteForAllSurfaces(String callsite) { + public void setUnreleasedWarningCallSiteForAllSurfaces(@Nullable String callsite) { for (int i = mChanges.size() - 1; i >= 0; --i) { mChanges.get(i).getLeash().setUnreleasedWarningCallSite(callsite); } @@ -613,6 +618,7 @@ public final class TransitionInfo implements Parcelable { * the caller's references. Use this only if you need to "send" this to a local function which * assumes it is being called from a remote caller. */ + @NonNull public TransitionInfo localRemoteCopy() { final TransitionInfo out = new TransitionInfo(mType, mFlags); out.mTrack = mTrack; @@ -891,7 +897,7 @@ public final class TransitionInfo implements Parcelable { return mTaskInfo; } - public boolean getAllowEnterPip() { + public boolean isAllowEnterPip() { return mAllowEnterPip; } @@ -1042,6 +1048,7 @@ public final class TransitionInfo implements Parcelable { } /** Represents animation options during a transition */ + @SuppressWarnings("UserHandleName") public static final class AnimationOptions implements Parcelable { private int mType; @@ -1061,7 +1068,7 @@ public final class TransitionInfo implements Parcelable { mType = type; } - public AnimationOptions(Parcel in) { + private AnimationOptions(Parcel in) { mType = in.readInt(); mEnterResId = in.readInt(); mExitResId = in.readInt(); @@ -1076,14 +1083,17 @@ public final class TransitionInfo implements Parcelable { } /** Make basic customized animation for a package */ - public static AnimationOptions makeCommonAnimOptions(String packageName) { + @NonNull + public static AnimationOptions makeCommonAnimOptions(@NonNull String packageName) { AnimationOptions options = new AnimationOptions(ANIM_FROM_STYLE); options.mPackageName = packageName; return options; } + /** Make custom animation from the content of LayoutParams */ + @NonNull public static AnimationOptions makeAnimOptionsFromLayoutParameters( - WindowManager.LayoutParams lp) { + @NonNull WindowManager.LayoutParams lp) { AnimationOptions options = new AnimationOptions(ANIM_FROM_STYLE); options.mPackageName = lp.packageName; options.mAnimations = lp.windowAnimations; @@ -1091,7 +1101,7 @@ public final class TransitionInfo implements Parcelable { } /** Add customized window animations */ - public void addOptionsFromLayoutParameters(WindowManager.LayoutParams lp) { + public void addOptionsFromLayoutParameters(@NonNull WindowManager.LayoutParams lp) { mAnimations = lp.windowAnimations; } @@ -1111,8 +1121,11 @@ public final class TransitionInfo implements Parcelable { customTransition.addCustomActivityTransition(enterResId, exitResId, backgroundColor); } - public static AnimationOptions makeCustomAnimOptions(String packageName, int enterResId, - int exitResId, @ColorInt int backgroundColor, boolean overrideTaskTransition) { + /** Make options for a custom animation based on anim resources */ + @NonNull + public static AnimationOptions makeCustomAnimOptions(@NonNull String packageName, + int enterResId, int exitResId, @ColorInt int backgroundColor, + boolean overrideTaskTransition) { AnimationOptions options = new AnimationOptions(ANIM_CUSTOM); options.mPackageName = packageName; options.mEnterResId = enterResId; @@ -1122,6 +1135,8 @@ public final class TransitionInfo implements Parcelable { return options; } + /** Make options for a clip-reveal animation. */ + @NonNull public static AnimationOptions makeClipRevealAnimOptions(int startX, int startY, int width, int height) { AnimationOptions options = new AnimationOptions(ANIM_CLIP_REVEAL); @@ -1129,6 +1144,8 @@ public final class TransitionInfo implements Parcelable { return options; } + /** Make options for a scale-up animation. */ + @NonNull public static AnimationOptions makeScaleUpAnimOptions(int startX, int startY, int width, int height) { AnimationOptions options = new AnimationOptions(ANIM_SCALE_UP); @@ -1136,7 +1153,9 @@ public final class TransitionInfo implements Parcelable { return options; } - public static AnimationOptions makeThumbnailAnimOptions(HardwareBuffer srcThumb, + /** Make options for a thumbnail-scaling animation. */ + @NonNull + public static AnimationOptions makeThumbnailAnimOptions(@NonNull HardwareBuffer srcThumb, int startX, int startY, boolean scaleUp) { AnimationOptions options = new AnimationOptions( scaleUp ? ANIM_THUMBNAIL_SCALE_UP : ANIM_THUMBNAIL_SCALE_DOWN); @@ -1145,11 +1164,15 @@ public final class TransitionInfo implements Parcelable { return options; } + /** Make options for an animation that spans activities of different profiles. */ + @NonNull public static AnimationOptions makeCrossProfileAnimOptions() { AnimationOptions options = new AnimationOptions(ANIM_OPEN_CROSS_PROFILE_APPS); return options; } + /** Make options designating this as a scene-transition animation. */ + @NonNull public static AnimationOptions makeSceneTransitionAnimOptions() { AnimationOptions options = new AnimationOptions(ANIM_SCENE_TRANSITION); return options; @@ -1175,14 +1198,17 @@ public final class TransitionInfo implements Parcelable { return mOverrideTaskTransition; } + @Nullable public String getPackageName() { return mPackageName; } + @NonNull public Rect getTransitionBounds() { return mTransitionBounds; } + @Nullable public HardwareBuffer getThumbnail() { return mThumbnail; } @@ -1192,12 +1218,13 @@ public final class TransitionInfo implements Parcelable { } /** Return customized activity transition if existed. */ + @Nullable public CustomActivityTransition getCustomActivityTransition(boolean open) { return open ? mCustomActivityOpenTransition : mCustomActivityCloseTransition; } @Override - public void writeToParcel(Parcel dest, int flags) { + public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mType); dest.writeInt(mEnterResId); dest.writeInt(mExitResId); @@ -1247,6 +1274,7 @@ public final class TransitionInfo implements Parcelable { } @Override + @NonNull public String toString() { final StringBuilder sb = new StringBuilder(32); sb.append("{t=").append(typeToString(mType)); @@ -1261,7 +1289,7 @@ public final class TransitionInfo implements Parcelable { } /** Customized activity transition. */ - public static class CustomActivityTransition implements Parcelable { + public static final class CustomActivityTransition implements Parcelable { private int mCustomEnterResId; private int mCustomExitResId; private int mCustomBackgroundColor; @@ -1302,7 +1330,7 @@ public final class TransitionInfo implements Parcelable { } @Override - public void writeToParcel(Parcel dest, int flags) { + public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mCustomEnterResId); dest.writeInt(mCustomExitResId); dest.writeInt(mCustomBackgroundColor); diff --git a/core/java/android/window/TransitionRequestInfo.java b/core/java/android/window/TransitionRequestInfo.java index bd54e14bc996..cc225767bd49 100644 --- a/core/java/android/window/TransitionRequestInfo.java +++ b/core/java/android/window/TransitionRequestInfo.java @@ -113,7 +113,7 @@ public final class TransitionRequestInfo implements Parcelable { /** Requested change to a display. */ @DataClass(genToString = true, genSetters = true, genBuilder = false, genConstructor = false) - public static class DisplayChange implements Parcelable { + public static final class DisplayChange implements Parcelable { private final int mDisplayId; @Nullable private Rect mStartAbsBounds = null; @Nullable private Rect mEndAbsBounds = null; diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/TransitionUtil.java b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/TransitionUtil.java index dcd4062cb819..8e4b2259b959 100644 --- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/TransitionUtil.java +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/TransitionUtil.java @@ -318,7 +318,7 @@ public class TransitionUtil { null, new Rect(change.getStartAbsBounds()), taskInfo, - change.getAllowEnterPip(), + change.isAllowEnterPip(), INVALID_WINDOW_TYPE ); target.setWillShowImeOnTarget( |