Only cache low-resolution task snapshots in the system server.(5/N)
This change reduces both heap and dma_buf usage in the system server by replacing high-resolution snapshots in the cache with low-resolution: 1. After a low-resolution bitmap is created in the persist thread, a new task snapshot object is created from it. This then replaces the previous high-resolution snapshot in the snapshot cache. 2. When getTaskSnapshot is called with a low-resolution request, a low-resolution snapshot is either retrieved or created from the latest task snapshot (if it exists). This replaces the high-resolution snapshot in the snapshot cache. By respect the request, this also reduce the memory usage in the client process since the returned snapshot is smaller than the high-resolution one. To prevent duplicate tasks resulting from both scenarios (1 and 2), the second put-to-cache task can be ignored if the convert already occurred. 3. Support takeTaskSnapshot to return a low-resolution snapshot, which will be useful when clients request a snapshot but specifically require a lower-resolution version. Flag: com.android.window.flags.reduce_task_snapshot_memory_usage Flag: com.android.window.flags.respect_requested_task_snapshot_resolution Bug: 238206323 Test: dumpsys window every time after a close task transition finish, verify the resolution in task snapshot cache is low-resolution. dump dmabuf everytime after a close task transition finish, verify the dmabuf won't increase in system server. Change-Id: I37ebbef4f75a86c952f8e633fdbc8aedaf5b3d69
Loading
Please register or sign in to comment