Added in API level 31

BugreportCallback


abstract class BugreportCallback
kotlin.Any
   ↳ android.os.BugreportManager.BugreportCallback

An interface describing the callback for bugreport progress and status.

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

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

Summary

Constants
static Int

There is currently a bugreport running.

static Int

The input options were invalid.

static Int

There is no bugreport to retrieve for the caller.

static Int

A runtime error occurred.

static Int

The request to get user consent timed out.

static Int

User denied consent to share the bugreport.

Public constructors

Public methods
open Unit

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

open Unit
onError(errorCode: Int)

Called when taking bugreport resulted in an error.

open Unit

Called when taking bugreport finishes successfully.

open Unit
onProgress(progress: Float)

Called when there is a progress update.

Constants

BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS

Added in API level 31
static val BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS: Int

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

Value: 5

BUGREPORT_ERROR_INVALID_INPUT

Added in API level 31
static val BUGREPORT_ERROR_INVALID_INPUT: Int

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

Value: 1

BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

Added in API level 34
static val BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE: Int

There is no bugreport to retrieve for the caller.

Value: 6

BUGREPORT_ERROR_RUNTIME

Added in API level 31
static val BUGREPORT_ERROR_RUNTIME: Int

A runtime error occurred.

Value: 2
Added in API level 31
static val BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT: Int

The request to get user consent timed out.

Value: 4
Added in API level 31
static val BUGREPORT_ERROR_USER_DENIED_CONSENT: Int

User denied consent to share the bugreport.

Value: 3

Public constructors

BugreportCallback

BugreportCallback()

Public methods

onEarlyReportFinished

Added in API level 31
open fun onEarlyReportFinished(): Unit

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
open fun onError(errorCode: Int): Unit

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 android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_INVALID_INPUT, android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_RUNTIME, android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_DENIED_CONSENT, android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT, android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS, or android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

onFinished

Added in API level 31
open fun onFinished(): Unit

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
open fun onProgress(progress: Float): Unit

Called when there is a progress update.

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