Loading core/java/android/window/TransitionRequestInfo.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -17,3 +17,4 @@ package android.window; package android.window; parcelable TransitionRequestInfo; parcelable TransitionRequestInfo; parcelable TransitionRequestInfo.DisplayChange; core/java/android/window/TransitionRequestInfo.java +226 −4 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.window; import android.annotation.Nullable; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManager; import android.app.WindowConfiguration; import android.graphics.Rect; import android.os.Parcelable; import android.os.Parcelable; import android.view.WindowManager; import android.view.WindowManager; Loading @@ -42,6 +44,194 @@ public final class TransitionRequestInfo implements Parcelable { /** If non-null, a remote-transition associated with the source of this transition. */ /** If non-null, a remote-transition associated with the source of this transition. */ private @Nullable RemoteTransition mRemoteTransition; private @Nullable RemoteTransition mRemoteTransition; /** * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ private @Nullable DisplayChange mDisplayChange; /** constructor override */ public TransitionRequestInfo( @WindowManager.TransitionType int type, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable RemoteTransition remoteTransition) { this(type, triggerTask, remoteTransition, null /* displayChange */); } /** Requested change to a display. */ @DataClass(genToString = true, genSetters = true, genBuilder = false, genConstructor = false) public static class DisplayChange implements Parcelable { private final int mDisplayId; @Nullable private Rect mStartAbsBounds = null; @Nullable private Rect mEndAbsBounds = null; private int mStartRotation = WindowConfiguration.ROTATION_UNDEFINED; private int mEndRotation = WindowConfiguration.ROTATION_UNDEFINED; /** Create empty display-change. */ public DisplayChange(int displayId) { mDisplayId = displayId; } /** Create a display-change representing a rotation. */ public DisplayChange(int displayId, int startRotation, int endRotation) { mDisplayId = displayId; mStartRotation = startRotation; mEndRotation = endRotation; } // 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/TransitionRequestInfo.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control //@formatter:off @DataClass.Generated.Member public int getDisplayId() { return mDisplayId; } @DataClass.Generated.Member public @Nullable Rect getStartAbsBounds() { return mStartAbsBounds; } @DataClass.Generated.Member public @Nullable Rect getEndAbsBounds() { return mEndAbsBounds; } @DataClass.Generated.Member public int getStartRotation() { return mStartRotation; } @DataClass.Generated.Member public int getEndRotation() { return mEndRotation; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setStartAbsBounds(@android.annotation.NonNull Rect value) { mStartAbsBounds = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setEndAbsBounds(@android.annotation.NonNull Rect value) { mEndAbsBounds = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setStartRotation( int value) { mStartRotation = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setEndRotation( int value) { mEndRotation = value; return this; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "DisplayChange { " + "displayId = " + mDisplayId + ", " + "startAbsBounds = " + mStartAbsBounds + ", " + "endAbsBounds = " + mEndAbsBounds + ", " + "startRotation = " + mStartRotation + ", " + "endRotation = " + mEndRotation + " }"; } @Override @DataClass.Generated.Member public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } byte flg = 0; if (mStartAbsBounds != null) flg |= 0x2; if (mEndAbsBounds != null) flg |= 0x4; dest.writeByte(flg); dest.writeInt(mDisplayId); if (mStartAbsBounds != null) dest.writeTypedObject(mStartAbsBounds, flags); if (mEndAbsBounds != null) dest.writeTypedObject(mEndAbsBounds, flags); dest.writeInt(mStartRotation); dest.writeInt(mEndRotation); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member protected DisplayChange(@android.annotation.NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } byte flg = in.readByte(); int displayId = in.readInt(); Rect startAbsBounds = (flg & 0x2) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR); Rect endAbsBounds = (flg & 0x4) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR); int startRotation = in.readInt(); int endRotation = in.readInt(); this.mDisplayId = displayId; this.mStartAbsBounds = startAbsBounds; this.mEndAbsBounds = endAbsBounds; this.mStartRotation = startRotation; this.mEndRotation = endRotation; // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public static final @android.annotation.NonNull Parcelable.Creator<DisplayChange> CREATOR = new Parcelable.Creator<DisplayChange>() { @Override public DisplayChange[] newArray(int size) { return new DisplayChange[size]; } @Override public DisplayChange createFromParcel(@android.annotation.NonNull android.os.Parcel in) { return new DisplayChange(in); } }; @DataClass.Generated( time = 1639445520915L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java", inputSignatures = "private final int mDisplayId\nprivate @android.annotation.Nullable android.graphics.Rect mStartAbsBounds\nprivate @android.annotation.Nullable android.graphics.Rect mEndAbsBounds\nprivate int mStartRotation\nprivate int mEndRotation\nclass DisplayChange extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genBuilder=false, genConstructor=false)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code } // Code below generated by codegen v1.0.23. // Code below generated by codegen v1.0.23. Loading @@ -67,17 +257,23 @@ public final class TransitionRequestInfo implements Parcelable { * finish) has caused this transition to occur. * finish) has caused this transition to occur. * @param remoteTransition * @param remoteTransition * If non-null, a remote-transition associated with the source of this transition. * If non-null, a remote-transition associated with the source of this transition. * @param displayChange * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ */ @DataClass.Generated.Member @DataClass.Generated.Member public TransitionRequestInfo( public TransitionRequestInfo( @WindowManager.TransitionType int type, @WindowManager.TransitionType int type, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable RemoteTransition remoteTransition) { @Nullable RemoteTransition remoteTransition, @Nullable DisplayChange displayChange) { this.mType = type; this.mType = type; com.android.internal.util.AnnotationValidations.validate( com.android.internal.util.AnnotationValidations.validate( WindowManager.TransitionType.class, null, mType); WindowManager.TransitionType.class, null, mType); this.mTriggerTask = triggerTask; this.mTriggerTask = triggerTask; this.mRemoteTransition = remoteTransition; this.mRemoteTransition = remoteTransition; this.mDisplayChange = displayChange; // onConstructed(); // You can define this method to get a callback // onConstructed(); // You can define this method to get a callback } } Loading Loading @@ -107,6 +303,16 @@ public final class TransitionRequestInfo implements Parcelable { return mRemoteTransition; return mRemoteTransition; } } /** * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ @DataClass.Generated.Member public @Nullable DisplayChange getDisplayChange() { return mDisplayChange; } /** /** * If non-null, If non-null, the task containing the activity whose lifecycle change (start or * If non-null, If non-null, the task containing the activity whose lifecycle change (start or * finish) has caused this transition to occur. * finish) has caused this transition to occur. Loading @@ -126,6 +332,17 @@ public final class TransitionRequestInfo implements Parcelable { return this; return this; } } /** * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ @DataClass.Generated.Member public @android.annotation.NonNull TransitionRequestInfo setDisplayChange(@android.annotation.NonNull DisplayChange value) { mDisplayChange = value; return this; } @Override @Override @DataClass.Generated.Member @DataClass.Generated.Member public String toString() { public String toString() { Loading @@ -135,7 +352,8 @@ public final class TransitionRequestInfo implements Parcelable { return "TransitionRequestInfo { " + return "TransitionRequestInfo { " + "type = " + mType + ", " + "type = " + mType + ", " + "triggerTask = " + mTriggerTask + ", " + "triggerTask = " + mTriggerTask + ", " + "remoteTransition = " + mRemoteTransition + "remoteTransition = " + mRemoteTransition + ", " + "displayChange = " + mDisplayChange + " }"; " }"; } } Loading @@ -148,10 +366,12 @@ public final class TransitionRequestInfo implements Parcelable { byte flg = 0; byte flg = 0; if (mTriggerTask != null) flg |= 0x2; if (mTriggerTask != null) flg |= 0x2; if (mRemoteTransition != null) flg |= 0x4; if (mRemoteTransition != null) flg |= 0x4; if (mDisplayChange != null) flg |= 0x8; dest.writeByte(flg); dest.writeByte(flg); dest.writeInt(mType); dest.writeInt(mType); if (mTriggerTask != null) dest.writeTypedObject(mTriggerTask, flags); if (mTriggerTask != null) dest.writeTypedObject(mTriggerTask, flags); if (mRemoteTransition != null) dest.writeTypedObject(mRemoteTransition, flags); if (mRemoteTransition != null) dest.writeTypedObject(mRemoteTransition, flags); if (mDisplayChange != null) dest.writeTypedObject(mDisplayChange, flags); } } @Override @Override Loading @@ -169,12 +389,14 @@ public final class TransitionRequestInfo implements Parcelable { int type = in.readInt(); int type = in.readInt(); ActivityManager.RunningTaskInfo triggerTask = (flg & 0x2) == 0 ? null : (ActivityManager.RunningTaskInfo) in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR); ActivityManager.RunningTaskInfo triggerTask = (flg & 0x2) == 0 ? null : (ActivityManager.RunningTaskInfo) in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR); RemoteTransition remoteTransition = (flg & 0x4) == 0 ? null : (RemoteTransition) in.readTypedObject(RemoteTransition.CREATOR); RemoteTransition remoteTransition = (flg & 0x4) == 0 ? null : (RemoteTransition) in.readTypedObject(RemoteTransition.CREATOR); DisplayChange displayChange = (flg & 0x8) == 0 ? null : (DisplayChange) in.readTypedObject(DisplayChange.CREATOR); this.mType = type; this.mType = type; com.android.internal.util.AnnotationValidations.validate( com.android.internal.util.AnnotationValidations.validate( WindowManager.TransitionType.class, null, mType); WindowManager.TransitionType.class, null, mType); this.mTriggerTask = triggerTask; this.mTriggerTask = triggerTask; this.mRemoteTransition = remoteTransition; this.mRemoteTransition = remoteTransition; this.mDisplayChange = displayChange; // onConstructed(); // You can define this method to get a callback // onConstructed(); // You can define this method to get a callback } } Loading @@ -194,10 +416,10 @@ public final class TransitionRequestInfo implements Parcelable { }; }; @DataClass.Generated( @DataClass.Generated( time = 1629321632222L, time = 1639445520938L, codegenVersion = "1.0.23", codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java", sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java", inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)") inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.window.TransitionRequestInfo.DisplayChange mDisplayChange\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)") @Deprecated @Deprecated private void __metadata() {} private void __metadata() {} Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayChangeController.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -27,7 +27,6 @@ import androidx.annotation.BinderThread; import com.android.wm.shell.common.annotations.ShellMainThread; import com.android.wm.shell.common.annotations.ShellMainThread; import java.util.ArrayList; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList; /** /** Loading Loading @@ -71,12 +70,18 @@ public class DisplayChangeController { mRotationListener.remove(listener); mRotationListener.remove(listener); } } /** Query all listeners for changes that should happen on rotation. */ public void dispatchOnRotateDisplay(WindowContainerTransaction outWct, int displayId, final int fromRotation, final int toRotation) { for (OnDisplayChangingListener c : mRotationListener) { c.onRotateDisplay(displayId, fromRotation, toRotation, outWct); } } private void onRotateDisplay(int displayId, final int fromRotation, final int toRotation, private void onRotateDisplay(int displayId, final int fromRotation, final int toRotation, IDisplayWindowRotationCallback callback) { IDisplayWindowRotationCallback callback) { WindowContainerTransaction t = new WindowContainerTransaction(); WindowContainerTransaction t = new WindowContainerTransaction(); for (OnDisplayChangingListener c : mRotationListener) { dispatchOnRotateDisplay(t, displayId, fromRotation, toRotation); c.onRotateDisplay(displayId, fromRotation, toRotation, t); } try { try { callback.continueRotateDisplay(toRotation, t); callback.continueRotateDisplay(toRotation, t); } catch (RemoteException e) { } catch (RemoteException e) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,11 @@ public class DisplayController { } } } } /** Get the DisplayChangeController. */ public DisplayChangeController getChangeController() { return mChangeController; } /** /** * Gets a display by id from DisplayManager. * Gets a display by id from DisplayManager. */ */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -95,6 +95,7 @@ public class Transitions implements RemoteCallable<Transitions> { private final ShellExecutor mAnimExecutor; private final ShellExecutor mAnimExecutor; private final TransitionPlayerImpl mPlayerImpl; private final TransitionPlayerImpl mPlayerImpl; private final RemoteTransitionHandler mRemoteTransitionHandler; private final RemoteTransitionHandler mRemoteTransitionHandler; private final DisplayController mDisplayController; private final ShellTransitionImpl mImpl = new ShellTransitionImpl(); private final ShellTransitionImpl mImpl = new ShellTransitionImpl(); /** List of possible handlers. Ordered by specificity (eg. tapped back to front). */ /** List of possible handlers. Ordered by specificity (eg. tapped back to front). */ Loading Loading @@ -122,6 +123,7 @@ public class Transitions implements RemoteCallable<Transitions> { mContext = context; mContext = context; mMainExecutor = mainExecutor; mMainExecutor = mainExecutor; mAnimExecutor = animExecutor; mAnimExecutor = animExecutor; mDisplayController = displayController; mPlayerImpl = new TransitionPlayerImpl(); mPlayerImpl = new TransitionPlayerImpl(); // The very last handler (0 in the list) should be the default one. // The very last handler (0 in the list) should be the default one. mHandlers.add(new DefaultTransitionHandler(displayController, pool, context, mainExecutor, mHandlers.add(new DefaultTransitionHandler(displayController, pool, context, mainExecutor, Loading @@ -147,6 +149,7 @@ public class Transitions implements RemoteCallable<Transitions> { mContext = null; mContext = null; mMainExecutor = null; mMainExecutor = null; mAnimExecutor = null; mAnimExecutor = null; mDisplayController = null; mPlayerImpl = null; mPlayerImpl = null; mRemoteTransitionHandler = null; mRemoteTransitionHandler = null; } } Loading Loading @@ -547,6 +550,17 @@ public class Transitions implements RemoteCallable<Transitions> { break; break; } } } } if (request.getDisplayChange() != null) { TransitionRequestInfo.DisplayChange change = request.getDisplayChange(); if (change.getEndRotation() != change.getStartRotation()) { // Is a rotation, so dispatch to all displayChange listeners if (wct == null) { wct = new WindowContainerTransaction(); } mDisplayController.getChangeController().dispatchOnRotateDisplay(wct, change.getDisplayId(), change.getStartRotation(), change.getEndRotation()); } } active.mToken = mOrganizer.startTransition( active.mToken = mOrganizer.startTransition( request.getType(), transitionToken, wct); request.getType(), transitionToken, wct); mActiveTransitions.add(active); mActiveTransitions.add(active); Loading Loading
core/java/android/window/TransitionRequestInfo.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -17,3 +17,4 @@ package android.window; package android.window; parcelable TransitionRequestInfo; parcelable TransitionRequestInfo; parcelable TransitionRequestInfo.DisplayChange;
core/java/android/window/TransitionRequestInfo.java +226 −4 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.window; import android.annotation.Nullable; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManager; import android.app.WindowConfiguration; import android.graphics.Rect; import android.os.Parcelable; import android.os.Parcelable; import android.view.WindowManager; import android.view.WindowManager; Loading @@ -42,6 +44,194 @@ public final class TransitionRequestInfo implements Parcelable { /** If non-null, a remote-transition associated with the source of this transition. */ /** If non-null, a remote-transition associated with the source of this transition. */ private @Nullable RemoteTransition mRemoteTransition; private @Nullable RemoteTransition mRemoteTransition; /** * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ private @Nullable DisplayChange mDisplayChange; /** constructor override */ public TransitionRequestInfo( @WindowManager.TransitionType int type, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable RemoteTransition remoteTransition) { this(type, triggerTask, remoteTransition, null /* displayChange */); } /** Requested change to a display. */ @DataClass(genToString = true, genSetters = true, genBuilder = false, genConstructor = false) public static class DisplayChange implements Parcelable { private final int mDisplayId; @Nullable private Rect mStartAbsBounds = null; @Nullable private Rect mEndAbsBounds = null; private int mStartRotation = WindowConfiguration.ROTATION_UNDEFINED; private int mEndRotation = WindowConfiguration.ROTATION_UNDEFINED; /** Create empty display-change. */ public DisplayChange(int displayId) { mDisplayId = displayId; } /** Create a display-change representing a rotation. */ public DisplayChange(int displayId, int startRotation, int endRotation) { mDisplayId = displayId; mStartRotation = startRotation; mEndRotation = endRotation; } // 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/TransitionRequestInfo.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control //@formatter:off @DataClass.Generated.Member public int getDisplayId() { return mDisplayId; } @DataClass.Generated.Member public @Nullable Rect getStartAbsBounds() { return mStartAbsBounds; } @DataClass.Generated.Member public @Nullable Rect getEndAbsBounds() { return mEndAbsBounds; } @DataClass.Generated.Member public int getStartRotation() { return mStartRotation; } @DataClass.Generated.Member public int getEndRotation() { return mEndRotation; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setStartAbsBounds(@android.annotation.NonNull Rect value) { mStartAbsBounds = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setEndAbsBounds(@android.annotation.NonNull Rect value) { mEndAbsBounds = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setStartRotation( int value) { mStartRotation = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull DisplayChange setEndRotation( int value) { mEndRotation = value; return this; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "DisplayChange { " + "displayId = " + mDisplayId + ", " + "startAbsBounds = " + mStartAbsBounds + ", " + "endAbsBounds = " + mEndAbsBounds + ", " + "startRotation = " + mStartRotation + ", " + "endRotation = " + mEndRotation + " }"; } @Override @DataClass.Generated.Member public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } byte flg = 0; if (mStartAbsBounds != null) flg |= 0x2; if (mEndAbsBounds != null) flg |= 0x4; dest.writeByte(flg); dest.writeInt(mDisplayId); if (mStartAbsBounds != null) dest.writeTypedObject(mStartAbsBounds, flags); if (mEndAbsBounds != null) dest.writeTypedObject(mEndAbsBounds, flags); dest.writeInt(mStartRotation); dest.writeInt(mEndRotation); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member protected DisplayChange(@android.annotation.NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } byte flg = in.readByte(); int displayId = in.readInt(); Rect startAbsBounds = (flg & 0x2) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR); Rect endAbsBounds = (flg & 0x4) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR); int startRotation = in.readInt(); int endRotation = in.readInt(); this.mDisplayId = displayId; this.mStartAbsBounds = startAbsBounds; this.mEndAbsBounds = endAbsBounds; this.mStartRotation = startRotation; this.mEndRotation = endRotation; // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public static final @android.annotation.NonNull Parcelable.Creator<DisplayChange> CREATOR = new Parcelable.Creator<DisplayChange>() { @Override public DisplayChange[] newArray(int size) { return new DisplayChange[size]; } @Override public DisplayChange createFromParcel(@android.annotation.NonNull android.os.Parcel in) { return new DisplayChange(in); } }; @DataClass.Generated( time = 1639445520915L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java", inputSignatures = "private final int mDisplayId\nprivate @android.annotation.Nullable android.graphics.Rect mStartAbsBounds\nprivate @android.annotation.Nullable android.graphics.Rect mEndAbsBounds\nprivate int mStartRotation\nprivate int mEndRotation\nclass DisplayChange extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genBuilder=false, genConstructor=false)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code } // Code below generated by codegen v1.0.23. // Code below generated by codegen v1.0.23. Loading @@ -67,17 +257,23 @@ public final class TransitionRequestInfo implements Parcelable { * finish) has caused this transition to occur. * finish) has caused this transition to occur. * @param remoteTransition * @param remoteTransition * If non-null, a remote-transition associated with the source of this transition. * If non-null, a remote-transition associated with the source of this transition. * @param displayChange * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ */ @DataClass.Generated.Member @DataClass.Generated.Member public TransitionRequestInfo( public TransitionRequestInfo( @WindowManager.TransitionType int type, @WindowManager.TransitionType int type, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable RemoteTransition remoteTransition) { @Nullable RemoteTransition remoteTransition, @Nullable DisplayChange displayChange) { this.mType = type; this.mType = type; com.android.internal.util.AnnotationValidations.validate( com.android.internal.util.AnnotationValidations.validate( WindowManager.TransitionType.class, null, mType); WindowManager.TransitionType.class, null, mType); this.mTriggerTask = triggerTask; this.mTriggerTask = triggerTask; this.mRemoteTransition = remoteTransition; this.mRemoteTransition = remoteTransition; this.mDisplayChange = displayChange; // onConstructed(); // You can define this method to get a callback // onConstructed(); // You can define this method to get a callback } } Loading Loading @@ -107,6 +303,16 @@ public final class TransitionRequestInfo implements Parcelable { return mRemoteTransition; return mRemoteTransition; } } /** * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ @DataClass.Generated.Member public @Nullable DisplayChange getDisplayChange() { return mDisplayChange; } /** /** * If non-null, If non-null, the task containing the activity whose lifecycle change (start or * If non-null, If non-null, the task containing the activity whose lifecycle change (start or * finish) has caused this transition to occur. * finish) has caused this transition to occur. Loading @@ -126,6 +332,17 @@ public final class TransitionRequestInfo implements Parcelable { return this; return this; } } /** * If non-null, this request was triggered by this display change. This will not be complete: * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds * (if size is changing). */ @DataClass.Generated.Member public @android.annotation.NonNull TransitionRequestInfo setDisplayChange(@android.annotation.NonNull DisplayChange value) { mDisplayChange = value; return this; } @Override @Override @DataClass.Generated.Member @DataClass.Generated.Member public String toString() { public String toString() { Loading @@ -135,7 +352,8 @@ public final class TransitionRequestInfo implements Parcelable { return "TransitionRequestInfo { " + return "TransitionRequestInfo { " + "type = " + mType + ", " + "type = " + mType + ", " + "triggerTask = " + mTriggerTask + ", " + "triggerTask = " + mTriggerTask + ", " + "remoteTransition = " + mRemoteTransition + "remoteTransition = " + mRemoteTransition + ", " + "displayChange = " + mDisplayChange + " }"; " }"; } } Loading @@ -148,10 +366,12 @@ public final class TransitionRequestInfo implements Parcelable { byte flg = 0; byte flg = 0; if (mTriggerTask != null) flg |= 0x2; if (mTriggerTask != null) flg |= 0x2; if (mRemoteTransition != null) flg |= 0x4; if (mRemoteTransition != null) flg |= 0x4; if (mDisplayChange != null) flg |= 0x8; dest.writeByte(flg); dest.writeByte(flg); dest.writeInt(mType); dest.writeInt(mType); if (mTriggerTask != null) dest.writeTypedObject(mTriggerTask, flags); if (mTriggerTask != null) dest.writeTypedObject(mTriggerTask, flags); if (mRemoteTransition != null) dest.writeTypedObject(mRemoteTransition, flags); if (mRemoteTransition != null) dest.writeTypedObject(mRemoteTransition, flags); if (mDisplayChange != null) dest.writeTypedObject(mDisplayChange, flags); } } @Override @Override Loading @@ -169,12 +389,14 @@ public final class TransitionRequestInfo implements Parcelable { int type = in.readInt(); int type = in.readInt(); ActivityManager.RunningTaskInfo triggerTask = (flg & 0x2) == 0 ? null : (ActivityManager.RunningTaskInfo) in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR); ActivityManager.RunningTaskInfo triggerTask = (flg & 0x2) == 0 ? null : (ActivityManager.RunningTaskInfo) in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR); RemoteTransition remoteTransition = (flg & 0x4) == 0 ? null : (RemoteTransition) in.readTypedObject(RemoteTransition.CREATOR); RemoteTransition remoteTransition = (flg & 0x4) == 0 ? null : (RemoteTransition) in.readTypedObject(RemoteTransition.CREATOR); DisplayChange displayChange = (flg & 0x8) == 0 ? null : (DisplayChange) in.readTypedObject(DisplayChange.CREATOR); this.mType = type; this.mType = type; com.android.internal.util.AnnotationValidations.validate( com.android.internal.util.AnnotationValidations.validate( WindowManager.TransitionType.class, null, mType); WindowManager.TransitionType.class, null, mType); this.mTriggerTask = triggerTask; this.mTriggerTask = triggerTask; this.mRemoteTransition = remoteTransition; this.mRemoteTransition = remoteTransition; this.mDisplayChange = displayChange; // onConstructed(); // You can define this method to get a callback // onConstructed(); // You can define this method to get a callback } } Loading @@ -194,10 +416,10 @@ public final class TransitionRequestInfo implements Parcelable { }; }; @DataClass.Generated( @DataClass.Generated( time = 1629321632222L, time = 1639445520938L, codegenVersion = "1.0.23", codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java", sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java", inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)") inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.window.TransitionRequestInfo.DisplayChange mDisplayChange\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)") @Deprecated @Deprecated private void __metadata() {} private void __metadata() {} Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayChangeController.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -27,7 +27,6 @@ import androidx.annotation.BinderThread; import com.android.wm.shell.common.annotations.ShellMainThread; import com.android.wm.shell.common.annotations.ShellMainThread; import java.util.ArrayList; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList; /** /** Loading Loading @@ -71,12 +70,18 @@ public class DisplayChangeController { mRotationListener.remove(listener); mRotationListener.remove(listener); } } /** Query all listeners for changes that should happen on rotation. */ public void dispatchOnRotateDisplay(WindowContainerTransaction outWct, int displayId, final int fromRotation, final int toRotation) { for (OnDisplayChangingListener c : mRotationListener) { c.onRotateDisplay(displayId, fromRotation, toRotation, outWct); } } private void onRotateDisplay(int displayId, final int fromRotation, final int toRotation, private void onRotateDisplay(int displayId, final int fromRotation, final int toRotation, IDisplayWindowRotationCallback callback) { IDisplayWindowRotationCallback callback) { WindowContainerTransaction t = new WindowContainerTransaction(); WindowContainerTransaction t = new WindowContainerTransaction(); for (OnDisplayChangingListener c : mRotationListener) { dispatchOnRotateDisplay(t, displayId, fromRotation, toRotation); c.onRotateDisplay(displayId, fromRotation, toRotation, t); } try { try { callback.continueRotateDisplay(toRotation, t); callback.continueRotateDisplay(toRotation, t); } catch (RemoteException e) { } catch (RemoteException e) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,11 @@ public class DisplayController { } } } } /** Get the DisplayChangeController. */ public DisplayChangeController getChangeController() { return mChangeController; } /** /** * Gets a display by id from DisplayManager. * Gets a display by id from DisplayManager. */ */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -95,6 +95,7 @@ public class Transitions implements RemoteCallable<Transitions> { private final ShellExecutor mAnimExecutor; private final ShellExecutor mAnimExecutor; private final TransitionPlayerImpl mPlayerImpl; private final TransitionPlayerImpl mPlayerImpl; private final RemoteTransitionHandler mRemoteTransitionHandler; private final RemoteTransitionHandler mRemoteTransitionHandler; private final DisplayController mDisplayController; private final ShellTransitionImpl mImpl = new ShellTransitionImpl(); private final ShellTransitionImpl mImpl = new ShellTransitionImpl(); /** List of possible handlers. Ordered by specificity (eg. tapped back to front). */ /** List of possible handlers. Ordered by specificity (eg. tapped back to front). */ Loading Loading @@ -122,6 +123,7 @@ public class Transitions implements RemoteCallable<Transitions> { mContext = context; mContext = context; mMainExecutor = mainExecutor; mMainExecutor = mainExecutor; mAnimExecutor = animExecutor; mAnimExecutor = animExecutor; mDisplayController = displayController; mPlayerImpl = new TransitionPlayerImpl(); mPlayerImpl = new TransitionPlayerImpl(); // The very last handler (0 in the list) should be the default one. // The very last handler (0 in the list) should be the default one. mHandlers.add(new DefaultTransitionHandler(displayController, pool, context, mainExecutor, mHandlers.add(new DefaultTransitionHandler(displayController, pool, context, mainExecutor, Loading @@ -147,6 +149,7 @@ public class Transitions implements RemoteCallable<Transitions> { mContext = null; mContext = null; mMainExecutor = null; mMainExecutor = null; mAnimExecutor = null; mAnimExecutor = null; mDisplayController = null; mPlayerImpl = null; mPlayerImpl = null; mRemoteTransitionHandler = null; mRemoteTransitionHandler = null; } } Loading Loading @@ -547,6 +550,17 @@ public class Transitions implements RemoteCallable<Transitions> { break; break; } } } } if (request.getDisplayChange() != null) { TransitionRequestInfo.DisplayChange change = request.getDisplayChange(); if (change.getEndRotation() != change.getStartRotation()) { // Is a rotation, so dispatch to all displayChange listeners if (wct == null) { wct = new WindowContainerTransaction(); } mDisplayController.getChangeController().dispatchOnRotateDisplay(wct, change.getDisplayId(), change.getStartRotation(), change.getEndRotation()); } } active.mToken = mOrganizer.startTransition( active.mToken = mOrganizer.startTransition( request.getType(), transitionToken, wct); request.getType(), transitionToken, wct); mActiveTransitions.add(active); mActiveTransitions.add(active); Loading