Added in API level 30

ScreenshotResult

class ScreenshotResult
kotlin.Any
   ↳ android.accessibilityservice.AccessibilityService.ScreenshotResult

Can be used to construct a bitmap of the screenshot or any other operations for AccessibilityService#takeScreenshot API.

Summary

Public methods
ColorSpace

Gets the ColorSpace identifying a specific organization of colors of the screenshot.

HardwareBuffer

Gets the HardwareBuffer representing a memory buffer of the screenshot.

Long

Gets the timestamp of taking the screenshot.

Public methods

getColorSpace

Added in API level 30
fun getColorSpace(): ColorSpace

Gets the ColorSpace identifying a specific organization of colors of the screenshot.

Return
ColorSpace the color space This value cannot be null.

getHardwareBuffer

Added in API level 30
fun getHardwareBuffer(): HardwareBuffer

Gets the HardwareBuffer representing a memory buffer of the screenshot.

Note: The application should call HardwareBuffer#close() when the buffer is no longer needed to free the underlying resources.

Return
HardwareBuffer the hardware buffer This value cannot be null.

getTimestamp

Added in API level 30
fun getTimestamp(): Long

Gets the timestamp of taking the screenshot.

Return
Long milliseconds of non-sleep uptime before screenshot since boot and it's from SystemClock#uptimeMillis()