UpdateInfoProvider


open class UpdateInfoProvider : 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 by OTA or other update client to expose update information to other applications or components within the system that need access to the latest security updates data. The 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. To setup the content provider add following snippet to the client's manifest, replacing com.example with correct namespace:




Summary

Public constructors

UpdateInfoProvider(
    context: Context,
    authority: String,
    customSecurityState: SecurityPatchState?
)

Public functions

open Int
delete(uri: Uri, selection: String?, selectionArgs: Array<String>?)

Unsupported operation.

open String?
getType(uri: Uri)

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

open Uri?
insert(uri: Uri, values: ContentValues?)

Unsupported operation.

open Boolean

Initializes the content provider.

open Cursor
query(
    uri: Uri,
    projection: Array<String>?,
    selection: String?,
    selectionArgs: Array<String>?,
    sortOrder: String?
)

Handles queries for the update information.

Unit

Registers information about an available update for the specified component.

Unit

Unregisters information about an available update for the specified component.

open Int
update(
    uri: Uri,
    values: ContentValues?,
    selection: String?,
    selectionArgs: Array<String>?
)

Unsupported operation.

Inherited functions

From android.content.ContentProvider
open Array<ContentProviderResult>
open Array<ContentProviderResult>
open Unit
open Int
open Bundle?
call(p0: String, p1: String?, p2: Bundle?)
open Bundle?
call(p0: String, p1: String, p2: String?, p3: Bundle?)
open Uri?
ContentProvider.CallingIdentity
open Int
delete(p0: Uri, p1: Bundle?)
open Unit
AttributionSource?
String?
String?
String?
Context?
Array<PathPermission>?
String?
open Array<String>?
open String?
String?
open Uri?
insert(p0: Uri, p1: ContentValues?, p2: Bundle?)
open Boolean
open Unit
open Unit
open Unit
open Unit
open AssetFileDescriptor?
openAssetFile(p0: Uri, p1: String)
open AssetFileDescriptor?
open ParcelFileDescriptor?
openFile(p0: Uri, p1: String)
open ParcelFileDescriptor?
openFile(p0: Uri, p1: String, p2: CancellationSignal?)
ParcelFileDescriptor
open ParcelFileDescriptor
<T : Any> openPipeHelper(
    p0: Uri,
    p1: String,
    p2: Bundle?,
    p3: T?,
    p4: ContentProvider.PipeDataWriter<T>
)
open AssetFileDescriptor?
openTypedAssetFile(p0: Uri, p1: String, p2: Bundle?)
open AssetFileDescriptor?
open Cursor?
query(p0: Uri, p1: Array<String>?, p2: Bundle?, p3: CancellationSignal?)
open Cursor?
query(
    p0: Uri,
    p1: Array<String>?,
    p2: String?,
    p3: Array<String>?,
    p4: String?,
    p5: CancellationSignal?
)
open Boolean
refresh(p0: Uri, p1: Bundle?, p2: CancellationSignal?)
Context
Unit
Unit
Unit
Unit
open Unit
open Uri?
open Int
update(p0: Uri, p1: ContentValues?, p2: Bundle?)

Public constructors

UpdateInfoProvider

Added in 1.0.0-alpha04
UpdateInfoProvider(
    context: Context,
    authority: String,
    customSecurityState: SecurityPatchState? = null
)
Parameters
context: Context

The Context of the calling application.

authority: String

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

customSecurityState: SecurityPatchState? = null

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

Public functions

delete

Added in 1.0.0-alpha04
open fun delete(uri: Uri, selection: String?, selectionArgs: Array<String>?): Int

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

Parameters
uri: Uri

The URI to delete from.

selection: String?

The selection criteria to apply.

selectionArgs: Array<String>?

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-alpha04
open fun getType(uri: Uri): String?

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

Parameters
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-alpha04
open fun insert(uri: Uri, values: ContentValues?): Uri?

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

Parameters
uri: Uri

The URI to query.

values: ContentValues?

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-alpha04
open fun onCreate(): Boolean

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-alpha04
open fun query(
    uri: Uri,
    projection: Array<String>?,
    selection: String?,
    selectionArgs: Array<String>?,
    sortOrder: String?
): Cursor

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
uri: Uri

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

projection: Array<String>?

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

selection: String?

The selection criteria to apply.

selectionArgs: Array<String>?

Arguments for the selection criteria.

sortOrder: String?

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

Returns
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-alpha04
fun registerUpdate(updateInfo: UpdateInfo): Unit

Registers information about an available update for the specified component.

Parameters
updateInfo: UpdateInfo

Update information structure.

unregisterUpdate

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

Unregisters information about an available update for the specified component.

Parameters
updateInfo: UpdateInfo

Update information structure.

update

Added in 1.0.0-alpha04
open fun update(
    uri: Uri,
    values: ContentValues?,
    selection: String?,
    selectionArgs: Array<String>?
): Int

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

Parameters
uri: Uri

The URI to update.

values: ContentValues?

The new values to apply.

selection: String?

The selection criteria to apply.

selectionArgs: Array<String>?

Arguments for the selection criteria.

Returns
Int

nothing as this operation is not supported.

Throws
kotlin.UnsupportedOperationException

always as this operation is not supported.