BackupDeviceAction


public interface BackupDeviceAction

Known direct subclasses
AssertStorageAction

Asserts the correctness of restored test data.

PopulateStorageAction

Populates test data inside the application sandbox before a backup.


Runs an action inside the application sandbox on the target device.

Implementations must provide a public no-arg constructor to enable dynamic instantiation.

An action reads its configuration from BackupDeviceActionArgs, whose documented keys are listed in BackupActionInputKeys, and reports its outcome through BackupDeviceActionResult, whose documented keys are listed in BackupActionOutputKeys. Build the outcome with BackupDeviceActionResult.success or BackupDeviceActionResult.failure so that the host can tell the two apart.

Summary

Constants

default static final int

Seeds data inside the application sandbox before a backup.

default static final int

Verifies restored data inside the application sandbox after a restore.

Public methods

abstract @NonNull BackupDeviceActionResult

Runs the action payload.

abstract int

Lifecycle phase when this action runs.

Constants

PHASE_POPULATE

Added in 1.0.0-alpha02
default static final int PHASE_POPULATE = 1

Seeds data inside the application sandbox before a backup.

PHASE_VERIFY

Added in 1.0.0-alpha02
default static final int PHASE_VERIFY = 2

Verifies restored data inside the application sandbox after a restore.

Public methods

execute

Added in 1.0.0-alpha02
abstract @NonNull BackupDeviceActionResult execute(@NonNull Context context, @NonNull BackupDeviceActionArgs args)

Runs the action payload.

Implementations should report a recoverable problem, such as a missing argument or a failed assertion, by returning BackupDeviceActionResult.failure rather than by throwing. The host treats a thrown exception as a crash of the action and reports it with a stack trace.

Parameters
@NonNull Context context

application context on the target device

@NonNull BackupDeviceActionArgs args

input arguments passed from the host orchestrator, keyed by BackupActionInputKeys

Returns
@NonNull BackupDeviceActionResult

result returned to the host, keyed by BackupActionOutputKeys

getPhase

Added in 1.0.0-alpha02
abstract int getPhase()

Lifecycle phase when this action runs.