OemSystemUpdateClient

interface OemSystemUpdateClient


Client for OEM applications to interact with the Android Management API regarding Over-the-Air (OTA) system updates.

Enables OTA clients to retrieve policy-determined instructions and report status related to system updates.

Calls using this client are made from the OTA client to the Android Management API's on-device component.

Summary

Public functions

suspend SystemUpdate

Provides AMAPI with a new SystemUpdate resource.

ListenableFuture<SystemUpdate>

Provides AMAPI with a new SystemUpdate resource.

suspend SystemUpdate

Retrieves a SystemUpdate resource previously set by the OTA client.

ListenableFuture<SystemUpdate>

Retrieves a SystemUpdate resource previously set by the OTA client.

suspend UpdateControlState

Gets the current system update control state.

ListenableFuture<UpdateControlState>

Gets the current system update control state.

suspend ListSystemUpdatesResponse

Retrieves a list of all SystemUpdate resources previously set by the OTA client.

ListenableFuture<ListSystemUpdatesResponse>

Retrieves a list of all SystemUpdate resources previously set by the OTA client.

suspend ReportSystemUpdateAbortedResponse

Reports that a system update has been aborted.

ListenableFuture<ReportSystemUpdateAbortedResponse>

Reports that a system update has been aborted.

suspend ReportSystemUpdateAppliedResponse

Reports that a system update has been successfully applied.

ListenableFuture<ReportSystemUpdateAppliedResponse>

Reports that a system update has been successfully applied.

suspend ReportSystemUpdateAppliedWithOverrideResponse

Reports that a system update has been applied, overriding AMAPI instructions.

ListenableFuture<ReportSystemUpdateAppliedWithOverrideResponse>

Reports that a system update has been applied, overriding AMAPI instructions.

suspend ReportSystemUpdateApplyPreventedResponse

Reports that a system update apply is prevented.

ListenableFuture<ReportSystemUpdateApplyPreventedResponse>

Reports that a system update apply is prevented.

suspend ReportSystemUpdateDownloadPreventedResponse

Reports that a system update download is prevented.

ListenableFuture<ReportSystemUpdateDownloadPreventedResponse>

Reports that a system update download is prevented.

suspend ReportSystemUpdateDownloadedResponse

Reports that a system update has been successfully downloaded.

ListenableFuture<ReportSystemUpdateDownloadedResponse>

Reports that a system update has been successfully downloaded.

suspend ReportSystemUpdateDownloadedWithOverrideResponse

Reports that a system update has been downloaded, overriding AMAPI instructions.

ListenableFuture<ReportSystemUpdateDownloadedWithOverrideResponse>

Reports that a system update has been downloaded, overriding AMAPI instructions.

suspend ReportSystemUpdateDownloadingResponse

Reports that the download of a system update has started.

ListenableFuture<ReportSystemUpdateDownloadingResponse>

Reports that the download of a system update has started.

suspend ReportSystemUpdateDownloadingWithOverrideResponse

Reports that a system update download has started, overriding AMAPI instructions.

ListenableFuture<ReportSystemUpdateDownloadingWithOverrideResponse>

Reports that a system update download has started, overriding AMAPI instructions.

suspend UpdateControlState

Updates the system update control state.

ListenableFuture<UpdateControlState>

Updates the system update control state.

Public functions

createSystemUpdate

suspend fun createSystemUpdate(request: CreateSystemUpdateRequest): SystemUpdate

Provides AMAPI with a new SystemUpdate resource.

The SystemUpdate object in the request should only contain fields owned by the OTA client. Fields marked as output-only within SystemUpdate (e.g., instruction) are ignored if provided in the request.

The response contains a SystemUpdate object, augmented with output-only fields such as instruction determined by AMAPI based on policy.

Parameters
request: CreateSystemUpdateRequest

The CreateSystemUpdateRequest containing the SystemUpdate object to create.

Returns
SystemUpdate

A complete SystemUpdate object, including the output-only instruction fields.

Throws
com.google.android.managementapi.oemsystemupdate.UpdateControlStateRequiredException

