Restores a capture rate limit for long screenshots
A previous change accidentally lost this delay between incremental screen captures. This rate limit is needed to prevent pushing screen capture faster than it can render correctly. Bug: 173700533 Bug: 217046739 Test: manual; long screenshot, observe app systrace Change-Id: Ibd7940299b502c40212957395d272b6e52cc28be
This commit is contained in:
@@ -76,6 +76,7 @@ public class ScrollCaptureViewSupport<V extends View> implements ScrollCaptureCa
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
mPostScrollDelayMillis = Settings.Global.getLong(contentResolver,
|
||||
SETTING_CAPTURE_DELAY, SETTING_CAPTURE_DELAY_DEFAULT);
|
||||
Log.d(TAG, "screenshot.scroll_capture_delay = " + mPostScrollDelayMillis);
|
||||
}
|
||||
|
||||
/** Based on ViewRootImpl#updateColorModeIfNeeded */
|
||||
@@ -271,6 +272,13 @@ public class ScrollCaptureViewSupport<V extends View> implements ScrollCaptureCa
|
||||
Rect viewCaptureArea = new Rect(scrollResult.availableArea);
|
||||
viewCaptureArea.offset(0, -scrollResult.scrollDelta);
|
||||
|
||||
view.postOnAnimationDelayed(
|
||||
() -> doCapture(scrollResult, view, viewCaptureArea, onComplete),
|
||||
mPostScrollDelayMillis);
|
||||
}
|
||||
|
||||
private void doCapture(ScrollResult scrollResult, V view, Rect viewCaptureArea,
|
||||
Consumer<Rect> onComplete) {
|
||||
int result = mRenderer.renderView(view, viewCaptureArea);
|
||||
if (result == HardwareRenderer.SYNC_OK
|
||||
|| result == HardwareRenderer.SYNC_REDRAW_REQUESTED) {
|
||||
|
||||
Reference in New Issue
Block a user