summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Rosky <erosky@google.com> 2023-03-31 20:43:15 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-03-31 20:43:15 +0000
commit597811e84ebc93b602890ba4b19c175bbaeb7c27 (patch)
tree445a206347d1e3fb547e3602b9e24c01f681bb00
parentd6e2ea0a315eab9650ad2b43968332660bde4262 (diff)
parent7355478fe7adfb8b7813db501c1b7ec56b85fab6 (diff)
Merge "Improve transition logging" into udc-dev
-rw-r--r--core/java/android/window/RemoteTransition.java45
-rw-r--r--core/java/android/window/TransitionInfo.java23
-rw-r--r--core/java/android/window/WindowContainerTransaction.java116
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java1
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java11
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java15
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/SleepHandler.java2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java45
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java5
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java9
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/RemoteTransitionAdapter.kt11
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java3
-rw-r--r--services/core/java/com/android/server/wm/Transition.java1
15 files changed, 215 insertions, 84 deletions
diff --git a/core/java/android/window/RemoteTransition.java b/core/java/android/window/RemoteTransition.java
index 4bd15f27a91a..4cc7ec598dbf 100644
--- a/core/java/android/window/RemoteTransition.java
+++ b/core/java/android/window/RemoteTransition.java
@@ -38,9 +38,18 @@ public class RemoteTransition implements Parcelable {
/** The application thread that will be running the remote transition. */
private @Nullable IApplicationThread mAppThread;
+ /** A name for this that can be used for debugging. */
+ private @Nullable String mDebugName;
+
/** Constructs with no app thread (animation runs in shell). */
public RemoteTransition(@NonNull IRemoteTransition remoteTransition) {
- this(remoteTransition, null /* appThread */);
+ this(remoteTransition, null /* appThread */, null /* debugName */);
+ }
+
+ /** Constructs with no app thread (animation runs in shell). */
+ public RemoteTransition(@NonNull IRemoteTransition remoteTransition,
+ @Nullable String debugName) {
+ this(remoteTransition, null /* appThread */, debugName);
}
/** Get the IBinder associated with the underlying IRemoteTransition. */
@@ -70,15 +79,19 @@ public class RemoteTransition implements Parcelable {
* 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.
*/
@DataClass.Generated.Member
public RemoteTransition(
@NonNull IRemoteTransition remoteTransition,
- @Nullable IApplicationThread appThread) {
+ @Nullable IApplicationThread appThread,
+ @Nullable String debugName) {
this.mRemoteTransition = remoteTransition;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mRemoteTransition);
this.mAppThread = appThread;
+ this.mDebugName = debugName;
// onConstructed(); // You can define this method to get a callback
}
@@ -100,6 +113,14 @@ public class RemoteTransition implements Parcelable {
}
/**
+ * A name for this that can be used for debugging.
+ */
+ @DataClass.Generated.Member
+ public @Nullable String getDebugName() {
+ return mDebugName;
+ }
+
+ /**
* The actual remote-transition interface used to run the transition animation.
*/
@DataClass.Generated.Member
@@ -119,6 +140,15 @@ public class RemoteTransition implements Parcelable {
return this;
}
+ /**
+ * 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() {
@@ -127,7 +157,8 @@ public class RemoteTransition implements Parcelable {
return "RemoteTransition { " +
"remoteTransition = " + mRemoteTransition + ", " +
- "appThread = " + mAppThread +
+ "appThread = " + mAppThread + ", " +
+ "debugName = " + mDebugName +
" }";
}
@@ -139,9 +170,11 @@ public class RemoteTransition implements Parcelable {
byte flg = 0;
if (mAppThread != null) flg |= 0x2;
+ if (mDebugName != null) flg |= 0x4;
dest.writeByte(flg);
dest.writeStrongInterface(mRemoteTransition);
if (mAppThread != null) dest.writeStrongInterface(mAppThread);
+ if (mDebugName != null) dest.writeString(mDebugName);
}
@Override
@@ -158,11 +191,13 @@ public class RemoteTransition implements Parcelable {
byte flg = in.readByte();
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;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mRemoteTransition);
this.mAppThread = appThread;
+ this.mDebugName = debugName;
// onConstructed(); // You can define this method to get a callback
}
@@ -182,10 +217,10 @@ public class RemoteTransition implements Parcelable {
};
@DataClass.Generated(
- time = 1630690027011L,
+ 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\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)")
+ 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() {}
diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java
index 57285f8343c0..0f3eef7a3289 100644
--- a/core/java/android/window/TransitionInfo.java
+++ b/core/java/android/window/TransitionInfo.java
@@ -194,6 +194,9 @@ public final class TransitionInfo implements Parcelable {
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;
+
/** @hide */
public TransitionInfo(@TransitionType int type, @TransitionFlags int flags) {
mType = type;
@@ -206,6 +209,7 @@ public final class TransitionInfo implements Parcelable {
in.readTypedList(mChanges, Change.CREATOR);
in.readTypedList(mRoots, Root.CREATOR);
mOptions = in.readTypedObject(AnimationOptions.CREATOR);
+ mDebugId = in.readInt();
}
@Override
@@ -216,6 +220,7 @@ public final class TransitionInfo implements Parcelable {
dest.writeTypedList(mChanges);
dest.writeTypedList(mRoots, flags);
dest.writeTypedObject(mOptions, flags);
+ dest.writeInt(mDebugId);
}
@NonNull
@@ -351,11 +356,24 @@ public final class TransitionInfo implements Parcelable {
return (mFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0;
}
+ /**
+ * 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;
+ }
+
+ /** Get the "debug" id of this info. Do NOT use this for real work, only use for debugging. */
+ public int getDebugId() {
+ return mDebugId;
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("{t=").append(transitTypeToString(mType)).append(" f=0x")
- .append(Integer.toHexString(mFlags)).append(" r=[");
+ sb.append("{id=").append(mDebugId).append(" t=").append(transitTypeToString(mType))
+ .append(" f=0x").append(Integer.toHexString(mFlags)).append(" r=[");
for (int i = 0; i < mRoots.size(); ++i) {
if (i > 0) {
sb.append(',');
@@ -514,6 +532,7 @@ public final class TransitionInfo implements Parcelable {
*/
public TransitionInfo localRemoteCopy() {
final TransitionInfo out = new TransitionInfo(mType, mFlags);
+ out.mDebugId = mDebugId;
for (int i = 0; i < mChanges.size(); ++i) {
out.mChanges.add(mChanges.get(i).localRemoteCopy());
}
diff --git a/core/java/android/window/WindowContainerTransaction.java b/core/java/android/window/WindowContainerTransaction.java
index ad20432bd57d..9f804b1e1a7f 100644
--- a/core/java/android/window/WindowContainerTransaction.java
+++ b/core/java/android/window/WindowContainerTransaction.java
@@ -1586,61 +1586,109 @@ public final class WindowContainerTransaction implements Parcelable {
return mShortcutInfo;
}
+ /** Gets a string representation of a hierarchy-op type. */
+ public static String hopToString(int type) {
+ switch (type) {
+ case HIERARCHY_OP_TYPE_REPARENT: return "reparent";
+ case HIERARCHY_OP_TYPE_REORDER: return "reorder";
+ case HIERARCHY_OP_TYPE_CHILDREN_TASKS_REPARENT: return "ChildrenTasksReparent";
+ case HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT: return "SetLaunchRoot";
+ case HIERARCHY_OP_TYPE_SET_ADJACENT_ROOTS: return "SetAdjacentRoot";
+ case HIERARCHY_OP_TYPE_LAUNCH_TASK: return "LaunchTask";
+ case HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT: return "SetAdjacentFlagRoot";
+ case HIERARCHY_OP_TYPE_PENDING_INTENT: return "PendingIntent";
+ case HIERARCHY_OP_TYPE_START_SHORTCUT: return "StartShortcut";
+ case HIERARCHY_OP_TYPE_ADD_INSETS_FRAME_PROVIDER: return "addInsetsFrameProvider";
+ case HIERARCHY_OP_TYPE_REMOVE_INSETS_FRAME_PROVIDER:
+ return "removeInsetsFrameProvider";
+ case HIERARCHY_OP_TYPE_SET_ALWAYS_ON_TOP: return "setAlwaysOnTop";
+ case HIERARCHY_OP_TYPE_REMOVE_TASK: return "RemoveTask";
+ case HIERARCHY_OP_TYPE_FINISH_ACTIVITY: return "finishActivity";
+ case HIERARCHY_OP_TYPE_CLEAR_ADJACENT_ROOTS: return "ClearAdjacentRoot";
+ case HIERARCHY_OP_TYPE_SET_REPARENT_LEAF_TASK_IF_RELAUNCH:
+ return "setReparentLeafTaskIfRelaunch";
+ case HIERARCHY_OP_TYPE_ADD_TASK_FRAGMENT_OPERATION:
+ return "addTaskFragmentOperation";
+ default: return "HOP(" + type + ")";
+ }
+ }
+
@Override
public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{").append(hopToString(mType)).append(": ");
switch (mType) {
case HIERARCHY_OP_TYPE_CHILDREN_TASKS_REPARENT:
- return "{ChildrenTasksReparent: from=" + mContainer + " to=" + mReparent
- + " mToTop=" + mToTop + " mReparentTopOnly=" + mReparentTopOnly
- + " mWindowingMode=" + Arrays.toString(mWindowingModes)
- + " mActivityType=" + Arrays.toString(mActivityTypes) + "}";
+ sb.append("from=").append(mContainer).append(" to=").append(mReparent)
+ .append(" mToTop=").append(mToTop)
+ .append(" mReparentTopOnly=").append(mReparentTopOnly)
+ .append(" mWindowingMode=").append(Arrays.toString(mWindowingModes))
+ .append(" mActivityType=").append(Arrays.toString(mActivityTypes));
+ break;
case HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT:
- return "{SetLaunchRoot: container=" + mContainer
- + " mWindowingMode=" + Arrays.toString(mWindowingModes)
- + " mActivityType=" + Arrays.toString(mActivityTypes) + "}";
+ sb.append("container=").append(mContainer)
+ .append(" mWindowingMode=").append(Arrays.toString(mWindowingModes))
+ .append(" mActivityType=").append(Arrays.toString(mActivityTypes));
+ break;
case HIERARCHY_OP_TYPE_REPARENT:
- return "{reparent: " + mContainer + " to " + (mToTop ? "top of " : "bottom of ")
- + mReparent + "}";
+ sb.append(mContainer).append(" to ").append(mToTop ? "top of " : "bottom of ")
+ .append(mReparent);
+ break;
case HIERARCHY_OP_TYPE_REORDER:
- return "{reorder: " + mContainer + " to " + (mToTop ? "top" : "bottom") + "}";
+ sb.append(mContainer).append(" to ").append(mToTop ? "top" : "bottom");
+ break;
case HIERARCHY_OP_TYPE_SET_ADJACENT_ROOTS:
- return "{SetAdjacentRoot: container=" + mContainer
- + " adjacentRoot=" + mReparent + "}";
+ sb.append("container=").append(mContainer)
+ .append(" adjacentRoot=").append(mReparent);
+ break;
case HIERARCHY_OP_TYPE_LAUNCH_TASK:
- return "{LaunchTask: " + mLaunchOptions + "}";
+ sb.append(mLaunchOptions);
+ break;
case HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT:
- return "{SetAdjacentFlagRoot: container=" + mContainer + " clearRoot=" + mToTop
- + "}";
+ sb.append("container=").append(mContainer).append(" clearRoot=").append(mToTop);
+ break;
case HIERARCHY_OP_TYPE_START_SHORTCUT:
- return "{StartShortcut: options=" + mLaunchOptions + " info=" + mShortcutInfo
- + "}";
+ sb.append("options=").append(mLaunchOptions)
+ .append(" info=").append(mShortcutInfo);
+ break;
+ case HIERARCHY_OP_TYPE_PENDING_INTENT:
+ sb.append("options=").append(mLaunchOptions);
+ break;
case HIERARCHY_OP_TYPE_ADD_INSETS_FRAME_PROVIDER:
- return "{addRectInsetsProvider: container=" + mContainer
- + " provider=" + mInsetsFrameProvider + "}";
case HIERARCHY_OP_TYPE_REMOVE_INSETS_FRAME_PROVIDER:
- return "{removeLocalInsetsProvider: container=" + mContainer
- + " provider=" + mInsetsFrameProvider + "}";
+ sb.append("container=").append(mContainer)
+ .append(" provider=").append(mInsetsFrameProvider);
+ break;
case HIERARCHY_OP_TYPE_SET_ALWAYS_ON_TOP:
- return "{setAlwaysOnTop: container=" + mContainer
- + " alwaysOnTop=" + mAlwaysOnTop + "}";
+ sb.append("container=").append(mContainer)
+ .append(" alwaysOnTop=").append(mAlwaysOnTop);
+ break;
case HIERARCHY_OP_TYPE_REMOVE_TASK:
- return "{RemoveTask: task=" + mContainer + "}";
+ sb.append("task=").append(mContainer);
+ break;
case HIERARCHY_OP_TYPE_FINISH_ACTIVITY:
- return "{finishActivity: activity=" + mContainer + "}";
+ sb.append("activity=").append(mContainer);
+ break;
case HIERARCHY_OP_TYPE_CLEAR_ADJACENT_ROOTS:
- return "{ClearAdjacentRoot: container=" + mContainer + "}";
+ sb.append("container=").append(mContainer);
+ break;
case HIERARCHY_OP_TYPE_SET_REPARENT_LEAF_TASK_IF_RELAUNCH:
- return "{setReparentLeafTaskIfRelaunch: container= " + mContainer
- + " reparentLeafTaskIfRelaunch= " + mReparentLeafTaskIfRelaunch + "}";
+ sb.append("container= ").append(mContainer)
+ .append(" reparentLeafTaskIfRelaunch= ")
+ .append(mReparentLeafTaskIfRelaunch);
+ break;
case HIERARCHY_OP_TYPE_ADD_TASK_FRAGMENT_OPERATION:
- return "{addTaskFragmentOperation: fragmentToken= " + mContainer
- + " operation= " + mTaskFragmentOperation + "}";
+ sb.append("fragmentToken= ").append(mContainer)
+ .append(" operation= ").append(mTaskFragmentOperation);
+ break;
default:
- return "{mType=" + mType + " container=" + mContainer + " reparent=" + mReparent
- + " mToTop=" + mToTop
- + " mWindowingMode=" + Arrays.toString(mWindowingModes)
- + " mActivityType=" + Arrays.toString(mActivityTypes) + "}";
+ sb.append("container=").append(mContainer)
+ .append(" reparent=").append(mReparent)
+ .append(" mToTop=").append(mToTop)
+ .append(" mWindowingMode=").append(Arrays.toString(mWindowingModes))
+ .append(" mActivityType=").append(Arrays.toString(mActivityTypes));
}
+ return sb.append("}").toString();
}
@Override
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java
index d52abf795152..5a92f7830194 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java
@@ -235,6 +235,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
private TransitionInfo subCopy(@NonNull TransitionInfo info,
@WindowManager.TransitionType int newType, boolean withChanges) {
final TransitionInfo out = new TransitionInfo(newType, withChanges ? info.getFlags() : 0);
+ out.setDebugId(info.getDebugId());
if (withChanges) {
for (int i = 0; i < info.getChanges().size(); ++i) {
out.getChanges().add(info.getChanges().get(i));
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java
index 485b400f458d..4e3d220f1ea2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java
@@ -63,7 +63,7 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
@NonNull Transitions.TransitionFinishCallback finishCallback) {
if (mTransition != transition) return false;
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Using registered One-shot remote"
- + " transition %s for %s.", mRemote, transition);
+ + " transition %s for #%d.", mRemote, info.getDebugId());
final IBinder.DeathRecipient remoteDied = () -> {
Log.e(Transitions.TAG, "Remote transition died, finishing");
@@ -113,9 +113,6 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
@NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
@NonNull Transitions.TransitionFinishCallback finishCallback) {
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Using registered One-shot remote"
- + " transition %s for %s.", mRemote, transition);
-
IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
@Override
public void onTransitionFinished(WindowContainerTransaction wct,
@@ -154,4 +151,10 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
+ " for %s: %s", transition, remote);
return new WindowContainerTransaction();
}
+
+ @Override
+ public String toString() {
+ return "OneShotRemoteHandler:" + mRemote.getDebugName() + ":"
+ + mRemote.getRemoteTransition();
+ }
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java
index 3c4e8898f215..5b7231c5a5fb 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java
@@ -101,8 +101,8 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
}
RemoteTransition pendingRemote = mRequestedRemotes.get(transition);
if (pendingRemote == null) {
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Transition %s doesn't have "
- + "explicit remote, search filters for match for %s", transition, info);
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Transition doesn't have "
+ + "explicit remote, search filters for match for %s", info);
// If no explicit remote, search filters until one matches
for (int i = mFilters.size() - 1; i >= 0; --i) {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Checking filter %s",
@@ -116,8 +116,8 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
}
}
}
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Delegate animation for %s to %s",
- transition, pendingRemote);
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Delegate animation for #%d to %s",
+ info.getDebugId(), pendingRemote);
if (pendingRemote == null) return false;
@@ -184,9 +184,10 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
@NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
@NonNull Transitions.TransitionFinishCallback finishCallback) {
- final IRemoteTransition remote = mRequestedRemotes.get(mergeTarget).getRemoteTransition();
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Attempt merge %s into %s",
- transition, remote);
+ final RemoteTransition remoteTransition = mRequestedRemotes.get(mergeTarget);
+ final IRemoteTransition remote = remoteTransition.getRemoteTransition();
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Merge into remote: %s",
+ remoteTransition);
if (remote == null) return;
IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/SleepHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/SleepHandler.java
index 0386ec38a3ff..1879bf721fed 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/SleepHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/SleepHandler.java
@@ -19,7 +19,6 @@ package com.android.wm.shell.transition;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.IBinder;
-import android.util.Log;
import android.view.SurfaceControl;
import android.window.TransitionInfo;
import android.window.TransitionRequestInfo;
@@ -59,7 +58,6 @@ class SleepHandler implements Transitions.TransitionHandler {
@Override
public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted,
@Nullable SurfaceControl.Transaction finishTransaction) {
- Log.e(Transitions.TAG, "Sleep transition was consumed. This doesn't make sense");
mSleepTransitions.remove(transition);
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
index b8fd9f1312d0..681fa5177da2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
@@ -185,6 +185,14 @@ public class Transitions implements RemoteCallable<Transitions> {
/** Ordered list of transitions which have been merged into this one. */
private ArrayList<ActiveTransition> mMerged;
+
+ @Override
+ public String toString() {
+ if (mInfo != null && mInfo.getDebugId() >= 0) {
+ return "(#" + mInfo.getDebugId() + ")" + mToken;
+ }
+ return mToken.toString();
+ }
}
/** Keeps track of transitions which have been started, but aren't ready yet. */
@@ -542,8 +550,8 @@ public class Transitions implements RemoteCallable<Transitions> {
activeTransition -> activeTransition.mToken).toArray()));
}
if (activeIdx > 0) {
- Log.e(TAG, "Transition became ready out-of-order " + transitionToken + ". Expected"
- + " order: " + Arrays.toString(mPendingTransitions.stream().map(
+ Log.e(TAG, "Transition became ready out-of-order " + mPendingTransitions.get(activeIdx)
+ + ". Expected order: " + Arrays.toString(mPendingTransitions.stream().map(
activeTransition -> activeTransition.mToken).toArray()));
}
// Move from pending to ready
@@ -560,6 +568,7 @@ public class Transitions implements RemoteCallable<Transitions> {
if (info.getType() == TRANSIT_SLEEP) {
if (activeIdx > 0 || !mActiveTransitions.isEmpty() || mReadyTransitions.size() > 1) {
// Sleep starts a process of forcing all prior transitions to finish immediately
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Start finish-for-sleep");
finishForSleep(null /* forceFinish */);
return;
}
@@ -568,8 +577,8 @@ public class Transitions implements RemoteCallable<Transitions> {
if (info.getRootCount() == 0 && !alwaysReportToKeyguard(info)) {
// No root-leashes implies that the transition is empty/no-op, so just do
// housekeeping and return.
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "No transition roots (%s): %s",
- transitionToken, info);
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "No transition roots in %s so"
+ + " abort", active);
onAbort(active);
return;
}
@@ -598,6 +607,8 @@ public class Transitions implements RemoteCallable<Transitions> {
&& allOccluded)) {
// Treat this as an abort since we are bypassing any merge logic and effectively
// finishing immediately.
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
+ "Non-visible anim so abort: %s", active);
onAbort(active);
return;
}
@@ -665,21 +676,21 @@ public class Transitions implements RemoteCallable<Transitions> {
return;
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Transition %s ready while"
- + " another transition %s is still animating. Notify the animating transition"
- + " in case they can be merged", ready.mToken, playing.mToken);
+ + " %s is still animating. Notify the animating transition"
+ + " in case they can be merged", ready, playing);
playing.mHandler.mergeAnimation(ready.mToken, ready.mInfo, ready.mStartT,
playing.mToken, (wct, cb) -> onMerged(playing, ready));
}
private void onMerged(@NonNull ActiveTransition playing, @NonNull ActiveTransition merged) {
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Transition was merged %s",
- merged.mToken);
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Transition was merged: %s into %s",
+ merged, playing);
int readyIdx = 0;
if (mReadyTransitions.isEmpty() || mReadyTransitions.get(0) != merged) {
- Log.e(TAG, "Merged transition out-of-order?");
+ Log.e(TAG, "Merged transition out-of-order? " + merged);
readyIdx = mReadyTransitions.indexOf(merged);
if (readyIdx < 0) {
- Log.e(TAG, "Merged a transition that is no-longer queued?");
+ Log.e(TAG, "Merged a transition that is no-longer queued? " + merged);
return;
}
}
@@ -700,6 +711,7 @@ public class Transitions implements RemoteCallable<Transitions> {
}
private void playTransition(@NonNull ActiveTransition active) {
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Playing animation for %s", active);
for (int i = 0; i < mObservers.size(); ++i) {
mObservers.get(i).onTransitionStarting(active.mToken);
}
@@ -801,12 +813,12 @@ public class Transitions implements RemoteCallable<Transitions> {
int activeIdx = mActiveTransitions.indexOf(active);
if (activeIdx < 0) {
Log.e(TAG, "Trying to finish a non-running transition. Either remote crashed or "
- + " a handler didn't properly deal with a merge. " + active.mToken,
+ + " a handler didn't properly deal with a merge. " + active,
new RuntimeException());
return;
} else if (activeIdx != 0) {
// Relevant right now since we only allow 1 active transition at a time.
- Log.e(TAG, "Finishing a transition out of order. " + active.mToken);
+ Log.e(TAG, "Finishing a transition out of order. " + active);
}
mActiveTransitions.remove(activeIdx);
@@ -814,7 +826,7 @@ public class Transitions implements RemoteCallable<Transitions> {
mObservers.get(i).onTransitionFinished(active.mToken, active.mAborted);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Transition animation finished "
- + "(aborted=%b), notifying core %s", active.mAborted, active.mToken);
+ + "(aborted=%b), notifying core %s", active.mAborted, active);
if (active.mStartT != null) {
// Applied by now, so clear immediately to remove any references. Do not set to null
// yet, though, since nullness is used later to disambiguate malformed transitions.
@@ -930,6 +942,8 @@ public class Transitions implements RemoteCallable<Transitions> {
/** Start a new transition directly. */
public IBinder startTransition(@WindowManager.TransitionType int type,
@NonNull WindowContainerTransaction wct, @Nullable TransitionHandler handler) {
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Directly starting a new transition "
+ + "type=%d wct=%s handler=%s", type, wct, handler);
final ActiveTransition active = new ActiveTransition();
active.mHandler = handler;
active.mToken = mOrganizer.startNewTransition(type, wct);
@@ -961,8 +975,7 @@ public class Transitions implements RemoteCallable<Transitions> {
return;
}
if (forceFinish != null && mActiveTransitions.contains(forceFinish)) {
- Log.e(TAG, "Forcing transition to finish due to sleep timeout: "
- + forceFinish.mToken);
+ Log.e(TAG, "Forcing transition to finish due to sleep timeout: " + forceFinish);
forceFinish.mAborted = true;
// Last notify of it being consumed. Note: mHandler should never be null,
// but check just to be safe.
@@ -980,6 +993,8 @@ public class Transitions implements RemoteCallable<Transitions> {
// Try to signal that we are sleeping by attempting to merge the sleep transition
// into the playing one.
final ActiveTransition nextSleep = mReadyTransitions.get(sleepIdx);
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Attempt to merge SLEEP %s"
+ + " into %s", nextSleep, playing);
playing.mHandler.mergeAnimation(nextSleep.mToken, nextSleep.mInfo, dummyT,
playing.mToken, (wct, cb) -> {});
} else {
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java
index 1b291468d6dc..a9f311f9e9eb 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java
@@ -181,7 +181,7 @@ public class SplitTransitionTests extends ShellTestCase {
IBinder transition = mSplitScreenTransitions.startEnterTransition(
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, new WindowContainerTransaction(),
- new RemoteTransition(testRemote), mStageCoordinator, null, null);
+ new RemoteTransition(testRemote, "Test"), mStageCoordinator, null, null);
mMainStage.onTaskAppeared(mMainChild, createMockSurface());
mSideStage.onTaskAppeared(mSideChild, createMockSurface());
boolean accepted = mStageCoordinator.startAnimation(transition, info,
@@ -407,7 +407,8 @@ public class SplitTransitionTests extends ShellTestCase {
TransitionInfo enterInfo = createEnterPairInfo();
IBinder enterTransit = mSplitScreenTransitions.startEnterTransition(
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, new WindowContainerTransaction(),
- new RemoteTransition(new TestRemoteTransition()), mStageCoordinator, null, null);
+ new RemoteTransition(new TestRemoteTransition(), "Test"),
+ mStageCoordinator, null, null);
mMainStage.onTaskAppeared(mMainChild, createMockSurface());
mSideStage.onTaskAppeared(mSideChild, createMockSurface());
mStageCoordinator.startAnimation(enterTransit, enterInfo,
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java
index 60d697823f64..5cd548bfe5ab 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java
@@ -277,7 +277,7 @@ public class ShellTransitionTests extends ShellTestCase {
IBinder transitToken = new Binder();
transitions.requestStartTransition(transitToken,
new TransitionRequestInfo(TRANSIT_OPEN, null /* trigger */,
- new RemoteTransition(testRemote)));
+ new RemoteTransition(testRemote, "Test")));
verify(mOrganizer, times(1)).startTransition(eq(transitToken), any());
TransitionInfo info = new TransitionInfoBuilder(TRANSIT_OPEN)
.addChange(TRANSIT_OPEN).addChange(TRANSIT_CLOSE).build();
@@ -422,7 +422,7 @@ public class ShellTransitionTests extends ShellTestCase {
new TransitionFilter.Requirement[]{new TransitionFilter.Requirement()};
filter.mRequirements[0].mModes = new int[]{TRANSIT_OPEN, TRANSIT_TO_FRONT};
- transitions.registerRemote(filter, new RemoteTransition(testRemote));
+ transitions.registerRemote(filter, new RemoteTransition(testRemote, "Test"));
mMainExecutor.flushAll();
IBinder transitToken = new Binder();
@@ -466,11 +466,12 @@ public class ShellTransitionTests extends ShellTestCase {
final int transitType = TRANSIT_FIRST_CUSTOM + 1;
OneShotRemoteHandler oneShot = new OneShotRemoteHandler(mMainExecutor,
- new RemoteTransition(testRemote));
+ new RemoteTransition(testRemote, "Test"));
// Verify that it responds to the remote but not other things.
IBinder transitToken = new Binder();
assertNotNull(oneShot.handleRequest(transitToken,
- new TransitionRequestInfo(transitType, null, new RemoteTransition(testRemote))));
+ new TransitionRequestInfo(transitType, null,
+ new RemoteTransition(testRemote, "Test"))));
assertNull(oneShot.handleRequest(transitToken,
new TransitionRequestInfo(transitType, null, null)));
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteTransitionAdapter.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteTransitionAdapter.kt
index 03e1e66a3cac..197b217f96eb 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteTransitionAdapter.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteTransitionAdapter.kt
@@ -384,8 +384,15 @@ class RemoteTransitionAdapter {
}
@JvmStatic
- fun adaptRemoteAnimation(adapter: RemoteAnimationAdapter): RemoteTransition {
- return RemoteTransition(adaptRemoteRunner(adapter.runner), adapter.callingApplication)
+ fun adaptRemoteAnimation(
+ adapter: RemoteAnimationAdapter,
+ debugName: String
+ ): RemoteTransition {
+ return RemoteTransition(
+ adaptRemoteRunner(adapter.runner),
+ adapter.callingApplication,
+ debugName
+ )
}
}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java
index 58e7747a7a9f..1fbf743836a1 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java
@@ -89,7 +89,7 @@ public class RemoteTransitionCompat {
}
}
};
- return new RemoteTransition(remote, appThread);
+ return new RemoteTransition(remote, appThread, "Recents");
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
index 02f0f4572da3..107e685c4482 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
@@ -302,13 +302,13 @@ public class KeyguardService extends Service {
Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_GOING_AWAY");
TransitionFilter f = new TransitionFilter();
f.mFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
- mShellTransitions.registerRemote(f,
- new RemoteTransition(wrap(mExitAnimationRunner), getIApplicationThread()));
+ mShellTransitions.registerRemote(f, new RemoteTransition(
+ wrap(mExitAnimationRunner), getIApplicationThread(), "ExitKeyguard"));
Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_(UN)OCCLUDE");
// Register for occluding
final RemoteTransition occludeTransition = new RemoteTransition(
- mOccludeAnimation, getIApplicationThread());
+ mOccludeAnimation, getIApplicationThread(), "KeyguardOcclude");
f = new TransitionFilter();
f.mFlags = TRANSIT_FLAG_KEYGUARD_LOCKED;
f.mRequirements = new TransitionFilter.Requirement[]{
@@ -327,7 +327,7 @@ public class KeyguardService extends Service {
// Now register for un-occlude.
final RemoteTransition unoccludeTransition = new RemoteTransition(
- mUnoccludeAnimation, getIApplicationThread());
+ mUnoccludeAnimation, getIApplicationThread(), "KeyguardUnocclude");
f = new TransitionFilter();
f.mFlags = TRANSIT_FLAG_KEYGUARD_LOCKED;
f.mRequirements = new TransitionFilter.Requirement[]{
@@ -382,7 +382,7 @@ public class KeyguardService extends Service {
f.mRequirements[1].mModes = new int[]{TRANSIT_CLOSE, TRANSIT_TO_BACK};
mShellTransitions.registerRemote(f, new RemoteTransition(
wrap(mKeyguardViewMediator.getOccludeByDreamAnimationRunner()),
- getIApplicationThread()));
+ getIApplicationThread(), "KeyguardOccludeByDream"));
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index 9272f06076fa..0195d4532ae0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -157,7 +157,8 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
if (animationAdapter != null) {
if (ENABLE_SHELL_TRANSITIONS) {
options = ActivityOptions.makeRemoteTransition(
- RemoteTransitionAdapter.adaptRemoteAnimation(animationAdapter));
+ RemoteTransitionAdapter.adaptRemoteAnimation(animationAdapter,
+ "SysUILaunch"));
} else {
options = ActivityOptions.makeRemoteAnimation(animationAdapter);
}
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 1a220df883ab..0fe1f923e4e5 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1184,6 +1184,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
// Resolve the animating targets from the participants.
mTargets = calculateTargets(mParticipants, mChanges);
final TransitionInfo info = calculateTransitionInfo(mType, mFlags, mTargets, transaction);
+ info.setDebugId(mSyncId);
// Repopulate the displays based on the resolved targets.
mTargetDisplays.clear();