Clean-up Lint errors
These are a bunch of random things the linter complains about.
Cleaning them up at once so that they don't polute other changes.
Bug: 341009477
Test: N/A
Change-Id: Iaab785b9b278af026417206066b9883469d30984
diff --git a/core/java/android/window/RemoteTransition.java b/core/java/android/window/RemoteTransition.java
index 4cc7ec5..15b3c44 100644
--- a/core/java/android/window/RemoteTransition.java
+++ b/core/java/android/window/RemoteTransition.java
@@ -22,15 +22,12 @@
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 @@
/** 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 @@
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 @@
* 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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
}
@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 @@
}
@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 @@
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 @@
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 bcae571..4ffd880 100644
--- a/core/java/android/window/TransitionInfo.java
+++ b/core/java/android/window/TransitionInfo.java
@@ -54,6 +54,8 @@
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 @@
* 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 @@
/** 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 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 @@
}
/** @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 @@
return mRoots.get(0).mLeash;
}
+ @Nullable
public AnimationOptions getAnimationOptions() {
return mOptions;
}
@@ -601,7 +606,7 @@
* 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 @@
* 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 @@
return mTaskInfo;
}
- public boolean getAllowEnterPip() {
+ public boolean isAllowEnterPip() {
return mAllowEnterPip;
}
@@ -1042,6 +1048,7 @@
}
/** Represents animation options during a transition */
+ @SuppressWarnings("UserHandleName")
public static final class AnimationOptions implements Parcelable {
private int mType;
@@ -1061,7 +1068,7 @@
mType = type;
}
- public AnimationOptions(Parcel in) {
+ private AnimationOptions(Parcel in) {
mType = in.readInt();
mEnterResId = in.readInt();
mExitResId = in.readInt();
@@ -1076,14 +1083,17 @@
}
/** 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 @@
}
/** Add customized window animations */
- public void addOptionsFromLayoutParameters(WindowManager.LayoutParams lp) {
+ public void addOptionsFromLayoutParameters(@NonNull WindowManager.LayoutParams lp) {
mAnimations = lp.windowAnimations;
}
@@ -1111,8 +1121,11 @@
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 @@
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 @@
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 @@
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 @@
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 @@
return mOverrideTaskTransition;
}
+ @Nullable
public String getPackageName() {
return mPackageName;
}
+ @NonNull
public Rect getTransitionBounds() {
return mTransitionBounds;
}
+ @Nullable
public HardwareBuffer getThumbnail() {
return mThumbnail;
}
@@ -1192,12 +1218,13 @@
}
/** 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 @@
}
@Override
+ @NonNull
public String toString() {
final StringBuilder sb = new StringBuilder(32);
sb.append("{t=").append(typeToString(mType));
@@ -1261,7 +1289,7 @@
}
/** 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 @@
}
@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 bd54e14..cc22576 100644
--- a/core/java/android/window/TransitionRequestInfo.java
+++ b/core/java/android/window/TransitionRequestInfo.java
@@ -113,7 +113,7 @@
/** 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 dcd4062..8e4b225 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 @@
null,
new Rect(change.getStartAbsBounds()),
taskInfo,
- change.getAllowEnterPip(),
+ change.isAllowEnterPip(),
INVALID_WINDOW_TYPE
);
target.setWillShowImeOnTarget(