public class OTA extends AccountManager
OTA class allows you to download and install OS upgrade files securely
OS Upgrade Example:
1. Get an auth token using getEloAccessToken
2. Check if new updates are available using checkEloOTAStatus. The OTA_CHECK_STATUS_NEW flag lets us know if a new update is available.
3. (Not for Android Q) Download the new OS using startDownloadEloOTAPackage. Download progress callbacks are received with OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE. A successful download is characterized by the OTA_DOWNLOAD_REMOTE_FILE_SUCCESS callback message.
4. (Not for Android Q) Verify the integrity of the OS upgrade file using verifyEloOTA. The OTA_VERIFY_SIGN_SUCCESS callback message signifies that the upgrade can be applied.
5. (Not for Android Q) Install the new OS using applyEloOTA, this process can take up to 10 minutes and the system reboots during the installation. Most partitions on the device are changed during the installation. The userdata partition will not be touched by the OTA update, all app data will remain intact.
6. (Only for Android Q) Download, verify and install the OS Update using downloadApplyABOTA. Returns status codes OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE for download progress OTA_APPLY_IN_PROGRESS while applying OTA, Consts.GENERIC_ERROR For any errors that occur while downloading and applying OTA.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEVICE_NOT_SUPPORT_GMS
Deice won't support GMS upgrade from AOSP image.
|
static int |
EV_RESPONSE |
static OTA |
instance |
static int |
OS360_RESPONSE_AVAILABLE |
static int |
OS360_RESPONSE_UNAVAILABLE |
static int |
OTA_APPLY_FILE_ERROR
The OTA was not applied due to some error.
|
static int |
OTA_APPLY_IN_PROGRESS
The OTA is currently being applied.
|
static int |
OTA_CHECK_STATUS_GENERIC_ERROR
Could not retrieve info about the remote OTA package.
|
static int |
OTA_CHECK_STATUS_NEW
There is a new OTA package available, please update.
|
static int |
OTA_CHECK_STATUS_OLD
The latest available OTA package is older than the current system.
|
static int |
OTA_CHECK_STATUS_SAME
The latest available OTA package is the same as the current system.
|
static int |
OTA_DIRECTORY_CLEARED
The OTA directory has been deleted
|
static int |
OTA_DOWNLOAD_GENERIC_ERROR
There was an unknown error while downloading the OTA package.
|
static int |
OTA_DOWNLOAD_LOCAL_FILE_ERROR
Local OTA package could not be copied due to an error.
|
static int |
OTA_DOWNLOAD_LOCAL_FILE_PERCENTAGE
Progress of copying the OTA package from local source.
|
static int |
OTA_DOWNLOAD_LOCAL_FILE_SUCCESS
Local OTA package has been copied successfully.
|
static int |
OTA_DOWNLOAD_REMOTE_FILE_ALREADY_DOWNLOADED
A new OTA package is already present on the device and can be installed.
|
static int |
OTA_DOWNLOAD_REMOTE_FILE_ERROR
There was an error downloading the OTA package.
|
static int |
OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE
Progress of the OTA package download.
|
static int |
OTA_DOWNLOAD_REMOTE_FILE_SUCCESS
The remote file has downloaded successfully.
|
static int |
OTA_EXISTING_ZIPFILE_READ_ERROR
The existing update zipfile could not be read
|
static int |
OTA_VERIFY_FILE_ERROR
There was an error verifying the OTA package, the file may be corrupt.
|
static int |
OTA_VERIFY_SIGN_ERROR
The OTA package signature is invalid.
|
static int |
OTA_VERIFY_SIGN_PERCENTAGE
Progress of an OTA package verification.
|
static int |
OTA_VERIFY_SIGN_SUCCESS
The OTA package signature was verified and is valid.
|
static int |
OTA_VERSION_RESPONSE_AVAILABLE
A list of OTA versions available for download is available
|
static java.lang.String |
property |
ACCESS_TOKEN_INVALID, ACCESS_TOKEN_VALID, API_ACCESS_TOKEN_INVALID, API_ACCESS_TOKEN_VALID, IS_USER_LOGIN_OAUTH, isPolaris, KEY_SERVER_ELO_POLARIS_DEV, KEY_SERVER_PRODUCTION_POLARIS, KEY_SERVER_QA_POLARIS, KEY_SERVER_STAGING_POLARIS, OAUTH_TOKEN_INVALID, OAUTH_TOKEN_VALID, REQUEST_AUTH_LOGIN, REQUEST_AUTH_LOGOUT, SETUP_OAUTH_ERROR, SETUP_OAUTH_SUCCESS, TOKEN_VERIFY_FAIL, TOKEN_VERIFY_SUCCESSACTION_SET_EST_REQUEST, ELO_FOLDER, ELO_NETWORK_CONF_CSV_FILE, ELO_WIFI_CONFIG_FOLDER, GENERIC_ERROR, isFROM, OAUTH_PATH_TOKEN, OAUTH_PATH_VERIFY, REQUEST_TOKEN, STR_CUSTOM_ANIM_IMAGE_FILE, STR_CUSTOM_ANIM_VIDEO_FILE, STR_CUSTOM_BRAND_LOGO_FILE, STR_CUSTOM_BRAND_NAME_FILE, STR_CUSTOM_BRAND_POWERED_BY_LOGO_FILE, STR_CUSTOM_LOCALE_NAME_FILE, STR_CUSTOM_WALLPAPER, STR_ELO_PATH_FOR_CUSTOM_ANIMATION, STR_SDCARD_ELO_DIR_PATH, VERIFY_TOKEN| Constructor and Description |
|---|
OTA() |
| Modifier and Type | Method and Description |
|---|---|
void |
applyOTA(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
This method is used to install a new OTA package.
|
void |
checkOTAStatus(android.content.Context context,
java.lang.String accessToken,
org.json.JSONObject jsonObject,
android.os.Handler handler)
This method is used to check whether the OTA package currently installed on the device is newer or older
than the latest package available on the server.
|
void |
checkOTAStatus(android.content.Context context,
java.lang.String accessToken,
java.lang.String buildPropUrl,
android.os.Handler handler)
This method is used to check whether the OTA package currently installed on the device is newer or older
than the latest package available on the server.
|
void |
downloadApplyABOTA(android.content.Context context,
java.lang.String accessToken,
java.lang.String otaURL,
java.lang.String otaPath,
java.lang.String otaVersion,
android.os.Handler handler)
This method is used to download OTA file from remote http server or from
local file path, VERIFY the OTA file and APPLY the update.
|
void |
getAvailableVersions(android.content.Context context,
java.lang.String accessToken,
AndroidVersion androidVersion,
android.os.Handler handler)
This method is used to retrieve the OTA package versions that are available on the server for
download.
|
void |
getOS360Details(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
This method is used to get os360 details
|
boolean |
isOTAFromA10To12(java.lang.String currBuildVersion,
java.lang.String requestedOTAVersion)
Checks if the requested OTA is from A10 to A12
|
void |
startDownloadUpgradePackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String otaURL,
android.net.Uri uri,
java.lang.String otaVersion,
android.os.Handler handler)
This method is used to download OTA file from remote http server or from
local file path.
|
void |
verifyEloOTA(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
This method verifies the signature of the downloaded OTA package.
|
configureOAuthHostedUI, destroyOAuth, getBaseUri, getClientId, getEloAccessToken, getEloOAuthToken, getEnvironment, getProperty, isPolaris, isPolarisLocked, logoutOAuth, onOAuthActivityResult, selectEnvironment, setDefaultEnvironment, setProperty, stopOAuth, unregisterAccountManagerListener, verifyEloTokenclone, getEloIntentWithFlag, getMigrate, isDevice7Inch, isDeviceM100public static final int OTA_DOWNLOAD_REMOTE_FILE_SUCCESS
public static final int OTA_DOWNLOAD_REMOTE_FILE_ERROR
public static final int OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE
public static final int OTA_DOWNLOAD_LOCAL_FILE_SUCCESS
public static final int OTA_DOWNLOAD_LOCAL_FILE_ERROR
public static final int OTA_DOWNLOAD_LOCAL_FILE_PERCENTAGE
public static final int OTA_DOWNLOAD_GENERIC_ERROR
public static final int OTA_VERIFY_SIGN_SUCCESS
public static final int OTA_VERIFY_SIGN_ERROR
public static final int OTA_VERIFY_SIGN_PERCENTAGE
public static final int OTA_VERIFY_FILE_ERROR
public static final int OTA_CHECK_STATUS_OLD
public static final int OTA_CHECK_STATUS_NEW
public static final int OTA_CHECK_STATUS_SAME
public static final int OTA_CHECK_STATUS_GENERIC_ERROR
public static final int OTA_APPLY_FILE_ERROR
public static final int OTA_APPLY_IN_PROGRESS
public static final int OTA_DOWNLOAD_REMOTE_FILE_ALREADY_DOWNLOADED
public static final int OTA_DIRECTORY_CLEARED
public static final int OTA_EXISTING_ZIPFILE_READ_ERROR
public static final int OTA_VERSION_RESPONSE_AVAILABLE
public static final int OS360_RESPONSE_AVAILABLE
public static final int OS360_RESPONSE_UNAVAILABLE
public static final int EV_RESPONSE
public static final int DEVICE_NOT_SUPPORT_GMS
public static java.lang.String property
public static OTA instance
public void startDownloadUpgradePackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String otaURL,
android.net.Uri uri,
java.lang.String otaVersion,
android.os.Handler handler)
Before starting the download, this method will check if a previously downloaded OTA package exists. If it does, the package will be extracted and the version will be checked against the latest available version to see if avoiding the download is possible. If the existing OTA package cannot be read, the old package will be removed and a new download of the latest OTA package will be started.
context - A context object of the calling Class (Activity/Service).otaURL - A custom download URL can be provided, or an empty string can be passed.accessToken - An authentication token received from the Elo servers.otaVersion - A custom OTA package version can be provided, or an empty string can be passed.handler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
OTA_DOWNLOAD_REMOTE_FILE_SUCCESS
OTA_DOWNLOAD_REMOTE_FILE_ERROR
OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE
OTA_DOWNLOAD_LOCAL_FILE_SUCCESS
OTA_DOWNLOAD_LOCAL_FILE_ERROR
OTA_DOWNLOAD_LOCAL_FILE_PERCENTAGE
OTA_DOWNLOAD_REMOTE_FILE_ALREADY_DOWNLOADED
OTA_CHECK_STATUS_NEW
OTA_CHECK_STATUS_SAME
OTA_CHECK_STATUS_OLD
OTA_CHECK_STATUS_GENERIC_ERROR
Consts.GENERIC_ERROR
OTA_DOWNLOAD_GENERIC_ERROR
public void downloadApplyABOTA(android.content.Context context,
java.lang.String accessToken,
java.lang.String otaURL,
java.lang.String otaPath,
java.lang.String otaVersion,
android.os.Handler handler)
Before starting the download, this method will check if a previously downloaded OTA package exists. If it does, the package will be extracted and the version will be checked against the latest available version to see if avoiding the download is possible. If the existing OTA package cannot be read, the old package will be removed and a new download of the latest OTA package will be started.
IMPORTANT: If you have an OS360 subscription you can get all updates using the offline token. If you have an EloView account, you can get MR updates using the online token obtained from your EloView account and your device needs to be added to your account. If you have neither subscription you cannot get updates.
context - A context object of the calling Class (Activity/Service).accessToken - An authentication token received from the Elo servers.otaURL - A custom download URL can be provided, or an empty string can be passed to use default URL.otaPath - A custom OTA path on the device (eg. /sdcard/Download/ota.zip)otaVersion - A custom OTA package version can be provided (eg. 5.5.11+p)handler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE
OTA_APPLY_IN_PROGRESS
Consts.GENERIC_ERROR
public void verifyEloOTA(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An authentication token received from the Elo servershandler - A handler to receive one of the following callback messages: AccountManager.TOKEN_VERIFY_FAIL
OTA_VERIFY_SIGN_SUCCESS
OTA_VERIFY_SIGN_ERROR
OTA_VERIFY_SIGN_PERCENTAGE
OTA_VERIFY_FILE_ERROR
public void getAvailableVersions(android.content.Context context,
java.lang.String accessToken,
AndroidVersion androidVersion,
android.os.Handler handler)
Provides the available OTA versions list for given AndroidVersion enumeration. If androidVersion is null it will provide the OTA versions according to the device OS version type.
context - A context object of the calling Class (Activity/Service).accessToken - An authentication token received from the Elo servershandler - A handler to receive one of the following callback messages: AccountManager.TOKEN_VERIFY_FAIL
OTA_VERSION_RESPONSE_AVAILABLE
androidVersion - An AndroidVersion for which to get available OTA versions.public void getOS360Details(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - Access Tokenhandler - public void applyOTA(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - Stringhandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
OTA_APPLY_FILE_ERROR
OTA_APPLY_IN_PROGRESS
Consts.GENERIC_ERROR
public void checkOTAStatus(android.content.Context context,
java.lang.String accessToken,
java.lang.String buildPropUrl,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - StringbuildPropUrl - must be a string "http://build.prop_server_url" or
"file://build.prop_local_file_path"
build.prop is mandatory to check OTA version./handler - A handler to receive one or more of the following callback messages:
whether it is new,old or same.
AccountManager.TOKEN_VERIFY_FAIL
OTA_CHECK_STATUS_NEW
OTA_CHECK_STATUS_SAME
OTA_CHECK_STATUS_OLD
OTA_CHECK_STATUS_GENERIC_ERROR
Consts.GENERIC_ERROR
public void checkOTAStatus(android.content.Context context,
java.lang.String accessToken,
org.json.JSONObject jsonObject,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - StringjsonObject - A Json object (elo-ota-config.json) corresponding to an OTA file.
This is used to determine whether the OS is up-to-date or can be updated.
AccountManager.TOKEN_VERIFY_FAIL
OTA_CHECK_STATUS_NEW
OTA_CHECK_STATUS_SAME
OTA_CHECK_STATUS_OLD
OTA_CHECK_STATUS_GENERIC_ERROR
Consts.GENERIC_ERROR
public boolean isOTAFromA10To12(java.lang.String currBuildVersion,
java.lang.String requestedOTAVersion)
currBuildVersion - StringrequestedOTAVersion - String