Stay organized with collections
Save and categorize content based on your preferences.
BugreportManager
class BugreportManager
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 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 |
abstract |
An interface describing the callback for bugreport progress and status.
|
Public methods |
Unit |
Cancels the currently running bugreport.
|
Unit |
Starts a connectivity bugreport.
|
Public methods
cancelBugreport
fun cancelBugreport(): Unit
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: android.Manifest.permission#DUMP
or that the calling app has carrier privileges (see 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.
Exceptions |
java.lang.SecurityException |
if trying to cancel another app's bugreport in progress |
startConnectivityBugreport
fun startConnectivityBugreport(
bugreportFd: ParcelFileDescriptor,
executor: Executor,
callback: BugreportManager.BugreportCallback
): Unit
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 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.
Parameters |
bugreportFd |
ParcelFileDescriptor: file to write the bugreport. This should be opened in write-only, append mode. This value cannot be null . |
callback |
BugreportManager.BugreportCallback: callback for progress and status updates. This value cannot be null . |
executor |
Executor: This value cannot be null . Callback and listener events are dispatched through this 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() . Otherwise, provide an Executor that dispatches to an appropriate thread. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[null,null,["Last updated 2025-08-20 UTC."],[],[],null,["# BugreportManager\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBugreportManager\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/BugreportManager \"View this page in Java\") \n\n```\nclass BugreportManager\n```\n\n|---|----------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.os.BugreportManager](#) |\n\nClass that provides a privileged API to capture and consume bugreports.\n\nThis class may only be used by apps that currently have carrier privileges (see [android.telephony.TelephonyManager#hasCarrierPrivileges](../telephony/TelephonyManager.html#hasCarrierPrivileges())) on an active SIM or priv-apps explicitly allowed by the device manufacturer.\n\nOnly one bugreport can be generated by the system at a time. \nRestricted for SDK Runtime environment in API level 34.\n\nSummary\n-------\n\n| Nested classes ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract | [BugreportCallback](/reference/kotlin/android/os/BugreportManager.BugreportCallback) An interface describing the callback for bugreport progress and status. |\n\n| Public methods ||\n|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [cancelBugreport](#cancelBugreport())`()` Cancels the currently running bugreport. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [startConnectivityBugreport](#startConnectivityBugreport(android.os.ParcelFileDescriptor,%20java.util.concurrent.Executor,%20android.os.BugreportManager.BugreportCallback))`(`bugreportFd:` `[ParcelFileDescriptor](/reference/kotlin/android/os/ParcelFileDescriptor)`, `executor:` `[Executor](../../java/util/concurrent/Executor.html#)`, `callback:` `[BugreportManager.BugreportCallback](/reference/kotlin/android/os/BugreportManager.BugreportCallback)`)` Starts a connectivity bugreport. |\n\nPublic methods\n--------------\n\n### cancelBugreport\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun cancelBugreport(): Unit\n```\n\nCancels the currently running bugreport.\n\nApps are only able to cancel their own bugreports. App A cannot cancel a bugreport started by app B.\n\nRequires permission: [android.Manifest.permission#DUMP](../Manifest.permission.html#DUMP:kotlin.String) or that the calling app has carrier privileges (see [android.telephony.TelephonyManager#hasCarrierPrivileges](../telephony/TelephonyManager.html#hasCarrierPrivileges())) on any active subscription. \nThis method may take several seconds to complete, so it should only be called from a worker thread.\n\n| Exceptions ||\n|-------------------------------|---------------------------------------------------------|\n| `java.lang.SecurityException` | if trying to cancel another app's bugreport in progress |\n\n### startConnectivityBugreport\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun startConnectivityBugreport(\n bugreportFd: ParcelFileDescriptor, \n executor: Executor, \n callback: BugreportManager.BugreportCallback\n): Unit\n```\n\nStarts a connectivity bugreport.\n\nThe 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.\n\nThe 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.\n\nCalling 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.\n\nThis 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.\n\nRequires that the calling app has carrier privileges (see [android.telephony.TelephonyManager#hasCarrierPrivileges](../telephony/TelephonyManager.html#hasCarrierPrivileges())) on any active subscription. \nThis method may take several seconds to complete, so it should only be called from a worker thread.\n\n| Parameters ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `bugreportFd` | [ParcelFileDescriptor](/reference/kotlin/android/os/ParcelFileDescriptor): file to write the bugreport. This should be opened in write-only, append mode. This value cannot be `null`. |\n| `callback` | [BugreportManager.BugreportCallback](/reference/kotlin/android/os/BugreportManager.BugreportCallback): callback for progress and status updates. This value cannot be `null`. |\n| `executor` | [Executor](../../java/util/concurrent/Executor.html#): This value cannot be `null`. Callback and listener events are dispatched through this [Executor](../../java/util/concurrent/Executor.html#), 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()](../content/Context.html#getMainExecutor()). Otherwise, provide an [Executor](../../java/util/concurrent/Executor.html#) that dispatches to an appropriate thread. |"]]