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 Constructor Description ShadowBugreportManager() -
Method Summary
Modifier and Type Method Description protected voidcancelBugreport()Cancels bugreport in progress and executesBugreportManager.BugreportCallback.onError(int).voidexecuteOnError(int errorCode)ExecutesBugreportManager.BugreportCallback.onError(int)on the provided Executor.voidexecuteOnFinished()ExecutesBugreportManager.BugreportCallback.onFinished()on the provided Executor.voidexecuteOnProgress(float progress)ExecutesBugreportManager.BugreportCallback.onProgress(float)on the provided Executor.CharSequencegetShareDescription()Returns the description of the bugreport if set withrequestBugreport, else null.CharSequencegetShareTitle()Returns the title of the bugreport if set withrequestBugreport, else null.booleanisBugreportInProgress()protected 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.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.booleanwasBugreportRequested()Returns 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.
-
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. -
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. -
getShareTitle
Returns the title of the bugreport if set withrequestBugreport, else null. -
getShareDescription
Returns the description of the bugreport if set withrequestBugreport, else null.
-