Package org.robolectric.shadows
Class ShadowUiAutomation
java.lang.Object
org.robolectric.shadows.ShadowUiAutomation
Shadow for
UiAutomation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgrantRuntimePermission(String packageName, String permission) static booleaninjectInputEvent(InputEvent event) Injects a motion event into the appropriate window, seeUiAutomation.injectInputEvent(InputEvent, boolean).protected booleaninjectInputEvent(InputEvent event, boolean sync) protected voidsetAnimationScale(float scale) static voidsetAnimationScaleCompat(float scale) Sets the animation scale, seeUiAutomation.setAnimationScale(float).protected booleansetRotation(int rotation) protected BitmapReal Android will via a series of IPCs that eventually obtain an image from SurfaceFlinger.protected void
-
Constructor Details
-
ShadowUiAutomation
public ShadowUiAutomation()
-
-
Method Details
-
setAnimationScaleCompat
public static void setAnimationScaleCompat(float scale) Sets the animation scale, seeUiAutomation.setAnimationScale(float). Provides backwards compatible access to SDKs invalid input: '<' T. -
grantRuntimePermission
@Implementation(minSdk=28) protected void grantRuntimePermission(String packageName, String permission) -
setAnimationScale
-
setRotation
-
throwIfNotConnectedLocked
-
takeScreenshot
Real Android will via a series of IPCs that eventually obtain an image from SurfaceFlinger.Since Robolectric doesn't run any of those backend services, this shadow simulates the result by capturing an image from each active Window listed in WindowManager, and stiches them together into a resuting image.
Also unlike real Android, this method can be called from on and outside the main Looper thread.
- Returns:
- a Bitmap of the display
- Throws:
Exception
-
injectInputEvent
Injects a motion event into the appropriate window, seeUiAutomation.injectInputEvent(InputEvent, boolean). This can be used through theUiAutomationAPI, this method is provided for backwards compatibility with SDK invalid input: '<' 18. -
injectInputEvent
-