Merge "Add some traces for shell transition"
This commit is contained in:
@@ -16,9 +16,12 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
|
||||
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_SYNC_ENGINE;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Trace;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
@@ -56,6 +59,7 @@ import com.android.internal.protolog.common.ProtoLog;
|
||||
*/
|
||||
class BLASTSyncEngine {
|
||||
private static final String TAG = "BLASTSyncEngine";
|
||||
private static final String TRACE_NAME_SYNC_GROUP_READY = "SyncGroupReady";
|
||||
|
||||
interface TransactionReadyListener {
|
||||
void onTransactionReady(int mSyncId, SurfaceControl.Transaction transaction);
|
||||
@@ -72,7 +76,7 @@ class BLASTSyncEngine {
|
||||
final ArraySet<WindowContainer> mRootMembers = new ArraySet<>();
|
||||
private SurfaceControl.Transaction mOrphanTransaction = null;
|
||||
|
||||
private SyncGroup(TransactionReadyListener listener, int id) {
|
||||
private SyncGroup(TransactionReadyListener listener, int id, String name) {
|
||||
mSyncId = id;
|
||||
mListener = listener;
|
||||
mOnTimeout = () -> {
|
||||
@@ -81,6 +85,10 @@ class BLASTSyncEngine {
|
||||
onTimeout();
|
||||
}
|
||||
};
|
||||
if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) {
|
||||
Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER,
|
||||
name + TRACE_NAME_SYNC_GROUP_READY, id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,6 +121,7 @@ class BLASTSyncEngine {
|
||||
}
|
||||
|
||||
private void finishNow() {
|
||||
Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, TRACE_NAME_SYNC_GROUP_READY, mSyncId);
|
||||
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Finished!", mSyncId);
|
||||
SurfaceControl.Transaction merged = mWm.mTransactionFactory.get();
|
||||
if (mOrphanTransaction != null) {
|
||||
@@ -121,7 +130,9 @@ class BLASTSyncEngine {
|
||||
for (WindowContainer wc : mRootMembers) {
|
||||
wc.finishSync(merged, false /* cancel */);
|
||||
}
|
||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "onTransactionReady");
|
||||
mListener.onTransactionReady(mSyncId, merged);
|
||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||
mActiveSyncs.remove(mSyncId);
|
||||
mWm.mH.removeCallbacks(mOnTimeout);
|
||||
}
|
||||
@@ -168,12 +179,12 @@ class BLASTSyncEngine {
|
||||
}
|
||||
|
||||
int startSyncSet(TransactionReadyListener listener) {
|
||||
return startSyncSet(listener, WindowState.BLAST_TIMEOUT_DURATION);
|
||||
return startSyncSet(listener, WindowState.BLAST_TIMEOUT_DURATION, "");
|
||||
}
|
||||
|
||||
int startSyncSet(TransactionReadyListener listener, long timeoutMs) {
|
||||
int startSyncSet(TransactionReadyListener listener, long timeoutMs, String name) {
|
||||
final int id = mNextSyncId++;
|
||||
final SyncGroup s = new SyncGroup(listener, id);
|
||||
final SyncGroup s = new SyncGroup(listener, id, name);
|
||||
mActiveSyncs.put(id, s);
|
||||
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Started for listener: %s", id, listener);
|
||||
scheduleTimeout(s, timeoutMs);
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.Display.INVALID_DISPLAY;
|
||||
import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION;
|
||||
@@ -67,6 +68,7 @@ import android.os.IBinder;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
@@ -93,6 +95,7 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListener {
|
||||
private static final String TAG = "Transition";
|
||||
private static final String TRACE_NAME_PLAY_TRANSITION = "PlayTransition";
|
||||
|
||||
/** The default package for resources */
|
||||
private static final String DEFAULT_PACKAGE = "android";
|
||||
@@ -181,7 +184,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
||||
mFlags = flags;
|
||||
mController = controller;
|
||||
mSyncEngine = syncEngine;
|
||||
mSyncId = mSyncEngine.startSyncSet(this, timeoutMs);
|
||||
mSyncId = mSyncEngine.startSyncSet(this, timeoutMs, TAG);
|
||||
}
|
||||
|
||||
void addFlag(int flag) {
|
||||
@@ -402,6 +405,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
||||
* be called directly; use {@link TransitionController#finishTransition} instead.
|
||||
*/
|
||||
void finishTransition() {
|
||||
if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) {
|
||||
Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, TRACE_NAME_PLAY_TRANSITION,
|
||||
System.identityHashCode(this));
|
||||
}
|
||||
mStartTransaction = mFinishTransaction = null;
|
||||
if (mState < STATE_PLAYING) {
|
||||
throw new IllegalStateException("Can't finish a non-playing transition " + mSyncId);
|
||||
@@ -639,6 +646,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
||||
"Calling onTransitionReady: %s", info);
|
||||
mController.getTransitionPlayer().onTransitionReady(
|
||||
this, info, transaction, mFinishTransaction);
|
||||
if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) {
|
||||
Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, TRACE_NAME_PLAY_TRANSITION,
|
||||
System.identityHashCode(this));
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// If there's an exception when trying to send the mergedTransaction to the
|
||||
// client, we should finish and apply it here so the transactions aren't lost.
|
||||
|
||||
Reference in New Issue
Block a user