Use screen space to calculate snapshot scale
The "frame = calculateSnapshotFrame(crop)" is in snapshot space. So originally the scale only undoes config_highResTaskSnapshotScale. But the purpose is to show on screen, so the target size should be current task size. This also fixes extra x-offset when navigation bar is on left side. The case should draw from 0,0 but the frame from calculateSnapshotFrame will add mSystemBarInsets.left. An example of the various bounds: Snapshot_getTaskSize=2000x1000 (the size when capturing) Snapshot_BufferSize=1600x800 (scaled snapshot) Current_mTaskBounds=3000x1500 (assume screen size is changed) Current_mFrame=3000x1400 (window frame may exclude cutout) Now mTaskBounds is deleted and mFrame is used as the target bounds. Because the purpose is to fill the window container and the snapshot surface can be used for activity and task, the window frame is not important. Besides, it can reduce false alarm of !isAspectRatioMatch from comparing the window frame with snapshot size. Also fix SnapshotDrawerUtilsTest which was not able to run due to inaccessible package-private methods. Bug: 336964874 Test: atest SnapshotDrawerUtilsTest Test: Toggle different screen resolutions and switch between multiple existing tasks. The snapshot of starting window should match the real content. Change-Id: Ia164e35ba71e73dd22ec8ce0dad7d356fe791ced
Loading
Please register or sign in to comment