Merge "Use async callback for unfold overlay synchronization" into tm-dev am: 39f02b6fc6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17540005

Change-Id: I15c4ac305d104c7791a340c116cc5b45a17b1f1c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Nick Chameyev
2022-04-04 09:45:53 +00:00
committed by Automerger Merge Worker

View File

@@ -155,21 +155,22 @@ constructor(
newRoot.relayout(params) { transaction ->
val vsyncId = Choreographer.getSfInstance().vsyncId
backgroundExecutor.execute {
// Apply the transaction that contains the first frame of the overlay
// synchronously and apply another empty transaction with
// 'vsyncId + 1' to make sure that it is actually displayed on
// the screen. The second transaction is necessary to remove the screen blocker
// (turn on the brightness) only when the content is actually visible as it
// might be presented only in the next frame.
// See b/197538198
transaction.setFrameTimelineVsync(vsyncId).apply(/* sync */ true)
// Apply the transaction that contains the first frame of the overlay and apply
// another empty transaction with 'vsyncId + 1' to make sure that it is actually
// displayed on the screen. The second transaction is necessary to remove the screen
// blocker (turn on the brightness) only when the content is actually visible as it
// might be presented only in the next frame.
// See b/197538198
transaction
.setFrameTimelineVsync(vsyncId)
.apply()
transaction.setFrameTimelineVsync(vsyncId + 1).apply(/* sync */ true)
Trace.endAsyncSection("UnfoldLightRevealOverlayAnimation#relayout", 0)
callback.run()
}
transaction.setFrameTimelineVsync(vsyncId + 1)
.addTransactionCommittedListener(backgroundExecutor) {
Trace.endAsyncSection("UnfoldLightRevealOverlayAnimation#relayout", 0)
callback.run()
}
.apply()
}
}