UpdateInfoProvider


public class UpdateInfoProvider extends ContentProvider


A content provider for managing and serving update information for system components. This class interfaces with a SecurityPatchState to fetch update data stored in JSON format and serves it via a content URI. It only supports querying data; insert, delete, and update operations are not supported.

This provider is typically used to expose update information to other applications or components within the system that need access to the latest security updates data. An OTA update client calls registerUpdate() and unregisterUpdate() to add or remove update information to a local store, from which the content provider serves the data to the applications.

Summary

Public constructors

UpdateInfoProvider(
    @NonNull Context context,
    @NonNull String authority,
    SecurityPatchState customSecurityState
)

Public methods

int
delete(@NonNull Uri uri, String selection, String[] selectionArgs)

Unsupported operation.

String

Returns the MIME type of the data at the given URI.

Uri
insert(@NonNull Uri uri, ContentValues values)

Unsupported operation.

boolean

Initializes the content provider.

@NonNull Cursor
query(
    @NonNull Uri uri,
    String[] projection,
    String selection,
    String[] selectionArgs,
    String sortOrder
)

Handles queries for the update information.

final void

Registers information about an available update for the specified component.

final void

Unregisters information about an available update for the specified component.

int
update(
    @NonNull Uri uri,
    ContentValues values,
    String selection,
    String[] selectionArgs
)

Unsupported operation.

Inherited methods

From android.content.ContentProvider
@NonNull ContentProviderResult[]
@NonNull ContentProviderResult[]
void
int
bulkInsert(@NonNull Uri p0, @NonNull ContentValues[] p1)
@Nullable Bundle
@Nullable Bundle
call(
    @NonNull String p0,
    @NonNull String p1,
    @Nullable String p2,
    @Nullable Bundle p3
)
@Nullable Uri
final @NonNull ContentProvider.CallingIdentity
int
void
dump(
    @NonNull FileDescriptor p0,
    @NonNull PrintWriter p1,
    @NonNull String[] p2
)
final @Nullable AttributionSource
final @Nullable String
final @Nullable String
final @Nullable String
final @Nullable Context
final @Nullable PathPermission[]
final @Nullable String
@Nullable String[]
@Nullable String
final @Nullable String
@Nullable Uri
boolean
void
void
void
void
onTrimMemory(int p0)
@Nullable AssetFileDescriptor
@Nullable AssetFileDescriptor
openAssetFile(
    @NonNull Uri p0,
    @NonNull String p1,
    @Nullable CancellationSignal p2
)
@Nullable ParcelFileDescriptor
@Nullable ParcelFileDescriptor
final @NonNull ParcelFileDescriptor
@NonNull ParcelFileDescriptor
<T extends Object> openPipeHelper(
    @NonNull Uri p0,
    @NonNull String p1,
    @Nullable Bundle p2,
    @Nullable T p3,
    @NonNull ContentProvider.PipeDataWriter<@NonNull T> p4
)
@Nullable AssetFileDescriptor
@Nullable AssetFileDescriptor
openTypedAssetFile(
    @NonNull Uri p0,
    @NonNull String p1,
    @Nullable Bundle p2,
    @Nullable CancellationSignal p3
)
@Nullable Cursor
query(
    @NonNull Uri p0,
    @Nullable String[] p1,
    @Nullable Bundle p2,
    @Nullable CancellationSignal p3
)
@Nullable Cursor
query(
    @NonNull Uri p0,
    @Nullable String[] p1,
    @Nullable String p2,
    @Nullable String[] p3,
    @Nullable String p4,
    @Nullable CancellationSignal p5
)
boolean
final @NonNull Context
final void
final void
setPathPermissions(@Nullable PathPermission[] p0)
final void
final void
void
@Nullable Uri
int

Public constructors

UpdateInfoProvider

Added in 1.0.0-alpha01
public UpdateInfoProvider(
    @NonNull Context context,
    @NonNull String authority,
    SecurityPatchState customSecurityState
)
Parameters
@NonNull Context context

The Context of the calling application.

@NonNull String authority

The authority for this content provider, used to construct the base URI.

SecurityPatchState customSecurityState

An optional instance of SecurityPatchState to use. If not provided, a new instance is created.

Public methods

delete

Added in 1.0.0-alpha01
public int delete(@NonNull Uri uri, String selection, String[] selectionArgs)

Unsupported operation. This method will throw an exception if called.

Parameters
@NonNull Uri uri

The URI to delete from.

String selection

The selection criteria to apply.

String[] selectionArgs

Arguments for the selection criteria.

Returns
int

nothing as this operation is not supported.

Throws
kotlin.UnsupportedOperationException

always as this operation is not supported.

getType

Added in 1.0.0-alpha01
public String getType(@NonNull Uri uri)

Returns the MIME type of the data at the given URI. This method only handles the content URI for update data.

Parameters
@NonNull Uri uri

The URI to query for its MIME type.

Returns
String

The MIME type of the data at the specified URI, or null if the URI is not handled by this provider.

insert

Added in 1.0.0-alpha01
public Uri insert(@NonNull Uri uri, ContentValues values)

Unsupported operation. This method will throw an exception if called.

Parameters
@NonNull Uri uri

The URI to query.

ContentValues values

The new values to insert.

Returns
Uri

nothing as this operation is not supported.

Throws
kotlin.UnsupportedOperationException

always as this operation is not supported.

onCreate

Added in 1.0.0-alpha01
public boolean onCreate()

Initializes the content provider. This method sets up the SecurityPatchState used to retrieve update information. If a custom security state is provided during instantiation, it will be used; otherwise, a new one is initialized.

Returns
boolean

true if the provider was successfully created, false otherwise.

query

Added in 1.0.0-alpha01
public @NonNull Cursor query(
    @NonNull Uri uri,
    String[] projection,
    String selection,
    String[] selectionArgs,
    String sortOrder
)

Handles queries for the update information. This method only responds to queries directed at the specific content URI corresponding to update data. It retrieves data from SecurityPatchState, which is then returned as a Cursor.

Parameters
@NonNull Uri uri

The URI to query. This must match the expected content URI for update data.

String[] projection

The list of columns to put into the cursor. If null, all columns are included.

String selection

The selection criteria to apply.

String[] selectionArgs

Arguments for the selection criteria.

String sortOrder

The order in which rows are sorted in the returned Cursor.

Returns
@NonNull Cursor

A Cursor object containing the update data.

Throws
kotlin.IllegalArgumentException

if the provided URI does not match the expected URI for update data.

registerUpdate

Added in 1.0.0-alpha01
public final void registerUpdate(@NonNull UpdateInfo updateInfo)

Registers information about an available update for the specified component.

Parameters
@NonNull UpdateInfo updateInfo

Update information structure.

unregisterUpdate

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

Unregisters information about an available update for the specified component.

Parameters
@NonNull UpdateInfo updateInfo

Update information structure.

update

Added in 1.0.0-alpha01
public int update(
    @NonNull Uri uri,
    ContentValues values,
    String selection,
    String[] selectionArgs
)

Unsupported operation. This method will throw an exception if called.

Parameters
@NonNull Uri uri

The URI to update.

ContentValues values

The new values to apply.

String selection

The selection criteria to apply.

String[] selectionArgs

Arguments for the selection criteria.

Returns
int

nothing as this operation is not supported.

Throws
kotlin.UnsupportedOperationException

always as this operation is not supported.