AssertStorageAction


class AssertStorageAction : 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 functions

open BackupDeviceActionResult

Runs the action payload.

Public properties

open Int

Lifecycle phase when this action runs.

Public constructors

AssertStorageAction

Added in 1.0.0-alpha02
AssertStorageAction()

Public functions

execute

open fun execute(context: Context, args: BackupDeviceActionArgs): BackupDeviceActionResult

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
context: Context

application context on the target device

args: BackupDeviceActionArgs

input arguments passed from the host orchestrator, keyed by BackupActionInputKeys

Returns
BackupDeviceActionResult

result returned to the host, keyed by BackupActionOutputKeys

Public properties

phase

open val phase: Int

Lifecycle phase when this action runs.