Answer to the last question

  1. What is the background to synchronous barrier technology?

A: After Android 4.1, Google introduced Vsync (vertical synchronization semaphore) and Choreographer reconfigured the screen refresh logic.

  1. What is the reason for adding synchronous barrier technology to the system?

A: Choreographer uses Handler asynchronous messages to notify screen refreshes, so synchronization barrier technology has been designed to increase the priority of asynchronous message processing over the user’s synchronous messages, ensuring that the screen refreshes in real time.

  1. Which functions of the system are realized by synchronous barrier technology?

A: View refresh. Read on for a detailed process diagram.

directory

Handler Synchronization barrier (I) : What is synchronization barrier

Handler Synchronization barrier (2) : synchronization barrier execution process

Handler Synchronization barrier (3) : the system applies a synchronization barrier

Handler Synchronization barrier (4) : Services apply synchronization barriers

System application of synchronization barrier

View Refresh process diagram

When a request is made to listen to Vsync signals, the synchronous messages in the Handler message queue are blocked, and the asynchronous messages received by Vsync signals are preferentially guaranteed to generate new screen data in time for display on the screen.

Note: Only when the page is refreshed, the Vsync signal will be listened, not always receive Vsync signal.

Next day forecast

  1. What practical business scenarios can be implemented using synchronization barrier technology?