BugreportManager.BugreportCallback


public static abstract class BugreportManager.BugreportCallback
extends Object

java.lang.Object
   ↳ android.os.BugreportManager.BugreportCallback


An interface describing the callback for bugreport progress and status.

Callers will receive onProgress(float) calls as the bugreport progresses, followed by a terminal call to either onFinished() or onError(int).

If an issue is encountered while starting the bugreport asynchronously, callers will receive an onError(int) call without any onProgress(float) callbacks.

Summary

Constants

int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS

There is currently a bugreport running.

int BUGREPORT_ERROR_INVALID_INPUT

The input options were invalid.

int BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

There is no bugreport to retrieve for the caller.

int BUGREPORT_ERROR_RUNTIME

A runtime error occurred.

int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT

The request to get user consent timed out.

int BUGREPORT_ERROR_USER_DENIED_CONSENT

User denied consent to share the bugreport.

Public constructors

BugreportCallback()

Public methods

void onEarlyReportFinished()

Called when it is ready for calling app to show UI, showing any extra UI before this callback can interfere with bugreport generation.

void onError(int errorCode)

Called when taking bugreport resulted in an error.

void onFinished()

Called when taking bugreport finishes successfully.

void onProgress(float progress)

Called when there is a progress update.

Inherited methods

Constants

BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS

Added in API level 31
public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS

There is currently a bugreport running. The caller should try again later.

Constant Value: 5 (0x00000005)

BUGREPORT_ERROR_INVALID_INPUT

Added in API level 31
public static final int BUGREPORT_ERROR_INVALID_INPUT

The input options were invalid. For example, the destination file the app provided could not be written by the system.

Constant Value: 1 (0x00000001)

BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

Added in API level 34
public static final int BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

There is no bugreport to retrieve for the caller.

Constant Value: 6 (0x00000006)

BUGREPORT_ERROR_RUNTIME

Added in API level 31
public static final int BUGREPORT_ERROR_RUNTIME

A runtime error occurred.

Constant Value: 2 (0x00000002)

Added in API level 31
public static final int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT

The request to get user consent timed out.

Constant Value: 4 (0x00000004)

Added in API level 31
public static final int BUGREPORT_ERROR_USER_DENIED_CONSENT

User denied consent to share the bugreport.

Constant Value: 3 (0x00000003)

Public constructors

BugreportCallback

public BugreportCallback ()

Public methods

onEarlyReportFinished

Added in API level 31
public void onEarlyReportFinished ()

Called when it is ready for calling app to show UI, showing any extra UI before this callback can interfere with bugreport generation.

onError

Added in API level 31
public void onError (int errorCode)

Called when taking bugreport resulted in an error.

If BUGREPORT_ERROR_USER_DENIED_CONSENT is passed, then the user did not consent to sharing the bugreport with the calling app.

If BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT is passed, then the consent timed out, but the bugreport could be available in the internal directory of dumpstate for manual retrieval.

If BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS is passed, then the caller should try later, as only one bugreport can be in progress at a time.

Parameters
errorCode int: Value is BUGREPORT_ERROR_INVALID_INPUT, BUGREPORT_ERROR_RUNTIME, BUGREPORT_ERROR_USER_DENIED_CONSENT, BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT, BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS, or BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

onFinished

Added in API level 31
public void onFinished ()

Called when taking bugreport finishes successfully.

This callback will be invoked if the BugreportParams#BUGREPORT_FLAG_DEFER_CONSENT flag is not set.

onProgress

Added in API level 31
public void onProgress (float progress)

Called when there is a progress update.

Parameters
progress float: the progress in [0.0, 100.0] Value is between 0f and 100f inclusive