Thursday, August 24, 2017

Task Snapshots Brings Accurate and High Quality Thumbnails in Recents Overview to Android 8.0 Oreo

Android 8.0 Oreo will remain the talking point for the next few days, as more and more developers and tinkerers get their chance to dive deep into the source code and accompanying documentations to figure out all that has changed and improved in the newest Android update. One of these changes is Task Snapshots, a small improvement that most users would never notice, but one that nevertheless improves upon the Android experience.

Task Snapshots is an infrastructure addition introduced in Android 8.0 that combines screenshots for Recents Thumbnails as well as Saved Surfaces. Recents Thumbnails represents the last state of a task in the Recents view, while Saved Surface were those surfaces that were preserved by the Window Manager when an activity went into a stopped state as long as the activity was on top of the task.

These two concepts are now unified with Task Snapshots. As Android 8.0's documentation explains it:

When a task goes into background, Window Manager places a screenshot of this task into a GraphicBuffer. As long as the application of the top activity of the task stays in memory, this GraphicBuffer will be retained in memory. Now, when the same activity is brought to the front again, Window Manager will create a starting window (TaskSnapshotSurface), and attach the GraphicBuffer without copying any memory to the buffer queue of the starting window. As soon as the activity has drawn its first frame, the Task Snapshot starting window will fade out smoothly like regular splash screens.

The same GraphicBuffer is also sent over Binder to SystemUI to be used to draw the preview state of a task in the Recents view. Since this is just a reference to a buffer, sending it over binder expends few resources. When the GraphicBuffer arrives at SystemUI, it is wrapped into a hardware Bitmap and then drawn onto the screen without any memory uploading to the graphics memory.

In simpler words, the Window Manager takes a screenshot of your most recently active task when you switch out of the app. This screenshot is retained as long as the app remains in memory, and the screenshot is also utilized to display the app's state in the Recents overview.

Google states a threefold benefit to utilizing Tasks Snapshots:

  • Smoother animation when moving from snapshot to the real app through the Recents overview screen.
  • Reduced memory usage as a few steps previously needed are now skipped.
  • Higher quality images in Recents overview which accurately reflect the state you'll first see when reopening the app. Previously, these images were downsampled by 64% to save memory.

Tasks Snapshots is active by default in Android 8.0 Oreo and requires no further integration or customization. Device manufacturers can however, choose to disable the feature entirely. If the feature is disabled, the Recents view will not show any thumbnails whatsoever. This feature is automatically disabled on low-RAM devices, though the documentation does not define the threshold that is used in this case.

What are your thoughts on Tasks Snapshots? What other improvements does Android's Recents Overview screen need? Let us know in the comments below!


Source: Android Source Documentation



from xda-developers http://ift.tt/2w20g8V
via IFTTT

No comments:

Post a Comment