Package org.robolectric.shadows
Class ShadowBugreportManager
java.lang.Object
org.robolectric.shadows.ShadowBugreportManager
@Implements(value=android.os.BugreportManager.class,
minSdk=29,
isInAndroidSdk=false)
public class ShadowBugreportManager
extends Object
Implementation of
BugreportManager.
This class is not available in the public Android SDK, but it is available for system apps.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCancels bugreport in progress and executesBugreportManager.BugreportCallback.onError(int).voidexecuteOnError(int errorCode) ExecutesBugreportManager.BugreportCallback.onError(int)on the provided Executor.voidExecutesBugreportManager.BugreportCallback.onFinished()on the provided Executor.voidexecuteOnFinished(String bugreportFile) ExecutesBugreportManager.BugreportCallback.onFinished(String)on the provided Executor.voidexecuteOnProgress(float progress) ExecutesBugreportManager.BugreportCallback.onProgress(float)on the provided Executor.Returns the bug report file descriptor if set withstartBugreportorretrieveBugreport, else null.Returns the screenshot file descriptor if set withstartBugreport, else null.Returns the description of the bugreport if set withrequestBugreport, else null.Returns the title of the bugreport if set withrequestBugreport, else null.booleanprotected voidrequestBugreport(BugreportParams params, CharSequence shareTitle, CharSequence shareDescription) Normally requests the platform/system to take a bugreport and make the final bugreport available to the user.protected voidretrieveBugreport(String bugreportFile, ParcelFileDescriptor bugreportFd, Executor executor, BugreportManager.BugreportCallback callback) voidsetHasPermission(boolean hasPermission) Simulates if the calling process has the required permissions to call BugreportManager methods.protected voidstartBugreport(ParcelFileDescriptor bugreportFd, ParcelFileDescriptor screenshotFd, BugreportParams params, Executor executor, BugreportManager.BugreportCallback callback) Starts a bugreport with which can execute callback methods on the provided executor.booleanReturns true ifrequestBugreport(android.os.BugreportParams, java.lang.CharSequence, java.lang.CharSequence)was called.
-
Constructor Details
-
ShadowBugreportManager
public ShadowBugreportManager()
-
-
Method Details
-
startBugreport
@Implementation protected void startBugreport(ParcelFileDescriptor bugreportFd, ParcelFileDescriptor screenshotFd, BugreportParams params, Executor executor, BugreportManager.BugreportCallback callback) Starts a bugreport with which can execute callback methods on the provided executor.If bugreport already in progress,
BugreportManager.BugreportCallback.onError(int)will be executed. -
requestBugreport
@Implementation(minSdk=30) protected void requestBugreport(BugreportParams params, CharSequence shareTitle, CharSequence shareDescription) Normally requests the platform/system to take a bugreport and make the final bugreport available to the user.This implementation just sets a boolean recording that the method was invoked, and the share title and description.
-
retrieveBugreport
@Implementation(minSdk=34) protected void retrieveBugreport(String bugreportFile, ParcelFileDescriptor bugreportFd, Executor executor, BugreportManager.BugreportCallback callback) -
cancelBugreport
Cancels bugreport in progress and executesBugreportManager.BugreportCallback.onError(int). -
executeOnProgress
public void executeOnProgress(float progress) ExecutesBugreportManager.BugreportCallback.onProgress(float)on the provided Executor. -
executeOnError
public void executeOnError(int errorCode) ExecutesBugreportManager.BugreportCallback.onError(int)on the provided Executor. -
executeOnFinished
public void executeOnFinished()ExecutesBugreportManager.BugreportCallback.onFinished()on the provided Executor. -
executeOnFinished
ExecutesBugreportManager.BugreportCallback.onFinished(String)on the provided Executor. -
isBugreportInProgress
public boolean isBugreportInProgress() -
wasBugreportRequested
public boolean wasBugreportRequested()Returns true ifrequestBugreport(android.os.BugreportParams, java.lang.CharSequence, java.lang.CharSequence)was called. -
setHasPermission
public void setHasPermission(boolean hasPermission) Simulates if the calling process has the required permissions to call BugreportManager methods.If
hasPermissionis false,startBugreport(android.os.ParcelFileDescriptor, android.os.ParcelFileDescriptor, android.os.BugreportParams, java.util.concurrent.Executor, android.os.BugreportManager.BugreportCallback)andcancelBugreport()will throwSecurityException. -
getBugreportFd
Returns the bug report file descriptor if set withstartBugreportorretrieveBugreport, else null. -
getScreenshotFd
Returns the screenshot file descriptor if set withstartBugreport, else null.
-