public final 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(
    @NonNull Context context,
    SecurityPatchState customSecurityState
)

Public methods

final long

Retrieves the timestamp of the last successful update check.

final void

Registers information about an available update for the specified component.

final void
setLastCheckTimeMillis(long timestampMillis)

Updates the timestamp of the last successful update check.

final void

Unregisters information about an available update for the specified component.

Public constructors

UpdateInfoManager

Added in 1.0.0-alpha02
public UpdateInfoManager(
    @NonNull Context context,
    SecurityPatchState customSecurityState
)

Public methods

getLastCheckTimeMillis

Added in 1.0.0-alpha02
public final long getLastCheckTimeMillis()

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
public final void registerUpdate(@NonNull UpdateInfo updateInfo)

Registers information about an available update for the specified component.

Parameters
@NonNull UpdateInfo updateInfo

Update information structure.

setLastCheckTimeMillis

Added in 1.0.0-alpha02
public final void setLastCheckTimeMillis(long timestampMillis)

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
long timestampMillis

The current epoch timestamp in milliseconds.

unregisterUpdate

Added in 1.0.0-alpha02
public final void unregisterUpdate(@NonNull UpdateInfo updateInfo)

Unregisters information about an available update for the specified component.

Parameters
@NonNull UpdateInfo updateInfo

Update information structure.