# BugreportManager

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/os/BugreportManager#nestedclasses)\|[Methods](https://developer.android.com/reference/android/os/BugreportManager#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/os/BugreportManager#inhmethods)  

# BugreportManager

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/os/BugreportManager "View this page in Kotlin")\|Java

`
public

final

class
BugreportManager
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.os.BugreportManager |

<br />

*** ** * ** ***

Class that provides a privileged API to capture and consume bugreports.

This class may only be used by apps that currently have carrier privileges (see[TelephonyManager.hasCarrierPrivileges()](https://developer.android.com/reference/android/telephony/TelephonyManager#hasCarrierPrivileges())) on an active SIM or priv-apps explicitly allowed by the device manufacturer.

Only one bugreport can be generated by the system at a time.  
Restricted for SDK Runtime environment in API level 34.

## Summary

|                                                                                              ### Nested classes                                                                                               ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [BugreportManager.BugreportCallback](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback) An interface describing the callback for bugreport progress and status. |

|                                                                                                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                                                                                                  ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[cancelBugreport](https://developer.android.com/reference/android/os/BugreportManager#cancelBugreport())`() ` Cancels the currently running bugreport.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void` | ` `[startConnectivityBugreport](https://developer.android.com/reference/android/os/BugreportManager#startConnectivityBugreport(android.os.ParcelFileDescriptor,%20java.util.concurrent.Executor,%20android.os.BugreportManager.BugreportCallback))`(`[ParcelFileDescriptor](https://developer.android.com/reference/android/os/ParcelFileDescriptor)` bugreportFd, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor, `[BugreportManager.BugreportCallback](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback)` callback) ` Starts a connectivity bugreport. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public methods

### cancelBugreport

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void cancelBugreport ()
```

Cancels the currently running bugreport.

Apps are only able to cancel their own bugreports. App A cannot cancel a bugreport started by app B.

Requires permission:[Manifest.permission.DUMP](https://developer.android.com/reference/android/Manifest.permission#DUMP)or that the calling app has carrier privileges (see[TelephonyManager.hasCarrierPrivileges()](https://developer.android.com/reference/android/telephony/TelephonyManager#hasCarrierPrivileges())) on any active subscription.  
This method may take several seconds to complete, so it should only be called from a worker thread.

<br />

|                                                                      Throws                                                                       ||
|------------------------------------------------------------------------------------------|---------------------------------------------------------|
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | if trying to cancel another app's bugreport in progress |

### startConnectivityBugreport

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void startConnectivityBugreport (ParcelFileDescriptor bugreportFd, 
                Executor executor, 
                BugreportManager.BugreportCallback callback)
```

Starts a connectivity bugreport.

The connectivity bugreport is a specialized version of bugreport that only includes information specifically for debugging connectivity-related issues (e.g. telephony, wi-fi, and IP networking issues). It is intended primarily for use by OEMs and network providers such as mobile network operators. In addition to generally excluding information that isn't targeted to connectivity debugging, this type of bugreport excludes PII and sensitive information that isn't strictly necessary for connectivity debugging.

The calling app MUST have a context-specific reason for requesting a connectivity bugreport, such as detecting a connectivity-related issue. This API SHALL NOT be used to perform random sampling from a fleet of public end-user devices.

Calling this API will cause the system to ask the user for consent every single time. The bugreport artifacts will be copied over to the given file descriptors only if the user consents to sharing with the calling app.

This starts a bugreport in the background. However the call itself can take several seconds to return in the worst case.`callback`will receive progress and status updates.

Requires that the calling app has carrier privileges (see[TelephonyManager.hasCarrierPrivileges()](https://developer.android.com/reference/android/telephony/TelephonyManager#hasCarrierPrivileges())) on any active subscription.  
This method may take several seconds to complete, so it should only be called from a worker thread.

<br />

|                                                                                                                                                                                                                                                                                                 Parameters                                                                                                                                                                                                                                                                                                 ||
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `bugreportFd` | `ParcelFileDescriptor`: file to write the bugreport. This should be opened in write-only, append mode. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `executor`    | `Executor`: This value cannot be`null`. Callback and listener events are dispatched through this[Executor](https://developer.android.com/reference/java/util/concurrent/Executor), providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use[Context.getMainExecutor()](https://developer.android.com/reference/android/content/Context#getMainExecutor()). Otherwise, provide an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)that dispatches to an appropriate thread. <br /> |
| `callback`    | `BugreportManager.BugreportCallback`: callback for progress and status updates. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |