diff options
| author | 2023-08-14 11:03:49 +0000 | |
|---|---|---|
| committer | 2023-08-14 11:03:49 +0000 | |
| commit | a1487979fb48ada5d3020b17078cd8b8c20dcce3 (patch) | |
| tree | aca24c3b30708b6209cd0cb879873e70d9d945cb | |
| parent | 88c269c2e27f79bbee342b3f51e8458af9251a96 (diff) | |
| parent | 2b30017c31fc002891d265f3e828c6337f2b0891 (diff) | |
Merge "Add removal time of starting window in transition trace proto" into udc-qpr-dev am: 2b30017c31
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24342219
Change-Id: I697e1a755afe3ba42b4d8c87bef9a872f4f43b41
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
5 files changed, 30 insertions, 1 deletions
diff --git a/core/proto/android/server/windowmanagertransitiontrace.proto b/core/proto/android/server/windowmanagertransitiontrace.proto index a950a79d94fb..34ccb482fb14 100644 --- a/core/proto/android/server/windowmanagertransitiontrace.proto +++ b/core/proto/android/server/windowmanagertransitiontrace.proto @@ -56,6 +56,7 @@ message Transition { repeated Target targets = 8; optional int32 flags = 9; optional int64 abort_time_ns = 10; + optional int64 starting_window_remove_time_ns = 11; } message Target { diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index b9ac5c3520d9..5a6851ea196c 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2784,6 +2784,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } else if (isEmbedded()) { associateStartingWindowWithTaskIfNeeded(); } + if (mTransitionController.isCollecting()) { + mStartingData.mTransitionId = mTransitionController.getCollectingTransitionId(); + } } } diff --git a/services/core/java/com/android/server/wm/StartingData.java b/services/core/java/com/android/server/wm/StartingData.java index 2b22d75693fe..34806bd023a0 100644 --- a/services/core/java/com/android/server/wm/StartingData.java +++ b/services/core/java/com/android/server/wm/StartingData.java @@ -65,6 +65,9 @@ public abstract class StartingData { /** Whether to prepare the removal animation. */ boolean mPrepareRemoveAnimation; + /** Non-zero if this starting window is added in a collecting transition. */ + int mTransitionId; + protected StartingData(WindowManagerService service, int typeParams) { mService = service; mTypeParams = typeParams; diff --git a/services/core/java/com/android/server/wm/TransitionTracer.java b/services/core/java/com/android/server/wm/TransitionTracer.java index af8fb0252675..c59d2d392e93 100644 --- a/services/core/java/com/android/server/wm/TransitionTracer.java +++ b/services/core/java/com/android/server/wm/TransitionTracer.java @@ -145,6 +145,27 @@ public class TransitionTracer { } } + void logRemovingStartingWindow(@NonNull StartingData startingData) { + if (startingData.mTransitionId == 0) { + return; + } + try { + final ProtoOutputStream outputStream = new ProtoOutputStream(CHUNK_SIZE); + final long protoToken = outputStream + .start(com.android.server.wm.shell.TransitionTraceProto.TRANSITIONS); + outputStream.write(com.android.server.wm.shell.Transition.ID, + startingData.mTransitionId); + outputStream.write( + com.android.server.wm.shell.Transition.STARTING_WINDOW_REMOVE_TIME_NS, + SystemClock.elapsedRealtimeNanos()); + outputStream.end(protoToken); + + mTraceBuffer.add(outputStream); + } catch (Exception e) { + Log.e(LOG_TAG, "Unexpected exception thrown while logging transitions", e); + } + } + private void dumpTransitionTargetsToProto(ProtoOutputStream outputStream, Transition transition, ArrayList<ChangeInfo> targets) { Trace.beginSection("TransitionTracer#dumpTransitionTargetsToProto"); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 8faeebc8de7b..c09e6a3fda18 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2412,7 +2412,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP ProtoLog.v(WM_DEBUG_ADD_REMOVE, "removeIfPossible: %s callers=%s", this, Debug.getCallers(5)); - final boolean startingWindow = mAttrs.type == TYPE_APPLICATION_STARTING; + final boolean startingWindow = mStartingData != null; if (startingWindow) { ProtoLog.d(WM_DEBUG_STARTING_WINDOW, "Starting window removed %s", this); // Cancel the remove starting window animation on shell. The main window might changed @@ -2426,6 +2426,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return false; }, true); } + mTransitionController.mTransitionTracer.logRemovingStartingWindow(mStartingData); } else if (mAttrs.type == TYPE_BASE_APPLICATION && isSelfAnimating(0, ANIMATION_TYPE_STARTING_REVEAL)) { // Cancel the remove starting window animation in case the binder dead before remove |