if the UpdateControlState is not UpdateControlState.ControlState.UNIFIED_UPDATE_CONTROL.

SystemUpdateAlreadyExistsException if a system update with the same name already exists.

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

InvalidArgumentException if the request is malformed.

java.lang.SecurityException

java.lang.SecurityException if the OTA client is not authorized to call this API.

AndroidDevicePolicyAppNotUpdatedException if Android Device Policy app needs to be updated.

InternalException if an internal error occurs.

TimeoutException

java.util.concurrent.TimeoutException if a timeout occurs.

AmapiSdkException base exception for all other errors.

createSystemUpdateFuture

fun createSystemUpdateFuture(request: CreateSystemUpdateRequest): ListenableFuture<SystemUpdate>

Provides AMAPI with a new SystemUpdate resource. This is the same as createSystemUpdate, but returns a ListenableFuture instead of suspending.

Parameters
request: CreateSystemUpdateRequest

The CreateSystemUpdateRequest containing the SystemUpdate object to create.

Returns
ListenableFuture<SystemUpdate>

A ListenableFuture of the complete SystemUpdate object, augmented with output-only fields such as instruction determined by AMAPI based on its policies. The future may fail with:

getSystemUpdate

suspend fun getSystemUpdate(request: GetSystemUpdateRequest): SystemUpdate

Retrieves a SystemUpdate resource previously set by the OTA client.

This method allows the OTA client to fetch the current state of an update created by it, including AMAPI-defined instructions.

Parameters
request: GetSystemUpdateRequest

The request containing name of resource and the desired view for the resource.

Returns
SystemUpdate

A SystemUpdate object, populated according to the requested view.

Throws

SystemUpdateNotFoundException if the system update is not found.

UpdateControlStateNotFoundException if the update control state is not found.

InvalidSystemUpdateStateException if the system update state transition is invalid.

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

InvalidArgumentException if the request is malformed.

java.lang.SecurityException

java.lang.SecurityException if the OTA client is not authorized to call this API.

AndroidDevicePolicyAppNotUpdatedException if Android Device Policy app needs to be updated.

InternalException if an internal error occurs.

TimeoutException

java.util.concurrent.TimeoutException if a timeout occurs.

AmapiSdkException base exception for all other errors.

getSystemUpdateFuture

fun getSystemUpdateFuture(request: GetSystemUpdateRequest): ListenableFuture<SystemUpdate>

Retrieves a SystemUpdate resource previously set by the OTA client. This is the same as getSystemUpdate, but returns a ListenableFuture instead of suspending.

Parameters
request: GetSystemUpdateRequest

The request containing name of resource and the desired view for the resource.

Returns
ListenableFuture<SystemUpdate>

A ListenableFuture of SystemUpdate object, populated according to the requested view. The future may fail with:

getUpdateControlState

suspend fun getUpdateControlState(request: GetUpdateControlStateRequest): UpdateControlState

Gets the current system update control state. The OEM's OTA client uses this method to retrieve the current state of the update control solution that AMAPI is aware of.

Returns
UpdateControlState

The current UpdateControlState for the device.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

getUpdateControlStateFuture

fun getUpdateControlStateFuture(request: GetUpdateControlStateRequest): ListenableFuture<UpdateControlState>

Gets the current system update control state. The OEM's OTA client uses this method to retrieve the current state of the update control solution that AMAPI is aware of.

Returns
ListenableFuture<UpdateControlState>

A ListenableFuture which resolves to the current UpdateControlState for the device if the call is successful. The future may fail with:

listSystemUpdates

suspend fun listSystemUpdates(request: ListSystemUpdatesRequest): ListSystemUpdatesResponse

Retrieves a list of all SystemUpdate resources previously set by the OTA client.

This method allows the OTA client to fetch the current state of updates, including AMAPI-defined instructions, for all updates created by it that AMAPI is aware of.

Parameters
request: ListSystemUpdatesRequest

The request containing the desired view for the resources.

Returns
ListSystemUpdatesResponse

