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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Cancels bugreport in progress and executesBugreportManager.BugreportCallback.onError(int)
.void
executeOnError
(int errorCode) ExecutesBugreportManager.BugreportCallback.onError(int)
on the provided Executor.void
ExecutesBugreportManager.BugreportCallback.onFinished()
on the provided Executor.void
executeOnProgress
(float progress) ExecutesBugreportManager.BugreportCallback.onProgress(float)
on the provided Executor.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.boolean
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.void
setHasPermission
(boolean hasPermission) Simulates if the calling process has the required permissions to call BugreportManager methods.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.boolean
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
hasPermission
is false,startBugreport(android.os.ParcelFileDescriptor, android.os.ParcelFileDescriptor, android.os.BugreportParams, java.util.concurrent.Executor, android.os.BugreportManager.BugreportCallback)
andcancelBugreport()
will throwSecurityException
. -
getScreenshotFd
Returns the screenshot file descriptor if set withstartBugreport
, else null.
-