Added in API level 31

DisplayHashResultCallback


interface DisplayHashResultCallback
android.view.displayhash.DisplayHashResultCallback

Use when calling View.generateDisplayHash(String, Rect, Executor,. The callback will only invoke either onDisplayHashResult when the system successfully generated the DisplayHash or onDisplayHashError(int) when it failed.

Summary

Constants
static Int

The bounds used when requesting the hash hash were invalid or empty.

static Int

The hash algorithm sent to generate the hash was invalid.

static Int

The window for the view that requested the hash is no longer around.

static Int

The view that requested the hash is not visible on screen.

static Int

The caller requested to generate the hash too frequently.

static Int

An unknown error occurred.

Public methods
abstract Unit
onDisplayHashError(errorCode: Int)

Callback invoked when android.view.View#generateDisplayHash(String, Rect, Executor, * DisplayHashResultCallback) results in an error and cannot generate a display hash.

abstract Unit

Callback invoked when calling android.view.View#generateDisplayHash(String, Rect, Executor, * DisplayHashResultCallback)

Constants

DISPLAY_HASH_ERROR_INVALID_BOUNDS

Added in API level 31
static val DISPLAY_HASH_ERROR_INVALID_BOUNDS: Int

The bounds used when requesting the hash hash were invalid or empty.

Value: -2

DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM

Added in API level 31
static val DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM: Int

The hash algorithm sent to generate the hash was invalid. This means the value is not one of the supported values in DisplayHashManager.getSupportedHashAlgorithms()

Value: -5

DISPLAY_HASH_ERROR_MISSING_WINDOW

Added in API level 31
static val DISPLAY_HASH_ERROR_MISSING_WINDOW: Int

The window for the view that requested the hash is no longer around. This can happen if the window is getting torn down.

Value: -3

DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN

Added in API level 31
static val DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN: Int

The view that requested the hash is not visible on screen. This could either mean that the view bounds are offscreen, window bounds are offscreen, view is not visible, or window is not visible.

Value: -4

DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS

Added in API level 31
static val DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS: Int

The caller requested to generate the hash too frequently. The caller should try again at a after some time has passed to ensure the system isn't overloaded.

Value: -6

DISPLAY_HASH_ERROR_UNKNOWN

Added in API level 31
static val DISPLAY_HASH_ERROR_UNKNOWN: Int

An unknown error occurred.

Value: -1

Public methods

onDisplayHashResult

Added in API level 31
abstract fun onDisplayHashResult(displayHash: DisplayHash): Unit

Callback invoked when calling android.view.View#generateDisplayHash(String, Rect, Executor, * DisplayHashResultCallback)

Parameters
displayHash DisplayHash: The DisplayHash generated. If the hash cannot be generated, onDisplayHashError(int) will be called instead This value cannot be null.