[Magnifier-21] Rate-limit drawings to renderer
Previously, we would make a renderer draw whenever a pixel copy completes. Because of this happening more than once per view frame, magnifier frames were being dropped or queued up and displayed later, which was consequently leading to the magnifier movement getting out of sync with the updates to its content. This CL changes the magnifier to be rendered from a draw job post'd to the UI thread queue. This way, multiple magnifier updates (the ones already pending in the UI thread queue when the draw job is added) are batched together in a single draw, naturally rate-limiting the draws we send to the magnifier renderer by the number of frames of the magnified view - this only holds when the user of the magnifier sends updates as a result of user interaction or when the magnified view is drawn. Also, previously the pixel copy finished events were post'd to the UI thread. Since they were not post'd as async messages, they would have to wait at frame barriers before being executed. This CL creates a dedicated thread for them to be post'd, to avoid this from happening. Bug: 72041926 Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest Change-Id: I89563a341a74e958f903eff2d470c6c33fb203ef
Loading
Please register or sign in to comment