A ListSystemUpdatesResponse containing the list of SystemUpdate objects, populated according to the requested view.

Throws
com.google.android.managementapi.oemsystemupdate.UpdateControlStateRequiredException

if the UpdateControlState is not UpdateControlState.ControlState.UNIFIED_UPDATE_CONTROL.

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

InvalidArgumentException if the request is malformed.

java.lang.SecurityException

java.lang.SecurityException if the OTA client is not authorized to call this API.

AndroidDevicePolicyAppNotUpdatedException if Android Device Policy app needs to be updated.

InternalException if an internal error occurs.

TimeoutException

java.util.concurrent.TimeoutException if a timeout occurs.

AmapiSdkException base exception for all other errors.

listSystemUpdatesFuture

fun listSystemUpdatesFuture(request: ListSystemUpdatesRequest): ListenableFuture<ListSystemUpdatesResponse>

Retrieves a list of all SystemUpdate resources previously set by the OTA client. This is the same as listSystemUpdates, but returns a ListenableFuture instead of suspending.

Parameters
request: ListSystemUpdatesRequest

The request containing the desired view for the resources.

Returns
ListenableFuture<ListSystemUpdatesResponse>

A ListenableFuture of ListSystemUpdatesResponse containing the list of SystemUpdate objects, populated according to the requested view. The future may fail with:

reportSystemUpdateAborted

suspend fun reportSystemUpdateAborted(request: ReportSystemUpdateAbortedRequest): ReportSystemUpdateAbortedResponse

Reports that a system update has been aborted.

This method is called when the OTA client aborts a system update process. The request must include the resource name of the system update and a justification for the abort. This is a terminal state for the update.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateAbortedFuture

fun reportSystemUpdateAbortedFuture(
    request: ReportSystemUpdateAbortedRequest
): ListenableFuture<ReportSystemUpdateAbortedResponse>

Reports that a system update has been aborted.

This method is called when the OTA client aborts a system update process. The request must include the resource name of the system update and a justification for the abort. This is a terminal state for the update.

Returns
ListenableFuture<ReportSystemUpdateAbortedResponse>

A ListenableFuture which resolves to ReportSystemUpdateAbortedResponse if the call is successful. The future may fail with:

reportSystemUpdateApplied

suspend fun reportSystemUpdateApplied(request: ReportSystemUpdateAppliedRequest): ReportSystemUpdateAppliedResponse

Reports that a system update has been successfully applied.

This method should be called when the OTA client successfully applies a system update following the instructions from the Android Management API. If this requires a reboot, this should be called after the reboot. The request must specify the resource name of the applied system update. This is a terminal state for the update.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateAppliedFuture

fun reportSystemUpdateAppliedFuture(
    request: ReportSystemUpdateAppliedRequest
): ListenableFuture<ReportSystemUpdateAppliedResponse>

Reports that a system update has been successfully applied.

This method should be called when the OTA client successfully applies a system update following the instructions from the Android Management API. If this requires a reboot, this should be called after the reboot. The request must specify the resource name of the applied system update. This is a terminal state for the update.

Returns
ListenableFuture<ReportSystemUpdateAppliedResponse>

A ListenableFuture which resolves to ReportSystemUpdateAppliedResponse if the call is successful. The future may fail with:

reportSystemUpdateAppliedWithOverride

suspend fun reportSystemUpdateAppliedWithOverride(
    request: ReportSystemUpdateAppliedWithOverrideRequest
): ReportSystemUpdateAppliedWithOverrideResponse

Reports that a system update has been applied, overriding AMAPI instructions.

This method is called when the OTA client applies a system update contrary to a BLOCK instruction from the Android Management API. The request must include the resource name of the system update and a justification for the override. This is a terminal state for the update.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateAppliedWithOverrideFuture

fun reportSystemUpdateAppliedWithOverrideFuture(
    request: ReportSystemUpdateAppliedWithOverrideRequest
): ListenableFuture<ReportSystemUpdateAppliedWithOverrideResponse>

Reports that a system update has been applied, overriding AMAPI instructions.

