fixed styles
This commit is contained in:
@@ -26,62 +26,50 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.InsetsSource.Flags;
|
||||
import android.view.WindowInsets.Type.InsetsType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Insets provided by a window.
|
||||
*
|
||||
* The insets frame will by default as the window frame size. If the providers are set, the
|
||||
* <p>The insets frame will by default as the window frame size. If the providers are set, the
|
||||
* calculation result based on the source size will be used as the insets frame.
|
||||
*
|
||||
* The InsetsFrameProvider should be self-contained. Nothing describing the window itself, such as
|
||||
* contentInsets, visibleInsets, etc. won't affect the insets providing to other windows when this
|
||||
* is set.
|
||||
* <p>The InsetsFrameProvider should be self-contained. Nothing describing the window itself, such
|
||||
* as contentInsets, visibleInsets, etc. won't affect the insets providing to other windows when
|
||||
* this is set.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class InsetsFrameProvider implements Parcelable {
|
||||
|
||||
/**
|
||||
* Uses the display frame as the source.
|
||||
*/
|
||||
/** Uses the display frame as the source. */
|
||||
public static final int SOURCE_DISPLAY = 0;
|
||||
|
||||
/**
|
||||
* Uses the window bounds as the source.
|
||||
*/
|
||||
/** Uses the window bounds as the source. */
|
||||
public static final int SOURCE_CONTAINER_BOUNDS = 1;
|
||||
|
||||
/**
|
||||
* Uses the window frame as the source.
|
||||
*/
|
||||
/** Uses the window frame as the source. */
|
||||
public static final int SOURCE_FRAME = 2;
|
||||
|
||||
/**
|
||||
* Uses {@link #mArbitraryRectangle} as the source.
|
||||
*/
|
||||
/** Uses {@link #mArbitraryRectangle} as the source. */
|
||||
public static final int SOURCE_ARBITRARY_RECTANGLE = 3;
|
||||
|
||||
private final int mId;
|
||||
|
||||
/**
|
||||
* The selection of the starting rectangle to be converted into source frame.
|
||||
*/
|
||||
/** The selection of the starting rectangle to be converted into source frame. */
|
||||
private int mSource = SOURCE_FRAME;
|
||||
|
||||
/**
|
||||
* This is used as the source frame only if SOURCE_ARBITRARY_RECTANGLE is applied.
|
||||
*/
|
||||
/** This is used as the source frame only if SOURCE_ARBITRARY_RECTANGLE is applied. */
|
||||
private Rect mArbitraryRectangle;
|
||||
|
||||
/**
|
||||
* Modifies the starting rectangle selected by {@link #mSource}.
|
||||
*
|
||||
* For example, when the given source frame is (0, 0) - (100, 200), and the insetsSize is null,
|
||||
* the source frame will be directly used as the final insets frame. If the insetsSize is set to
|
||||
* (0, 0, 0, 50) instead, the insets frame will be a frame starting from the bottom side of the
|
||||
* source frame with height of 50, i.e., (0, 150) - (100, 200).
|
||||
* <p>For example, when the given source frame is (0, 0) - (100, 200), and the insetsSize is
|
||||
* null, the source frame will be directly used as the final insets frame. If the insetsSize is
|
||||
* set to (0, 0, 0, 50) instead, the insets frame will be a frame starting from the bottom side
|
||||
* of the source frame with height of 50, i.e., (0, 150) - (100, 200).
|
||||
*/
|
||||
private Insets mInsetsSize = null;
|
||||
|
||||
@@ -106,7 +94,8 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
* the layout of the window, but only change the insets frame. This can be applied to insets
|
||||
* calculated based on all three source frames.
|
||||
*
|
||||
* Be cautious, this will not be in effect for the window types whose insets size is overridden.
|
||||
* <p>Be cautious, this will not be in effect for the window types whose insets size is
|
||||
* overridden.
|
||||
*/
|
||||
private Insets mMinimalInsetsSizeInDisplayCutoutSafe = null;
|
||||
|
||||
@@ -120,28 +109,23 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
* Creates an InsetsFrameProvider which describes what frame an insets source should have.
|
||||
*
|
||||
* @param owner the owner of this provider. We might have multiple sources with the same type on
|
||||
* a display, this is used to identify them.
|
||||
* a display, this is used to identify them.
|
||||
* @param index the index of this provider. An owner might provide multiple sources with the
|
||||
* same type, this is used to identify them.
|
||||
* The value must be in a range of [0, 2047].
|
||||
* same type, this is used to identify them. The value must be in a range of [0, 2047].
|
||||
* @param type the {@link InsetsType}.
|
||||
* @see InsetsSource#createId(Object, int, int)
|
||||
*/
|
||||
public InsetsFrameProvider(Object owner, @IntRange(from = 0, to = 2047) int index,
|
||||
@InsetsType int type) {
|
||||
public InsetsFrameProvider(
|
||||
Object owner, @IntRange(from = 0, to = 2047) int index, @InsetsType int type) {
|
||||
mId = InsetsSource.createId(owner, index, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unique integer which identifies the insets source.
|
||||
*/
|
||||
/** Returns an unique integer which identifies the insets source. */
|
||||
public int getId() {
|
||||
return mId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index specified in {@link #InsetsFrameProvider(IBinder, int, int)}.
|
||||
*/
|
||||
/** Returns the index specified in {@link #InsetsFrameProvider(IBinder, int, int)}. */
|
||||
public int getIndex() {
|
||||
return InsetsSource.getIndex(mId);
|
||||
}
|
||||
@@ -212,17 +196,13 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
return mMinimalInsetsSizeInDisplayCutoutSafe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bounding rectangles within and relative to the source frame.
|
||||
*/
|
||||
/** Sets the bounding rectangles within and relative to the source frame. */
|
||||
public InsetsFrameProvider setBoundingRects(@Nullable Rect[] boundingRects) {
|
||||
mBoundingRects = boundingRects == null ? null : boundingRects.clone();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the arbitrary bounding rects, or null if none were set.
|
||||
*/
|
||||
/** Returns the arbitrary bounding rects, or null if none were set. */
|
||||
@Nullable
|
||||
public Rect[] getBoundingRects() {
|
||||
return mBoundingRects;
|
||||
@@ -311,20 +291,29 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
final InsetsFrameProvider other = (InsetsFrameProvider) o;
|
||||
return mId == other.mId && mSource == other.mSource && mFlags == other.mFlags
|
||||
return mId == other.mId
|
||||
&& mSource == other.mSource
|
||||
&& mFlags == other.mFlags
|
||||
&& Objects.equals(mInsetsSize, other.mInsetsSize)
|
||||
&& Arrays.equals(mInsetsSizeOverrides, other.mInsetsSizeOverrides)
|
||||
&& Objects.equals(mArbitraryRectangle, other.mArbitraryRectangle)
|
||||
&& Objects.equals(mMinimalInsetsSizeInDisplayCutoutSafe,
|
||||
other.mMinimalInsetsSizeInDisplayCutoutSafe)
|
||||
&& Objects.equals(
|
||||
mMinimalInsetsSizeInDisplayCutoutSafe,
|
||||
other.mMinimalInsetsSizeInDisplayCutoutSafe)
|
||||
&& Arrays.equals(mBoundingRects, other.mBoundingRects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mId, mSource, mFlags, mInsetsSize,
|
||||
Arrays.hashCode(mInsetsSizeOverrides), mArbitraryRectangle,
|
||||
mMinimalInsetsSizeInDisplayCutoutSafe, Arrays.hashCode(mBoundingRects));
|
||||
return Objects.hash(
|
||||
mId,
|
||||
mSource,
|
||||
mFlags,
|
||||
mInsetsSize,
|
||||
Arrays.hashCode(mInsetsSizeOverrides),
|
||||
mArbitraryRectangle,
|
||||
mMinimalInsetsSizeInDisplayCutoutSafe,
|
||||
Arrays.hashCode(mBoundingRects));
|
||||
}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<InsetsFrameProvider> CREATOR =
|
||||
@@ -344,8 +333,8 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
* Class to describe the insets size to be provided to window with specific window type. If not
|
||||
* used, same insets size will be sent as instructed in the insetsSize and source.
|
||||
*
|
||||
* If the insetsSize of given type is set to {@code null}, the insets source frame will be used
|
||||
* directly for that window type.
|
||||
* <p>If the insetsSize of given type is set to {@code null}, the insets source frame will be
|
||||
* used directly for that window type.
|
||||
*/
|
||||
public static class InsetsSizeOverride implements Parcelable {
|
||||
|
||||
@@ -361,6 +350,7 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
mWindowType = windowType;
|
||||
mInsetsSize = insetsSize;
|
||||
}
|
||||
|
||||
public int getWindowType() {
|
||||
return mWindowType;
|
||||
}
|
||||
@@ -369,17 +359,18 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
return mInsetsSize;
|
||||
}
|
||||
|
||||
public static final Creator<InsetsSizeOverride> CREATOR = new Creator<>() {
|
||||
@Override
|
||||
public InsetsSizeOverride createFromParcel(Parcel in) {
|
||||
return new InsetsSizeOverride(in);
|
||||
}
|
||||
public static final Creator<InsetsSizeOverride> CREATOR =
|
||||
new Creator<>() {
|
||||
@Override
|
||||
public InsetsSizeOverride createFromParcel(Parcel in) {
|
||||
return new InsetsSizeOverride(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsetsSizeOverride[] newArray(int size) {
|
||||
return new InsetsSizeOverride[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public InsetsSizeOverride[] newArray(int size) {
|
||||
return new InsetsSizeOverride[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -396,8 +387,10 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(32);
|
||||
sb.append("TypedInsetsSize: {");
|
||||
sb.append("windowType=").append(ViewDebug.intToString(
|
||||
WindowManager.LayoutParams.class, "type", mWindowType));
|
||||
sb.append("windowType=")
|
||||
.append(
|
||||
ViewDebug.intToString(
|
||||
WindowManager.LayoutParams.class, "type", mWindowType));
|
||||
sb.append(", insetsSize=").append(mInsetsSize);
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.os.Parcelable;
|
||||
/**
|
||||
* Represents a remote transition animation and information required to run it (eg. the app thread
|
||||
* that needs to be boosted).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class RemoteTransition implements Parcelable {
|
||||
@@ -40,6 +41,7 @@ public final class RemoteTransition implements Parcelable {
|
||||
|
||||
/**
|
||||
* Constructs with no app thread (animation runs in shell).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public RemoteTransition(@NonNull IRemoteTransition remoteTransition) {
|
||||
@@ -48,10 +50,11 @@ public final class RemoteTransition implements Parcelable {
|
||||
|
||||
/**
|
||||
* Constructs with no app thread (animation runs in shell).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public RemoteTransition(@NonNull IRemoteTransition remoteTransition,
|
||||
@Nullable String debugName) {
|
||||
public RemoteTransition(
|
||||
@NonNull IRemoteTransition remoteTransition, @Nullable String debugName) {
|
||||
this(remoteTransition, null /* appThread */, debugName);
|
||||
}
|
||||
|
||||
@@ -63,12 +66,10 @@ public final class RemoteTransition implements Parcelable {
|
||||
/**
|
||||
* Creates a new RemoteTransition.
|
||||
*
|
||||
* @param remoteTransition
|
||||
* The actual remote-transition interface used to run the transition animation.
|
||||
* @param appThread
|
||||
* The application thread that will be running the remote transition.
|
||||
* @param debugName
|
||||
* A name for this that can be used for debugging.
|
||||
* @param remoteTransition The actual remote-transition interface used to run the transition
|
||||
* animation.
|
||||
* @param appThread The application thread that will be running the remote transition.
|
||||
* @param debugName A name for this that can be used for debugging.
|
||||
* @hide
|
||||
*/
|
||||
public RemoteTransition(
|
||||
@@ -86,6 +87,7 @@ public final class RemoteTransition implements Parcelable {
|
||||
|
||||
/**
|
||||
* The actual remote-transition interface used to run the transition animation.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull IRemoteTransition getRemoteTransition() {
|
||||
@@ -94,21 +96,21 @@ public final class RemoteTransition implements Parcelable {
|
||||
|
||||
/**
|
||||
* The application thread that will be running the remote transition.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @Nullable IApplicationThread getAppThread() {
|
||||
return mAppThread;
|
||||
}
|
||||
|
||||
/**
|
||||
* A name for this that can be used for debugging.
|
||||
*/
|
||||
/** A name for this that can be used for debugging. */
|
||||
public @Nullable String getDebugName() {
|
||||
return mDebugName;
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual remote-transition interface used to run the transition animation.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull RemoteTransition setRemoteTransition(@NonNull IRemoteTransition value) {
|
||||
@@ -120,6 +122,7 @@ public final class RemoteTransition implements Parcelable {
|
||||
|
||||
/**
|
||||
* The application thread that will be running the remote transition.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull RemoteTransition setAppThread(@NonNull IApplicationThread value) {
|
||||
@@ -127,9 +130,7 @@ public final class RemoteTransition implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A name for this that can be used for debugging.
|
||||
*/
|
||||
/** A name for this that can be used for debugging. */
|
||||
public @NonNull RemoteTransition setDebugName(@NonNull String value) {
|
||||
mDebugName = value;
|
||||
return this;
|
||||
@@ -140,11 +141,16 @@ public final class RemoteTransition implements Parcelable {
|
||||
// You can override field toString logic by defining methods like:
|
||||
// String fieldNameToString() { ... }
|
||||
|
||||
return "RemoteTransition { " +
|
||||
"remoteTransition = " + mRemoteTransition + ", " +
|
||||
"appThread = " + mAppThread + ", " +
|
||||
"debugName = " + mDebugName +
|
||||
" }";
|
||||
return "RemoteTransition { "
|
||||
+ "remoteTransition = "
|
||||
+ mRemoteTransition
|
||||
+ ", "
|
||||
+ "appThread = "
|
||||
+ mAppThread
|
||||
+ ", "
|
||||
+ "debugName = "
|
||||
+ mDebugName
|
||||
+ " }";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,7 +168,9 @@ public final class RemoteTransition implements Parcelable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() { return 0; }
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@@ -171,8 +179,12 @@ public final class RemoteTransition implements Parcelable {
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
byte flg = in.readByte();
|
||||
IRemoteTransition remoteTransition = IRemoteTransition.Stub.asInterface(in.readStrongBinder());
|
||||
IApplicationThread appThread = (flg & 0x2) == 0 ? null : IApplicationThread.Stub.asInterface(in.readStrongBinder());
|
||||
IRemoteTransition remoteTransition =
|
||||
IRemoteTransition.Stub.asInterface(in.readStrongBinder());
|
||||
IApplicationThread appThread =
|
||||
(flg & 0x2) == 0
|
||||
? null
|
||||
: IApplicationThread.Stub.asInterface(in.readStrongBinder());
|
||||
String debugName = (flg & 0x4) == 0 ? null : in.readString();
|
||||
|
||||
this.mRemoteTransition = remoteTransition;
|
||||
@@ -182,16 +194,16 @@ public final class RemoteTransition implements Parcelable {
|
||||
this.mDebugName = debugName;
|
||||
}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<RemoteTransition> CREATOR
|
||||
= new Parcelable.Creator<RemoteTransition>() {
|
||||
@Override
|
||||
public RemoteTransition[] newArray(int size) {
|
||||
return new RemoteTransition[size];
|
||||
}
|
||||
public static final @NonNull Parcelable.Creator<RemoteTransition> CREATOR =
|
||||
new Parcelable.Creator<RemoteTransition>() {
|
||||
@Override
|
||||
public RemoteTransition[] newArray(int size) {
|
||||
return new RemoteTransition[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteTransition createFromParcel(@NonNull android.os.Parcel in) {
|
||||
return new RemoteTransition(in);
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public RemoteTransition createFromParcel(@NonNull android.os.Parcel in) {
|
||||
return new RemoteTransition(in);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,21 +27,25 @@ import android.view.SurfaceControl;
|
||||
*/
|
||||
public abstract class RemoteTransitionStub extends IRemoteTransition.Stub {
|
||||
@Override
|
||||
public void mergeAnimation(IBinder transition, TransitionInfo info,
|
||||
SurfaceControl.Transaction t, IBinder mergeTarget,
|
||||
IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {}
|
||||
|
||||
public void mergeAnimation(
|
||||
IBinder transition,
|
||||
TransitionInfo info,
|
||||
SurfaceControl.Transaction t,
|
||||
IBinder mergeTarget,
|
||||
IRemoteTransitionFinishedCallback finishCallback)
|
||||
throws RemoteException {}
|
||||
|
||||
@Override
|
||||
public void takeOverAnimation(IBinder transition, TransitionInfo info,
|
||||
SurfaceControl.Transaction startTransaction,
|
||||
IRemoteTransitionFinishedCallback finishCallback,
|
||||
WindowAnimationState[] states) throws RemoteException {
|
||||
public void takeOverAnimation(
|
||||
IBinder transition,
|
||||
TransitionInfo info,
|
||||
SurfaceControl.Transaction startTransaction,
|
||||
IRemoteTransitionFinishedCallback finishCallback,
|
||||
WindowAnimationState[] states)
|
||||
throws RemoteException {
|
||||
throw new RemoteException("Takeovers are not supported by this IRemoteTransition");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTransitionConsumed(IBinder transition, boolean aborted)
|
||||
throws RemoteException {}
|
||||
}
|
||||
public void onTransitionConsumed(IBinder transition, boolean aborted) throws RemoteException {}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,7 @@ import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* A parcelable filter that can be used for rerouting transitions to a remote. This is a local
|
||||
* representation so that the transition system doesn't need to make blocking queries over
|
||||
* binder.
|
||||
* representation so that the transition system doesn't need to make blocking queries over binder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@@ -41,14 +40,17 @@ public final class TransitionFilter implements Parcelable {
|
||||
|
||||
/** The associated requirement doesn't care about the z-order. */
|
||||
public static final int CONTAINER_ORDER_ANY = 0;
|
||||
|
||||
/** The associated requirement only matches the top-most (z-order) container. */
|
||||
public static final int CONTAINER_ORDER_TOP = 1;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "CONTAINER_ORDER_" }, value = {
|
||||
CONTAINER_ORDER_ANY,
|
||||
CONTAINER_ORDER_TOP,
|
||||
})
|
||||
@IntDef(
|
||||
prefix = {"CONTAINER_ORDER_"},
|
||||
value = {
|
||||
CONTAINER_ORDER_ANY,
|
||||
CONTAINER_ORDER_TOP,
|
||||
})
|
||||
public @interface ContainerOrder {}
|
||||
|
||||
/**
|
||||
@@ -63,13 +65,10 @@ public final class TransitionFilter implements Parcelable {
|
||||
/** All flags must NOT be set on a transition. */
|
||||
public @WindowManager.TransitionFlags int mNotFlags = 0;
|
||||
|
||||
/**
|
||||
* A list of required changes. To pass, a transition must meet all requirements.
|
||||
*/
|
||||
/** A list of required changes. To pass, a transition must meet all requirements. */
|
||||
@Nullable public Requirement[] mRequirements = null;
|
||||
|
||||
public TransitionFilter() {
|
||||
}
|
||||
public TransitionFilter() {}
|
||||
|
||||
private TransitionFilter(Parcel in) {
|
||||
mTypeSet = in.createIntArray();
|
||||
@@ -78,7 +77,9 @@ public final class TransitionFilter implements Parcelable {
|
||||
mRequirements = in.createTypedArray(Requirement.CREATOR);
|
||||
}
|
||||
|
||||
/** @return true if `info` meets all the requirements to pass this filter. */
|
||||
/**
|
||||
* @return true if `info` meets all the requirements to pass this filter.
|
||||
*/
|
||||
public boolean matches(@NonNull TransitionInfo info) {
|
||||
if (mTypeSet != null) {
|
||||
// non-null typeset, so make sure info is one of the types.
|
||||
@@ -183,8 +184,7 @@ public final class TransitionFilter implements Parcelable {
|
||||
public ComponentName mTopActivity;
|
||||
public IBinder mLaunchCookie;
|
||||
|
||||
public Requirement() {
|
||||
}
|
||||
public Requirement() {}
|
||||
|
||||
private Requirement(Parcel in) {
|
||||
mActivityType = in.readInt();
|
||||
@@ -242,8 +242,9 @@ public final class TransitionFilter implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matchesTopActivity(ActivityManager.RunningTaskInfo taskInfo,
|
||||
@Nullable ComponentName activityComponent) {
|
||||
private boolean matchesTopActivity(
|
||||
ActivityManager.RunningTaskInfo taskInfo,
|
||||
@Nullable ComponentName activityComponent) {
|
||||
if (mTopActivity == null) return true;
|
||||
if (activityComponent != null) {
|
||||
return mTopActivity.equals(activityComponent);
|
||||
@@ -334,9 +335,11 @@ public final class TransitionFilter implements Parcelable {
|
||||
|
||||
private static String containerOrderToString(int order) {
|
||||
switch (order) {
|
||||
case CONTAINER_ORDER_ANY: return "ANY";
|
||||
case CONTAINER_ORDER_TOP: return "TOP";
|
||||
case CONTAINER_ORDER_ANY:
|
||||
return "ANY";
|
||||
case CONTAINER_ORDER_TOP:
|
||||
return "TOP";
|
||||
}
|
||||
return "UNKNOWN(" + order + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,7 @@ import android.os.Parcelable;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.window.flags.Flags;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
@@ -65,6 +63,7 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Used to communicate information about what is changing during a transition to a TransitionPlayer.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class TransitionInfo implements Parcelable {
|
||||
@@ -72,18 +71,21 @@ 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,
|
||||
TRANSIT_CLOSE,
|
||||
// Note: to_front/to_back really mean show/hide respectively at the container level.
|
||||
TRANSIT_TO_FRONT,
|
||||
TRANSIT_TO_BACK,
|
||||
TRANSIT_CHANGE
|
||||
})
|
||||
@IntDef(
|
||||
prefix = {"TRANSIT_"},
|
||||
value = {
|
||||
TRANSIT_NONE,
|
||||
TRANSIT_OPEN,
|
||||
TRANSIT_CLOSE,
|
||||
// Note: to_front/to_back really mean show/hide respectively at the container level.
|
||||
TRANSIT_TO_FRONT,
|
||||
TRANSIT_TO_BACK,
|
||||
TRANSIT_CHANGE
|
||||
})
|
||||
public @interface TransitionMode {}
|
||||
|
||||
/** No flags */
|
||||
@@ -111,8 +113,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
// 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.
|
||||
* Only for IS_DISPLAY containers. Is set if the display has system alert windows. This is used
|
||||
* to prevent seamless rotation.
|
||||
*/
|
||||
public static final int FLAG_DISPLAY_HAS_ALERT_WINDOWS = 1 << 7;
|
||||
|
||||
@@ -135,9 +137,9 @@ public final class TransitionInfo implements Parcelable {
|
||||
public static final int FLAG_CROSS_PROFILE_WORK_THUMBNAIL = 1 << 13;
|
||||
|
||||
/**
|
||||
* Whether the window is covered by an app starting window. This is different from
|
||||
* {@link #FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT} which is only set on the Activity window
|
||||
* that contains the starting window.
|
||||
* Whether the window is covered by an app starting window. This is different from {@link
|
||||
* #FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT} which is only set on the Activity window that
|
||||
* contains the starting window.
|
||||
*/
|
||||
public static final int FLAG_IS_BEHIND_STARTING_WINDOW = 1 << 14;
|
||||
|
||||
@@ -180,32 +182,35 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(prefix = { "FLAG_" }, value = {
|
||||
FLAG_NONE,
|
||||
FLAG_SHOW_WALLPAPER,
|
||||
FLAG_IS_WALLPAPER,
|
||||
FLAG_TRANSLUCENT,
|
||||
FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT,
|
||||
FLAG_IS_VOICE_INTERACTION,
|
||||
FLAG_IS_DISPLAY,
|
||||
FLAG_DISPLAY_HAS_ALERT_WINDOWS,
|
||||
FLAG_IS_INPUT_METHOD,
|
||||
FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY,
|
||||
FLAG_FILLS_TASK,
|
||||
FLAG_WILL_IME_SHOWN,
|
||||
FLAG_CROSS_PROFILE_OWNER_THUMBNAIL,
|
||||
FLAG_CROSS_PROFILE_WORK_THUMBNAIL,
|
||||
FLAG_IS_BEHIND_STARTING_WINDOW,
|
||||
FLAG_IS_OCCLUDED,
|
||||
FLAG_IS_SYSTEM_WINDOW,
|
||||
FLAG_BACK_GESTURE_ANIMATED,
|
||||
FLAG_NO_ANIMATION,
|
||||
FLAG_TASK_LAUNCHING_BEHIND,
|
||||
FLAG_MOVED_TO_TOP,
|
||||
FLAG_SYNC,
|
||||
FLAG_CONFIG_AT_END,
|
||||
FLAG_FIRST_CUSTOM
|
||||
}, flag = true)
|
||||
@IntDef(
|
||||
prefix = {"FLAG_"},
|
||||
value = {
|
||||
FLAG_NONE,
|
||||
FLAG_SHOW_WALLPAPER,
|
||||
FLAG_IS_WALLPAPER,
|
||||
FLAG_TRANSLUCENT,
|
||||
FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT,
|
||||
FLAG_IS_VOICE_INTERACTION,
|
||||
FLAG_IS_DISPLAY,
|
||||
FLAG_DISPLAY_HAS_ALERT_WINDOWS,
|
||||
FLAG_IS_INPUT_METHOD,
|
||||
FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY,
|
||||
FLAG_FILLS_TASK,
|
||||
FLAG_WILL_IME_SHOWN,
|
||||
FLAG_CROSS_PROFILE_OWNER_THUMBNAIL,
|
||||
FLAG_CROSS_PROFILE_WORK_THUMBNAIL,
|
||||
FLAG_IS_BEHIND_STARTING_WINDOW,
|
||||
FLAG_IS_OCCLUDED,
|
||||
FLAG_IS_SYSTEM_WINDOW,
|
||||
FLAG_BACK_GESTURE_ANIMATED,
|
||||
FLAG_NO_ANIMATION,
|
||||
FLAG_TASK_LAUNCHING_BEHIND,
|
||||
FLAG_MOVED_TO_TOP,
|
||||
FLAG_SYNC,
|
||||
FLAG_CONFIG_AT_END,
|
||||
FLAG_FIRST_CUSTOM
|
||||
},
|
||||
flag = true)
|
||||
public @interface ChangeFlags {}
|
||||
|
||||
private final @TransitionType int mType;
|
||||
@@ -215,8 +220,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
private final ArrayList<Root> mRoots = new ArrayList<>();
|
||||
|
||||
// TODO(b/327332488): Clean-up usages after the flag is fully enabled.
|
||||
@Deprecated
|
||||
private AnimationOptions mOptions;
|
||||
@Deprecated private AnimationOptions mOptions;
|
||||
|
||||
/** This is only a BEST-EFFORT id used for log correlation. DO NOT USE for any real work! */
|
||||
private int mDebugId = -1;
|
||||
@@ -269,20 +273,24 @@ public final class TransitionInfo implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @see #getRoot */
|
||||
public void addRootLeash(int displayId, @NonNull SurfaceControl leash,
|
||||
int offsetLeft, int offsetTop) {
|
||||
/**
|
||||
* @see #getRoot
|
||||
*/
|
||||
public void addRootLeash(
|
||||
int displayId, @NonNull SurfaceControl leash, int offsetLeft, int offsetTop) {
|
||||
mRoots.add(new Root(displayId, leash, offsetLeft, offsetTop));
|
||||
}
|
||||
|
||||
/** @see #getRoot */
|
||||
/**
|
||||
* @see #getRoot
|
||||
*/
|
||||
public void addRoot(@NonNull Root other) {
|
||||
mRoots.add(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Set {@link AnimationOptions} to change. This method is only used if
|
||||
* {@link Flags#FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE} is disabled.
|
||||
* @deprecated Set {@link AnimationOptions} to change. This method is only used if {@link
|
||||
* Flags#FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE} is disabled.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAnimationOptions(@Nullable AnimationOptions options) {
|
||||
@@ -306,7 +314,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* @return The number of animation roots. Most transitions should have 1, but there may be more
|
||||
* in some cases (such as a transition spanning multiple displays).
|
||||
* in some cases (such as a transition spanning multiple displays).
|
||||
*/
|
||||
public int getRootCount() {
|
||||
return mRoots.size();
|
||||
@@ -334,10 +342,9 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* @return a surfacecontrol that can serve as a parent surfacecontrol for all the changing
|
||||
* participants to animate within. This will generally be placed at the highest-z-order
|
||||
* shared ancestor of all participants. While this is non-null, it's possible for the rootleash
|
||||
* to be invalid if the transition is a no-op.
|
||||
*
|
||||
* participants to animate within. This will generally be placed at the highest-z-order
|
||||
* shared ancestor of all participants. While this is non-null, it's possible for the
|
||||
* rootleash to be invalid if the transition is a no-op.
|
||||
* @deprecated Use {@link #getRoot} instead. This call assumes there is only one root.
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -347,15 +354,15 @@ public final class TransitionInfo implements Parcelable {
|
||||
throw new IllegalStateException("Trying to get a root leash from a no-op transition.");
|
||||
}
|
||||
if (mRoots.size() > 1) {
|
||||
android.util.Log.e(TAG, "Assuming one animation root when there are more.",
|
||||
new Throwable());
|
||||
android.util.Log.e(
|
||||
TAG, "Assuming one animation root when there are more.", new Throwable());
|
||||
}
|
||||
return mRoots.get(0).mLeash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Change#getAnimationOptions()} instead. This method is called only
|
||||
* if {@link Flags#FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE} is disabled.
|
||||
* @deprecated Use {@link Change#getAnimationOptions()} instead. This method is called only if
|
||||
* {@link Flags#FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE} is disabled.
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
@@ -364,8 +371,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of {@link Change}s in this transition. The list is sorted top-to-bottom
|
||||
* in Z (meaning index 0 is the top-most container).
|
||||
* @return the list of {@link Change}s in this transition. The list is sorted top-to-bottom in Z
|
||||
* (meaning index 0 is the top-most container).
|
||||
*/
|
||||
@NonNull
|
||||
public List<Change> getChanges() {
|
||||
@@ -373,8 +380,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Change that a window is undergoing or {@code null} if not directly
|
||||
* represented.
|
||||
* @return the Change that a window is undergoing or {@code null} if not directly represented.
|
||||
*/
|
||||
@Nullable
|
||||
public Change getChange(@NonNull WindowContainerToken token) {
|
||||
@@ -386,25 +392,22 @@ public final class TransitionInfo implements Parcelable {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a {@link Change} to this transition.
|
||||
*/
|
||||
/** Add a {@link Change} to this transition. */
|
||||
public void addChange(@NonNull Change change) {
|
||||
mChanges.add(change);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this transition contains any changes to the window hierarchy,
|
||||
* including keyguard visibility.
|
||||
* Whether this transition contains any changes to the window hierarchy, including keyguard
|
||||
* visibility.
|
||||
*/
|
||||
public boolean hasChangesOrSideEffects() {
|
||||
return !mChanges.isEmpty() || isKeyguardGoingAway()
|
||||
return !mChanges.isEmpty()
|
||||
|| isKeyguardGoingAway()
|
||||
|| (mFlags & TRANSIT_FLAG_KEYGUARD_APPEARING) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this transition includes keyguard going away.
|
||||
*/
|
||||
/** Whether this transition includes keyguard going away. */
|
||||
public boolean isKeyguardGoingAway() {
|
||||
return (mFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0;
|
||||
}
|
||||
@@ -420,8 +423,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an arbitrary "debug" id for this info. This id will not be used for any "real work",
|
||||
* it is just for debugging and logging.
|
||||
* Set an arbitrary "debug" id for this info. This id will not be used for any "real work", it
|
||||
* is just for debugging and logging.
|
||||
*/
|
||||
public void setDebugId(int id) {
|
||||
mDebugId = id;
|
||||
@@ -439,6 +442,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* Returns a string representation of this transition info.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public String toString(@NonNull String prefix) {
|
||||
@@ -447,8 +451,14 @@ public final class TransitionInfo implements Parcelable {
|
||||
final String changesLineStart = shouldPrettyPrint ? "\n" + prefix : "";
|
||||
final String perChangeLineStart = shouldPrettyPrint ? "\n" + innerPrefix : "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{id=").append(mDebugId).append(" t=").append(transitTypeToString(mType))
|
||||
.append(" f=0x").append(Integer.toHexString(mFlags)).append(" trk=").append(mTrack);
|
||||
sb.append("{id=")
|
||||
.append(mDebugId)
|
||||
.append(" t=")
|
||||
.append(transitTypeToString(mType))
|
||||
.append(" f=0x")
|
||||
.append(Integer.toHexString(mFlags))
|
||||
.append(" trk=")
|
||||
.append(mTrack);
|
||||
if (mOptions != null) {
|
||||
sb.append(" opt=").append(mOptions);
|
||||
}
|
||||
@@ -476,14 +486,21 @@ public final class TransitionInfo implements Parcelable {
|
||||
/** Converts a transition mode/action to its string representation. */
|
||||
@NonNull
|
||||
public static String modeToString(@TransitionMode int mode) {
|
||||
switch(mode) {
|
||||
case TRANSIT_NONE: return "NONE";
|
||||
case TRANSIT_OPEN: return "OPEN";
|
||||
case TRANSIT_CLOSE: return "CLOSE";
|
||||
case TRANSIT_TO_FRONT: return "TO_FRONT";
|
||||
case TRANSIT_TO_BACK: return "TO_BACK";
|
||||
case TRANSIT_CHANGE: return "CHANGE";
|
||||
default: return "<unknown:" + mode + ">";
|
||||
switch (mode) {
|
||||
case TRANSIT_NONE:
|
||||
return "NONE";
|
||||
case TRANSIT_OPEN:
|
||||
return "OPEN";
|
||||
case TRANSIT_CLOSE:
|
||||
return "CLOSE";
|
||||
case TRANSIT_TO_FRONT:
|
||||
return "TO_FRONT";
|
||||
case TRANSIT_TO_BACK:
|
||||
return "TO_BACK";
|
||||
case TRANSIT_CHANGE:
|
||||
return "CHANGE";
|
||||
default:
|
||||
return "<unknown:" + mode + ">";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,11 +573,11 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indication that `change` is independent of parents (ie. it has a different type of
|
||||
* transition vs. "going along for the ride")
|
||||
* Indication that `change` is independent of parents (ie. it has a different type of transition
|
||||
* vs. "going along for the ride")
|
||||
*/
|
||||
public static boolean isIndependent(@NonNull TransitionInfo.Change change,
|
||||
@NonNull TransitionInfo info) {
|
||||
public static boolean isIndependent(
|
||||
@NonNull TransitionInfo.Change change, @NonNull TransitionInfo info) {
|
||||
// If the change has no parent (it is root), then it is independent
|
||||
if (change.getParent() == null) return true;
|
||||
|
||||
@@ -669,11 +686,13 @@ public final class TransitionInfo implements Parcelable {
|
||||
private int mEndDisplayId = INVALID_DISPLAY;
|
||||
private @Surface.Rotation int mStartRotation = ROTATION_UNDEFINED;
|
||||
private @Surface.Rotation int mEndRotation = ROTATION_UNDEFINED;
|
||||
|
||||
/**
|
||||
* The end rotation of the top activity after fixed rotation is finished. If the top
|
||||
* activity is not in fixed rotation, it will be {@link ROTATION_UNDEFINED}.
|
||||
*/
|
||||
private @Surface.Rotation int mEndFixedRotation = ROTATION_UNDEFINED;
|
||||
|
||||
private int mRotationAnimation = ROTATION_ANIMATION_UNSPECIFIED;
|
||||
private @ColorInt int mBackgroundColor;
|
||||
private SurfaceControl mSnapshot = null;
|
||||
@@ -781,8 +800,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the taskinfo of this container if this is a task. WARNING: this takes the
|
||||
* reference, so don't modify it afterwards.
|
||||
* Sets the taskinfo of this container if this is a task. WARNING: this takes the reference,
|
||||
* so don't modify it afterwards.
|
||||
*/
|
||||
public void setTaskInfo(@Nullable ActivityManager.RunningTaskInfo taskInfo) {
|
||||
mTaskInfo = taskInfo;
|
||||
@@ -834,9 +853,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
mActivityComponent = component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets {@link AnimationOptions} to override animation.
|
||||
*/
|
||||
/** Sets {@link AnimationOptions} to override animation. */
|
||||
public void setAnimationOptions(@Nullable AnimationOptions options) {
|
||||
if (!Flags.moveAnimationOptionsToChange()) {
|
||||
return;
|
||||
@@ -844,7 +861,9 @@ public final class TransitionInfo implements Parcelable {
|
||||
mAnimationOptions = options;
|
||||
}
|
||||
|
||||
/** @return the container that is changing. May be null if non-remotable (eg. activity) */
|
||||
/**
|
||||
* @return the container that is changing. May be null if non-remotable (eg. activity)
|
||||
*/
|
||||
@Nullable
|
||||
public WindowContainerToken getContainer() {
|
||||
return mContainer;
|
||||
@@ -852,7 +871,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* @return the parent of the changing container. This is the parent within the participants,
|
||||
* not necessarily the actual parent.
|
||||
* not necessarily the actual parent.
|
||||
*/
|
||||
@Nullable
|
||||
public WindowContainerToken getParent() {
|
||||
@@ -860,22 +879,27 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent of the changing container before the transition if it is reparented
|
||||
* in the transition. The parent window may not be collected in the transition as a
|
||||
* participant, and it may have been detached from the display. {@code null} if the changing
|
||||
* container has not been reparented in the transition, or if the parent is not organizable.
|
||||
* @return the parent of the changing container before the transition if it is reparented in
|
||||
* the transition. The parent window may not be collected in the transition as a
|
||||
* participant, and it may have been detached from the display. {@code null} if the
|
||||
* changing container has not been reparented in the transition, or if the parent is not
|
||||
* organizable.
|
||||
*/
|
||||
@Nullable
|
||||
public WindowContainerToken getLastParent() {
|
||||
return mLastParent;
|
||||
}
|
||||
|
||||
/** @return which action this change represents. */
|
||||
/**
|
||||
* @return which action this change represents.
|
||||
*/
|
||||
public @TransitionMode int getMode() {
|
||||
return mMode;
|
||||
}
|
||||
|
||||
/** @return the flags for this change. */
|
||||
/**
|
||||
* @return the flags for this change.
|
||||
*/
|
||||
public @ChangeFlags int getFlags() {
|
||||
return mFlags;
|
||||
}
|
||||
@@ -892,7 +916,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* @return the bounds of the container before the change. It may be empty if the container
|
||||
* is coming into existence.
|
||||
* is coming into existence.
|
||||
*/
|
||||
@NonNull
|
||||
public Rect getStartAbsBounds() {
|
||||
@@ -900,8 +924,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bounds of the container after the change. It may be empty if the container
|
||||
* is disappearing.
|
||||
* @return the bounds of the container after the change. It may be empty if the container is
|
||||
* disappearing.
|
||||
*/
|
||||
@NonNull
|
||||
public Rect getEndAbsBounds() {
|
||||
@@ -916,13 +940,17 @@ public final class TransitionInfo implements Parcelable {
|
||||
return mEndRelOffset;
|
||||
}
|
||||
|
||||
/** @return the leash or surface to animate for this container */
|
||||
/**
|
||||
* @return the leash or surface to animate for this container
|
||||
*/
|
||||
@NonNull
|
||||
public SurfaceControl getLeash() {
|
||||
return mLeash;
|
||||
}
|
||||
|
||||
/** @return the task info or null if this isn't a task */
|
||||
/**
|
||||
* @return the task info or null if this isn't a task
|
||||
*/
|
||||
@Nullable
|
||||
public ActivityManager.RunningTaskInfo getTaskInfo() {
|
||||
return mTaskInfo;
|
||||
@@ -955,37 +983,45 @@ public final class TransitionInfo implements Parcelable {
|
||||
return mEndFixedRotation;
|
||||
}
|
||||
|
||||
/** @return the rotation animation. */
|
||||
/**
|
||||
* @return the rotation animation.
|
||||
*/
|
||||
public int getRotationAnimation() {
|
||||
return mRotationAnimation;
|
||||
}
|
||||
|
||||
/** @return get the background color of this change's container. */
|
||||
/**
|
||||
* @return get the background color of this change's container.
|
||||
*/
|
||||
@ColorInt
|
||||
public int getBackgroundColor() {
|
||||
return mBackgroundColor;
|
||||
}
|
||||
|
||||
/** @return a snapshot surface (if applicable). */
|
||||
/**
|
||||
* @return a snapshot surface (if applicable).
|
||||
*/
|
||||
@Nullable
|
||||
public SurfaceControl getSnapshot() {
|
||||
return mSnapshot;
|
||||
}
|
||||
|
||||
/** @return the luma calculated for the snapshot surface (if applicable). */
|
||||
/**
|
||||
* @return the luma calculated for the snapshot surface (if applicable).
|
||||
*/
|
||||
public float getSnapshotLuma() {
|
||||
return mSnapshotLuma;
|
||||
}
|
||||
|
||||
/** @return the component-name of this container (if it is an activity). */
|
||||
/**
|
||||
* @return the component-name of this container (if it is an activity).
|
||||
*/
|
||||
@Nullable
|
||||
public ComponentName getActivityComponent() {
|
||||
return mActivityComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link AnimationOptions}.
|
||||
*/
|
||||
/** Returns the {@link AnimationOptions}. */
|
||||
@Nullable
|
||||
public AnimationOptions getAnimationOptions() {
|
||||
return mAnimationOptions;
|
||||
@@ -1041,19 +1077,27 @@ public final class TransitionInfo implements Parcelable {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append('{'); sb.append(mContainer);
|
||||
sb.append(" m="); sb.append(modeToString(mMode));
|
||||
sb.append(" f="); sb.append(flagsToString(mFlags));
|
||||
sb.append('{');
|
||||
sb.append(mContainer);
|
||||
sb.append(" m=");
|
||||
sb.append(modeToString(mMode));
|
||||
sb.append(" f=");
|
||||
sb.append(flagsToString(mFlags));
|
||||
if (mParent != null) {
|
||||
sb.append(" p="); sb.append(mParent);
|
||||
sb.append(" p=");
|
||||
sb.append(mParent);
|
||||
}
|
||||
if (mLeash != null) {
|
||||
sb.append(" leash="); sb.append(mLeash);
|
||||
sb.append(" leash=");
|
||||
sb.append(mLeash);
|
||||
}
|
||||
sb.append(" sb="); sb.append(mStartAbsBounds);
|
||||
sb.append(" eb="); sb.append(mEndAbsBounds);
|
||||
sb.append(" sb=");
|
||||
sb.append(mStartAbsBounds);
|
||||
sb.append(" eb=");
|
||||
sb.append(mEndAbsBounds);
|
||||
if (mEndRelOffset.x != 0 || mEndRelOffset.y != 0) {
|
||||
sb.append(" eo="); sb.append(mEndRelOffset);
|
||||
sb.append(" eo=");
|
||||
sb.append(mEndRelOffset);
|
||||
}
|
||||
sb.append(" d=");
|
||||
if (mStartDisplayId != mEndDisplayId) {
|
||||
@@ -1061,21 +1105,27 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
sb.append(mEndDisplayId);
|
||||
if (mStartRotation != mEndRotation) {
|
||||
sb.append(" r="); sb.append(mStartRotation);
|
||||
sb.append("->"); sb.append(mEndRotation);
|
||||
sb.append(':'); sb.append(mRotationAnimation);
|
||||
sb.append(" r=");
|
||||
sb.append(mStartRotation);
|
||||
sb.append("->");
|
||||
sb.append(mEndRotation);
|
||||
sb.append(':');
|
||||
sb.append(mRotationAnimation);
|
||||
}
|
||||
if (mEndFixedRotation != ROTATION_UNDEFINED) {
|
||||
sb.append(" endFixedRotation="); sb.append(mEndFixedRotation);
|
||||
sb.append(" endFixedRotation=");
|
||||
sb.append(mEndFixedRotation);
|
||||
}
|
||||
if (mBackgroundColor != 0) {
|
||||
sb.append(" bc=").append(Integer.toHexString(mBackgroundColor));
|
||||
}
|
||||
if (mSnapshot != null) {
|
||||
sb.append(" snapshot="); sb.append(mSnapshot);
|
||||
sb.append(" snapshot=");
|
||||
sb.append(mSnapshot);
|
||||
}
|
||||
if (mLastParent != null) {
|
||||
sb.append(" lastParent="); sb.append(mLastParent);
|
||||
sb.append(" lastParent=");
|
||||
sb.append(mLastParent);
|
||||
}
|
||||
if (mActivityComponent != null) {
|
||||
sb.append(" component=");
|
||||
@@ -1163,10 +1213,10 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/** Add customized activity animation attributes */
|
||||
public void addCustomActivityTransition(boolean isOpen,
|
||||
int enterResId, int exitResId, int backgroundColor) {
|
||||
CustomActivityTransition customTransition = isOpen
|
||||
? mCustomActivityOpenTransition : mCustomActivityCloseTransition;
|
||||
public void addCustomActivityTransition(
|
||||
boolean isOpen, int enterResId, int exitResId, int backgroundColor) {
|
||||
CustomActivityTransition customTransition =
|
||||
isOpen ? mCustomActivityOpenTransition : mCustomActivityCloseTransition;
|
||||
if (customTransition == null) {
|
||||
customTransition = new CustomActivityTransition();
|
||||
if (isOpen) {
|
||||
@@ -1188,11 +1238,19 @@ public final class TransitionInfo implements Parcelable {
|
||||
* @param overrideTaskTransition whether to override the task transition
|
||||
*/
|
||||
@NonNull
|
||||
public static AnimationOptions makeCustomAnimOptions(@NonNull String packageName,
|
||||
@AnimRes int enterResId, @AnimRes int exitResId, @ColorInt int backgroundColor,
|
||||
boolean overrideTaskTransition) {
|
||||
return makeCustomAnimOptions(packageName, enterResId, DEFAULT_ANIMATION_RESOURCES_ID,
|
||||
exitResId, backgroundColor, overrideTaskTransition);
|
||||
public static AnimationOptions makeCustomAnimOptions(
|
||||
@NonNull String packageName,
|
||||
@AnimRes int enterResId,
|
||||
@AnimRes int exitResId,
|
||||
@ColorInt int backgroundColor,
|
||||
boolean overrideTaskTransition) {
|
||||
return makeCustomAnimOptions(
|
||||
packageName,
|
||||
enterResId,
|
||||
DEFAULT_ANIMATION_RESOURCES_ID,
|
||||
exitResId,
|
||||
backgroundColor,
|
||||
overrideTaskTransition);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1205,9 +1263,13 @@ public final class TransitionInfo implements Parcelable {
|
||||
* @param overrideTaskTransition indicates whether to override task transition.
|
||||
*/
|
||||
@NonNull
|
||||
public static AnimationOptions makeCustomAnimOptions(@NonNull String packageName,
|
||||
@AnimRes int enterResId, @AnimRes int changeResId, @AnimRes int exitResId,
|
||||
@ColorInt int backgroundColor, boolean overrideTaskTransition) {
|
||||
public static AnimationOptions makeCustomAnimOptions(
|
||||
@NonNull String packageName,
|
||||
@AnimRes int enterResId,
|
||||
@AnimRes int changeResId,
|
||||
@AnimRes int exitResId,
|
||||
@ColorInt int backgroundColor,
|
||||
boolean overrideTaskTransition) {
|
||||
AnimationOptions options = new AnimationOptions(ANIM_CUSTOM);
|
||||
options.mPackageName = packageName;
|
||||
options.mEnterResId = enterResId;
|
||||
@@ -1220,8 +1282,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/** Make options for a clip-reveal animation. */
|
||||
@NonNull
|
||||
public static AnimationOptions makeClipRevealAnimOptions(int startX, int startY, int width,
|
||||
int height) {
|
||||
public static AnimationOptions makeClipRevealAnimOptions(
|
||||
int startX, int startY, int width, int height) {
|
||||
AnimationOptions options = new AnimationOptions(ANIM_CLIP_REVEAL);
|
||||
options.mTransitionBounds.set(startX, startY, startX + width, startY + height);
|
||||
return options;
|
||||
@@ -1229,8 +1291,8 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/** Make options for a scale-up animation. */
|
||||
@NonNull
|
||||
public static AnimationOptions makeScaleUpAnimOptions(int startX, int startY, int width,
|
||||
int height) {
|
||||
public static AnimationOptions makeScaleUpAnimOptions(
|
||||
int startX, int startY, int width, int height) {
|
||||
AnimationOptions options = new AnimationOptions(ANIM_SCALE_UP);
|
||||
options.mTransitionBounds.set(startX, startY, startX + width, startY + height);
|
||||
return options;
|
||||
@@ -1238,10 +1300,11 @@ public final class TransitionInfo implements Parcelable {
|
||||
|
||||
/** 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);
|
||||
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);
|
||||
options.mTransitionBounds.set(startX, startY, startX, startY);
|
||||
options.mThumbnail = srcThumb;
|
||||
return options;
|
||||
@@ -1408,6 +1471,7 @@ public final class TransitionInfo implements Parcelable {
|
||||
public int getCustomBackgroundColor() {
|
||||
return mCustomBackgroundColor;
|
||||
}
|
||||
|
||||
CustomActivityTransition() {}
|
||||
|
||||
CustomActivityTransition(Parcel in) {
|
||||
@@ -1455,9 +1519,9 @@ public final class TransitionInfo implements Parcelable {
|
||||
/**
|
||||
* An animation root in a transition. There is one of these for each display that contains
|
||||
* participants. It will be placed, in z-order, right above the top-most participant and at the
|
||||
* same position in the hierarchy. As a result, if all participants are animating within a
|
||||
* part of the screen, the root-leash will only be in that part of the screen. In these cases,
|
||||
* it's relative position (from the screen) is stored in {@link Root#getOffset}.
|
||||
* same position in the hierarchy. As a result, if all participants are animating within a part
|
||||
* of the screen, the root-leash will only be in that part of the screen. In these cases, it's
|
||||
* relative position (from the screen) is stored in {@link Root#getOffset}.
|
||||
*/
|
||||
public static final class Root implements Parcelable {
|
||||
private final int mDisplayId;
|
||||
@@ -1479,22 +1543,28 @@ public final class TransitionInfo implements Parcelable {
|
||||
}
|
||||
|
||||
private Root localRemoteCopy() {
|
||||
return new Root(mDisplayId, new SurfaceControl(mLeash, "localRemote"),
|
||||
mOffset.x, mOffset.y);
|
||||
return new Root(
|
||||
mDisplayId, new SurfaceControl(mLeash, "localRemote"), mOffset.x, mOffset.y);
|
||||
}
|
||||
|
||||
/** @return the id of the display this root is on. */
|
||||
/**
|
||||
* @return the id of the display this root is on.
|
||||
*/
|
||||
public int getDisplayId() {
|
||||
return mDisplayId;
|
||||
}
|
||||
|
||||
/** @return the root's leash. Surfaces should be parented to this while animating. */
|
||||
/**
|
||||
* @return the root's leash. Surfaces should be parented to this while animating.
|
||||
*/
|
||||
@NonNull
|
||||
public SurfaceControl getLeash() {
|
||||
return mLeash;
|
||||
}
|
||||
|
||||
/** @return the offset (relative to its screen) of the root leash. */
|
||||
/**
|
||||
* @return the offset (relative to its screen) of the root leash.
|
||||
*/
|
||||
@NonNull
|
||||
public Point getOffset() {
|
||||
return mOffset;
|
||||
@@ -1533,4 +1603,4 @@ public final class TransitionInfo implements Parcelable {
|
||||
return mDisplayId + "@" + mOffset + ":" + mLeash;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user