diff options
| author | 2022-05-07 22:55:35 +0000 | |
|---|---|---|
| committer | 2022-05-07 22:55:35 +0000 | |
| commit | c0573c9851282fc54d3e3906d7250d5b152e79c9 (patch) | |
| tree | 878f7e2aa3c4d0e4eef136f504792f540034ba9d | |
| parent | bf7fddee01c116d2619535a1bca7d2cc3f163a62 (diff) | |
| parent | bf53704dab84921aae33257ae67af428b56cb2cb (diff) | |
Merge "BLASTSyncEngine: Logging and trace around commit timeout" into tm-dev
| -rw-r--r-- | services/core/java/com/android/server/wm/BLASTSyncEngine.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/BLASTSyncEngine.java b/services/core/java/com/android/server/wm/BLASTSyncEngine.java index ee7d9a9b3f2d..46ce43335f01 100644 --- a/services/core/java/com/android/server/wm/BLASTSyncEngine.java +++ b/services/core/java/com/android/server/wm/BLASTSyncEngine.java @@ -153,10 +153,10 @@ class BLASTSyncEngine { for (WindowContainer wc : mRootMembers) { wc.waitForSyncTransactionCommit(wcAwaitingCommit); } - final Runnable callback = new Runnable() { + class CommitCallback implements Runnable { // Can run a second time if the action completes after the timeout. boolean ran = false; - public void run() { + public void onCommitted() { synchronized (mWm.mGlobalLock) { if (ran) { return; @@ -171,8 +171,23 @@ class BLASTSyncEngine { wcAwaitingCommit.clear(); } } + + // Called in timeout + @Override + public void run() { + // Sometimes we get a trace, sometimes we get a bugreport without + // a trace. Since these kind of ANRs can trigger such an issue, + // try and ensure we will have some visibility in both cases. + Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "onTransactionCommitTimeout"); + Slog.e(TAG, "WM sent Transaction to organized, but never received" + + " commit callback. Application ANR likely to follow."); + Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); + onCommitted(); + + } }; - merged.addTransactionCommittedListener((r) -> { r.run(); }, callback::run); + CommitCallback callback = new CommitCallback(); + merged.addTransactionCommittedListener((r) -> { r.run(); }, callback::onCommitted); mWm.mH.postDelayed(callback, BLAST_TIMEOUT_DURATION); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "onTransactionReady"); |