Package org.robolectric.shadows
Class ShadowAccessibilityService
java.lang.Object
org.robolectric.shadows.ShadowContextWrapper
org.robolectric.shadows.ShadowService
org.robolectric.shadows.ShadowAccessibilityService
@Implements(android.accessibilityservice.AccessibilityService.class) public class ShadowAccessibilityService extends ShadowService
Shadow of AccessibilityService that tracks global actions and provides a mechanism to simulate
the window list.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShadowAccessibilityService.GestureDispatch
Represents a gesture that has been dispatched through the accessibility service. -
Constructor Summary
Constructors Constructor Description ShadowAccessibilityService()
-
Method Summary
Modifier and Type Method Description protected boolean
dispatchGesture(GestureDescription gesture, AccessibilityService.GestureResultCallback callback, Handler handler)
List<ShadowAccessibilityService.GestureDispatch>
getGesturesDispatched()
Returns a list of gestures that have been dispatched.List<Integer>
getGlobalActionsPerformed()
protected List<AccessibilityWindowInfo>
getWindows()
Returns a representation of interactive windows shown on the device screen.protected boolean
performGlobalAction(int action)
void
setCanDispatchGestures(boolean canDispatchGestures)
Sets whether the service is currently able to dispatch gestures.void
setWindows(List<AccessibilityWindowInfo> windowList)
Sets the list of interactive windows shown on the device screen as reported bygetWindows()
Methods inherited from class org.robolectric.shadows.ShadowService
getLastForegroundNotification, getLastForegroundNotificationId, getNotificationShouldRemoved, getStopSelfId, getStopSelfResultId, isForegroundStopped, isLastForegroundNotificationAttached, isStoppedBySelf, onDestroy, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
Methods inherited from class org.robolectric.shadows.ShadowContextWrapper
clearBroadcastIntents, clearNextStartedActivities, clearStartedServices, denyPermissions, denyPermissions, getAllStartedServices, getBroadcastIntents, getBroadcastIntentsForUser, getBroadcastOptions, getNextStartedActivity, getNextStartedActivityForResult, getNextStartedService, getNextStoppedService, grantPermissions, grantPermissions, peekNextStartedActivity, peekNextStartedActivityForResult, peekNextStartedService, removeSystemService
-
Constructor Details
-
ShadowAccessibilityService
public ShadowAccessibilityService()
-
-
Method Details
-
performGlobalAction
-
getGlobalActionsPerformed
-
getWindows
Returns a representation of interactive windows shown on the device screen. Mirrors the values provided to#setWindows(List
. Returns an empty List if not set.) -
dispatchGesture
@Implementation(minSdk=24) protected boolean dispatchGesture(GestureDescription gesture, AccessibilityService.GestureResultCallback callback, Handler handler) -
setWindows
Sets the list of interactive windows shown on the device screen as reported bygetWindows()
-
getGesturesDispatched
Returns a list of gestures that have been dispatched. Gestures are dispatched by callingAccessibilityService.dispatchGesture(android.accessibilityservice.GestureDescription, android.accessibilityservice.AccessibilityService.GestureResultCallback, android.os.Handler)
. -
setCanDispatchGestures
public void setCanDispatchGestures(boolean canDispatchGestures)Sets whether the service is currently able to dispatch gestures. Iffalse
,AccessibilityService.dispatchGesture(android.accessibilityservice.GestureDescription, android.accessibilityservice.AccessibilityService.GestureResultCallback, android.os.Handler)
will returnfalse
.
-