Added in API level 31

DisplayHashResultCallback


public interface DisplayHashResultCallback

android.view.displayhash.DisplayHashResultCallback


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

Summary

Constants

int DISPLAY_HASH_ERROR_INVALID_BOUNDS

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

int DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM

The hash algorithm sent to generate the hash was invalid.

int DISPLAY_HASH_ERROR_MISSING_WINDOW

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

int DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN

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

int DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS

The caller requested to generate the hash too frequently.

int DISPLAY_HASH_ERROR_UNKNOWN

An unknown error occurred.

Public methods

abstract void onDisplayHashError(int errorCode)

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

abstract void onDisplayHashResult(DisplayHash displayHash)

Callback invoked when calling View.generateDisplayHash(String, Rect, Executor, DisplayHashResultCallback)

Constants

DISPLAY_HASH_ERROR_INVALID_BOUNDS

Added in API level 31
public static final int DISPLAY_HASH_ERROR_INVALID_BOUNDS

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

Constant Value: -2 (0xfffffffe)

DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM

Added in API level 31
public static final int DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM

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

Constant Value: -5 (0xfffffffb)

DISPLAY_HASH_ERROR_MISSING_WINDOW

Added in API level 31
public static final int DISPLAY_HASH_ERROR_MISSING_WINDOW

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

Constant Value: -3 (0xfffffffd)

DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN

Added in API level 31
public static final int DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN

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.

Constant Value: -4 (0xfffffffc)

DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS

Added in API level 31
public static final int DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS

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.

Constant Value: -6 (0xfffffffa)

DISPLAY_HASH_ERROR_UNKNOWN

Added in API level 31
public static final int DISPLAY_HASH_ERROR_UNKNOWN

An unknown error occurred.

Constant Value: -1 (0xffffffff)

Public methods

onDisplayHashError

Added in API level 31
public abstract void onDisplayHashError (int errorCode)

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

Parameters
errorCode int: the error code Value is DISPLAY_HASH_ERROR_UNKNOWN, DISPLAY_HASH_ERROR_INVALID_BOUNDS, DISPLAY_HASH_ERROR_MISSING_WINDOW, DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN, DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM, or DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS

onDisplayHashResult

Added in API level 31
public abstract void onDisplayHashResult (DisplayHash displayHash)

Callback invoked when calling 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.