public final class UpdateInfoProvider extends ContentProvider


A content provider that serves update information for system components.

This class retrieves UpdateInfo stored in JSON format and serves it via a content URI. It only supports the query operation; insert, delete, and update operations are not permitted.

Typically, OTA or other update clients utilize this provider to expose update information to other applications or components within the system that need access to the latest security updates data. The client calls UpdateInfoManager.registerUpdate and UpdateInfoManager.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 the following snippet to the client's manifest:

<provider
android
:name="androidx.security.state.provider.UpdateInfoProvider"
android:authorities="${applicationId}.updateinfoprovider"
android:exported="true" />

Summary

Public constructors

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 by constructing contentUri using the authority listed in the manifest.

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

Handles queries for the update information.

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 PathPermission[]
final @Nullable String
@Nullable String[]
@Nullable String
final @Nullable String
@Nullable Uri
boolean
void
void
void

This method is deprecated.

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()

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 by constructing contentUri using the authority listed in the manifest.

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 returns a Cursor containing UpdateInfo represented in JSON format.

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.

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.