SmartphoneDeploymentExecutor
Runs a SmartphoneDeployment: the root of the executor tree of a study.
Each SmartphoneStudyController owns one. On initialize it creates a TaskControlExecutor for each task control in the deployment and tells the target device's DeviceManager about it. You rarely use it directly; go through SmartphoneStudyController instead.
Key points:
- Task controls with an AppTask and a Schedulable trigger get an AppTaskControlExecutor; MonitoringTasks get no executor.
- measurements merges all measurements of the deployment and adds a CompletedAppTask measurement each time a UserTask is done.
- On resume, each task control is resumed or paused according to the sampling state set with setSamplingState, if any. Then the buffered app tasks are enqueued in the AppTaskController.
See also Executor for the lifecycle.
- Inheritance
-
- Object
- AbstractExecutor<
SmartphoneDeployment> - AggregateExecutor<
SmartphoneDeployment> - SmartphoneDeploymentExecutor
Constructors
SmartphoneDeploymentExecutor
Properties
probes
All probes in this deployment executor. May be empty.
samplingState
The runtime sampling state of this executor.
Methods
addMeasurements
- Stream<
Measurement> measurements
Adds measurements to the measurements of this deployment executor.
Used for executors outside the tree, e.g. app tasks restored by the AppTaskController.
clearSamplingStatus
Clears the state set with setSamplingState.
The next resume then resumes all task controls.
getDeviceManagerFromRoleName
- String? roleName
Returns the DeviceManager of the device with roleName.
Works for both the primary device and connected devices. Returns null if no device with roleName is found.
lookupProbe
Returns all probes of data type. Returns an empty list if none are found.
onDispose
Callback when this executor is disposed.
Subclasses should override this, to implement any cleanup to be done before disposing.
onInitialize
Called by initialize. Returns true if successfully initialized.
If false, the executor stays in ExecutorState.Created. This is a synchronous method and must be light-weight.
onResume
Resumes sampling based on the samplingState of the deployment.
If the prior samplingState is unknown (null), it simply resumes all executors. If the prior samplingState is known, it resumes or pauses the executors based on the state of each TaskControlExecutor in the samplingState.
Finally, the method enqueues all app tasks buffered in the AppTaskController.
setSamplingState
- SmartphoneDeploymentExecutorSamplingState? samplingState
Sets the sampling state to restore on the next resume.
E.g. the state saved before the app was restarted. Does not change the current samplingState, which is always computed from the running executors.