class UpdateInfoManager


Manages the persistent storage of security update information.

This class acts as the local database for the UpdateInfoService. It is responsible for:

  1. Storing the list of available UpdateInfo objects (persisted in SharedPreferences).

  2. Storing metadata about the update checks (e.g., getLastCheckTimeMillis).

  3. Cleaning up outdated updates by comparing them against the device's current state.

Typical usage involves an update client (like GOTA (Google Over-The-Air) or Play Store) registering new updates via registerUpdate when they are discovered, and the UpdateInfoService querying getAllUpdates to return them to consumers.

Summary

Public constructors

UpdateInfoManager(
    context: Context,
    customSecurityState: SecurityPatchState?
)

Public functions

Long

Retrieves the timestamp of the last successful update check.

Unit

Registers information about an available update for the specified component.

Unit
setLastCheckTimeMillis(timestampMillis: Long)

Updates the timestamp of the last successful update check.

Unit

Unregisters information about an available update for the specified component.

Public constructors

UpdateInfoManager

Added in 1.0.0-alpha02
UpdateInfoManager(
    context: Context,
    customSecurityState: SecurityPatchState? = null
)

Public functions

getLastCheckTimeMillis

Added in 1.0.0-alpha02
fun getLastCheckTimeMillis(): Long

Retrieves the timestamp of the last successful update check.

Returns
Long

The epoch timestamp in milliseconds, or 0L if no check has occurred.

registerUpdate

Added in 1.0.0-alpha02
fun registerUpdate(updateInfo: UpdateInfo): Unit

Registers information about an available update for the specified component.

Parameters
updateInfo: UpdateInfo

Update information structure.

setLastCheckTimeMillis

Added in 1.0.0-alpha02
fun setLastCheckTimeMillis(timestampMillis: Long): Unit

Updates the timestamp of the last successful update check.

This should be called by the UpdateInfoService immediately after a successful synchronization with the backend.

Parameters
timestampMillis: Long

The current epoch timestamp in milliseconds.

unregisterUpdate

Added in 1.0.0-alpha02
fun unregisterUpdate(updateInfo: UpdateInfo): Unit

Unregisters information about an available update for the specified component.

Parameters
updateInfo: UpdateInfo

Update information structure.