AssertStorageAction


public final class AssertStorageAction implements BackupDeviceAction


Asserts the correctness of restored test data.

Parses the configuration from BackupDeviceActionArgs and verifies android.content.SharedPreferences, SQLite databases, or raw file contents in credential-encrypted or device-protected storage. See androidx.test.backup.BackupActionInputKeys for the keys each storage type consumes.

A mismatch is reported as BackupDeviceActionResult.failure carrying the expected and the actual value, not as a thrown exception.

Summary

Public constructors

Public methods

@NonNull BackupDeviceActionResult

Runs the action payload.

int

Lifecycle phase when this action runs.

Public constructors

AssertStorageAction

Added in 1.0.0-alpha02
public AssertStorageAction()

Public methods

execute

public @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

public int getPhase()

Lifecycle phase when this action runs.