Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 843adbc7 authored by buwenjing's avatar buwenjing
Browse files

Catch Exception to avoid SyncCallback residue



When sync operation occur exception, the mId is not set and not send timeout msg. This will cause the current sync callback reside, and sync transaction queue is unable to work normally.
So try catch here to ensure sync transaction queue is able to work normally.

Bug: 385751151
Test: Manual test

Change-Id: I3759bd7a89ab7987d56fee050d4ff1f07eb17523
Signed-off-by: default avatarbuwenjing <buwenjing@xiaomi.com>
parent 2f8b519d
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -192,15 +192,22 @@ public final class SyncTransactionQueue {
                throw new IllegalStateException("Sync Transactions must be serialized. In Flight: "
                        + mInFlight.mId + " - " + mInFlight.mWCT);
            }
            mInFlight = this;
            if (DEBUG) Slog.d(TAG, "Sending sync transaction: " + mWCT);
            try {
                if (mLegacyTransition != null) {
                    mId = new WindowOrganizer().startLegacyTransition(mLegacyTransition.getType(),
                            mLegacyTransition.getAdapter(), this, mWCT);
                } else {
                    mId = new WindowOrganizer().applySyncTransaction(mWCT, this);
                }
            } catch (RuntimeException e) {
                Slog.e(TAG, "Send failed", e);
                // Finish current sync callback immediately.
                onTransactionReady(mId, new SurfaceControl.Transaction());
                return;
            }
            if (DEBUG) Slog.d(TAG, " Sent sync transaction. Got id=" + mId);
            mInFlight = this;
            mMainExecutor.executeDelayed(mOnReplyTimeout, REPLY_TIMEOUT);
        }