This method is called when the OTA client applies a system update contrary to a BLOCK instruction from the Android Management API. The request must include the resource name of the system update and a justification for the override. This is a terminal state for the update.

Returns
ListenableFuture<ReportSystemUpdateAppliedWithOverrideResponse>

A ListenableFuture which resolves to ReportSystemUpdateAppliedWithOverrideResponse if the call is successful. The future may fail with:

reportSystemUpdateApplyPrevented

suspend fun reportSystemUpdateApplyPrevented(
    request: ReportSystemUpdateApplyPreventedRequest
): ReportSystemUpdateApplyPreventedResponse

Reports that a system update apply is prevented.

This method should be called when the OTA client is instructed to apply an update but is prevented from doing so by a local condition. The request must include the resource name of the system update and a reason for the prevention.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateApplyPreventedFuture

fun reportSystemUpdateApplyPreventedFuture(
    request: ReportSystemUpdateApplyPreventedRequest
): ListenableFuture<ReportSystemUpdateApplyPreventedResponse>

Reports that a system update apply is prevented.

This method should be called when the OTA client is instructed to apply an update but is prevented from doing so by a local condition. The request must include the resource name of the system update and a reason for the prevention.

Returns
ListenableFuture<ReportSystemUpdateApplyPreventedResponse>

A ListenableFuture which resolves to ReportSystemUpdateApplyPreventedResponse if the call is successful. The future may fail with:

reportSystemUpdateDownloadPrevented

suspend fun reportSystemUpdateDownloadPrevented(
    request: ReportSystemUpdateDownloadPreventedRequest
): ReportSystemUpdateDownloadPreventedResponse

Reports that a system update download is prevented.

This method should be called when the OTA client is instructed to download an update but is prevented from doing so by a local condition (e.g., insufficient battery, no network). The request must include the resource name of the system update and a justification for the prevention.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateDownloadPreventedFuture

fun reportSystemUpdateDownloadPreventedFuture(
    request: ReportSystemUpdateDownloadPreventedRequest
): ListenableFuture<ReportSystemUpdateDownloadPreventedResponse>

Reports that a system update download is prevented.

This method should be called when the OTA client is instructed to download an update but is prevented from doing so by a local condition (e.g., insufficient battery, no network). The request must include the resource name of the system update and a justification for the prevention.

Returns
ListenableFuture<ReportSystemUpdateDownloadPreventedResponse>

A ListenableFuture which resolves to ReportSystemUpdateDownloadPreventedResponse if the call is successful. The future may fail with:

reportSystemUpdateDownloaded

suspend fun reportSystemUpdateDownloaded(
    request: ReportSystemUpdateDownloadedRequest
): ReportSystemUpdateDownloadedResponse

Reports that a system update has been successfully downloaded.

This method should be called when the OTA client completes the download of a system update as instructed by the Android Management API. The request must include the resource name of the downloaded system update.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateDownloadedFuture

fun reportSystemUpdateDownloadedFuture(
    request: ReportSystemUpdateDownloadedRequest
): ListenableFuture<ReportSystemUpdateDownloadedResponse>

Reports that a system update has been successfully downloaded.

This method should be called when the OTA client completes the download of a system update as instructed by the Android Management API. The request must include the resource name of the downloaded system update.

Returns
ListenableFuture<ReportSystemUpdateDownloadedResponse>

A ListenableFuture which resolves to ReportSystemUpdateDownloadedResponse if the call is successful. The future may fail with:

reportSystemUpdateDownloadedWithOverride

suspend fun reportSystemUpdateDownloadedWithOverride(
    request: ReportSystemUpdateDownloadedWithOverrideRequest
): ReportSystemUpdateDownloadedWithOverrideResponse

Reports that a system update has been downloaded, overriding AMAPI instructions.

This method is called when the OTA client completes the download of a system update, having overridden a BLOCK instruction from the Android Management API. The request must include the resource name of the system update and a justification for the override.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateDownloadedWithOverrideFuture

