Submodules module

Module for the BaseService.

class, configs=None)[source]

Bases: abc.ABC

Base class of a Mobly AndroidDevice service.

This class defines the interface for Mobly’s AndroidDevice service.


String, alias used to register this service with service manager.

This can be None if the service is never registered.


Creates excerpts of the service’s output files.

[Optional] This method only applies to services with output files.

For services that generates output files, calling this method would create excerpts of the output files. An excerpt should contain info between two calls of create_output_excerpts or from the start of the service to the call to create_output_excerpts.

Use AndroidDevice#generate_filename to get the proper filenames for excerpts.

This is usually called at the end of: setup_class, teardown_test, or teardown_class.

Parameters:test_info – RuntimeTestInfo, the test info associated with the scope of the excerpts.
List of strings, the absolute paths to the excerpt files created.
Empty list if no excerpt files are created.

True if the service is active; False otherwise.


Pauses a service temporarily.

For when the Python service object needs to temporarily lose connection to the device without shutting down the service running on the actual device.

This is relevant when a service needs to maintain a constant connection to the device and the connection is lost if USB connection to the device is disrupted.

E.g. a services that utilizes a socket connection over adb port forwarding would need to implement this for the situation where the USB connection to the device will be temporarily cut, but the device is not rebooted.

For more context, see: mobly.controllers.android_device.AndroidDevice.handle_usb_disconnect

If not implemented, we assume the service is not sensitive to device disconnect, and stop will be called by default.


Resumes a paused service.

Same context as the pause method. This should resume the service after the connection to the device has been re-established.

If not implemented, we assume the service is not sensitive to device disconnect, and start will be called by default.


Starts the service.


Stops the service and cleans up all resources.

This method should handle any error and not throw. module module module

Module contents