Merge "Post reportDrawFinished to the UI thread if running in system" into udc-qpr-dev

This commit is contained in:
Chavi Weingarten
2023-06-29 16:24:26 +00:00
committed by Android (Google) Code Review

View File

@@ -3855,7 +3855,15 @@ public final class ViewRootImpl implements ViewParent,
mWmsRequestSyncGroupState = WMS_SYNC_PENDING;
mWmsRequestSyncGroup = new SurfaceSyncGroup("wmsSync-" + mTag, t -> {
mWmsRequestSyncGroupState = WMS_SYNC_MERGED;
reportDrawFinished(t, seqId);
// See b/286355097. If the current process is not system, then invoking finishDraw on
// any thread is fine since once it calls into system process, finishDrawing will run
// on a different thread. However, when the current process is system, the finishDraw in
// system server will be run on the current thread, which could result in a deadlock.
if (mWindowSession instanceof Binder) {
reportDrawFinished(t, seqId);
} else {
mHandler.postAtFrontOfQueue(() -> reportDrawFinished(t, seqId));
}
});
if (DEBUG_BLAST) {
Log.d(mTag, "Setup new sync=" + mWmsRequestSyncGroup.getName());