fun reportSystemUpdateDownloadedWithOverrideFuture(
    request: ReportSystemUpdateDownloadedWithOverrideRequest
): ListenableFuture<ReportSystemUpdateDownloadedWithOverrideResponse>

Reports that a system update has been downloaded, overriding AMAPI instructions.

This method is called when the OTA client completes the download of a system update, having overridden a BLOCK instruction from the Android Management API. The request must include the resource name of the system update and a justification for the override.

Returns
ListenableFuture<ReportSystemUpdateDownloadedWithOverrideResponse>

A ListenableFuture which resolves to ReportSystemUpdateDownloadedWithOverrideResponse if the call is successful. The future may fail with:

reportSystemUpdateDownloading

suspend fun reportSystemUpdateDownloading(
    request: ReportSystemUpdateDownloadingRequest
): ReportSystemUpdateDownloadingResponse

Reports that the download of a system update has started.

This method should be called when the OTA client begins or resumes downloading a system update in accordance with the instructions received from the Android Management API. The request must contain the resource name of the system update being downloaded.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateDownloadingFuture

fun reportSystemUpdateDownloadingFuture(
    request: ReportSystemUpdateDownloadingRequest
): ListenableFuture<ReportSystemUpdateDownloadingResponse>

Reports that the download of a system update has started.

This method should be called when the OTA client begins or resumes downloading a system update in accordance with the instructions received from the Android Management API. The request must contain the resource name of the system update being downloaded.

Returns
ListenableFuture<ReportSystemUpdateDownloadingResponse>

A ListenableFuture which resolves to ReportSystemUpdateDownloadingResponse if the call is successful. The future may fail with:

reportSystemUpdateDownloadingWithOverride

suspend fun reportSystemUpdateDownloadingWithOverride(
    request: ReportSystemUpdateDownloadingWithOverrideRequest
): ReportSystemUpdateDownloadingWithOverrideResponse

Reports that a system update download has started, overriding AMAPI instructions.

This method should be called when the OTA client starts downloading a system update even though the instruction from the Android Management API was to block the download. The request must include the resource name of the system update and a justification for the override.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

reportSystemUpdateDownloadingWithOverrideFuture

fun reportSystemUpdateDownloadingWithOverrideFuture(
    request: ReportSystemUpdateDownloadingWithOverrideRequest
): ListenableFuture<ReportSystemUpdateDownloadingWithOverrideResponse>

Reports that a system update download has started, overriding AMAPI instructions.

This method should be called when the OTA client starts downloading a system update even though the instruction from the Android Management API was to block the download. The request must include the resource name of the system update and a justification for the override.

Returns
ListenableFuture<ReportSystemUpdateDownloadingWithOverrideResponse>

A ListenableFuture which resolves to ReportSystemUpdateDownloadingWithOverrideResponse if the call is successful. The future may fail with:

updateUpdateControlState

suspend fun updateUpdateControlState(request: UpdateUpdateControlStateRequest): UpdateControlState

Updates the system update control state. The OEM's OTA client uses this method to report any changes to the update control state. The OEM client MUST call this method whenever the control state changes.

Parameters
request: UpdateUpdateControlStateRequest

The request containing the new UpdateControlState.

Returns
UpdateControlState

The updated UpdateControlState.

Throws

ApiLevelException if device API level is lower than Tiramisu (API level 33).

AndroidDevicePolicyAppNotInstalledException if Android Device Policy app is not installed.

AndroidDevicePolicyAppDisabledException if Android Device Policy app is disabled.

DeviceNotManagedException if device is not enterprise managed.

updateUpdateControlStateFuture

fun updateUpdateControlStateFuture(
    request: UpdateUpdateControlStateRequest
): ListenableFuture<UpdateControlState>

Updates the system update control state. The OEM's OTA client uses this method to report any changes to the update control state. The OEM client MUST call this method whenever the control state changes.

Parameters
request: UpdateUpdateControlStateRequest

The request containing the new UpdateControlState.

Returns
ListenableFuture<UpdateControlState>

A ListenableFuture which resolves to the updated UpdateControlState if the call is successful. The future may fail with: