public class FirmwareUpdateManager
extends java.lang.Object
This manager allows applications to update the firmware of the device, install new applications and wipe data and cache partitions.
Unless noted, all firmware update API methods require the
com.digi.android.permission.FIRMWARE_UPDATE
permission. If your
application does not have this permission it will not have access to any
firmware update service feature.
Constructor and Description |
---|
FirmwareUpdateManager(android.content.Context context)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
installApplication(java.lang.String applicationPath,
boolean reboot)
Installs the given application.
|
void |
installUpdatePackage(java.lang.String updatePackagePath,
IFirmwareUpdateListener listener,
boolean verify,
java.lang.String deviceCertsZipFile)
Installs the given update package.
|
void |
wipeCache()
Wipes the cache (/cache) partition.
|
void |
wipeCache(java.lang.String reason)
Wipes the cache (/cache) partition.
|
void |
wipeUserData()
Wipes the user data (/data) and cache (/cache) partitions.
|
void |
wipeUserData(java.lang.String reason)
Wipes the user data (/data) and cache (/cache) partitions.
|
void |
wipeUserData(java.lang.String reason,
boolean shutdown)
Wipes the user data (/data) and cache (/cache) partitions.
|
public FirmwareUpdateManager(android.content.Context context)
FirmwareUpdateManager
using the given application context.
The FirmwareUpdateManager
allows you to perform firmware
update related operations.
context
- Android application context.java.lang.NullPointerException
- If context == null
.public void installUpdatePackage(java.lang.String updatePackagePath, IFirmwareUpdateListener listener, boolean verify, java.lang.String deviceCertsZipFile)
This method returns immediately. All the update process is executed on a new thread using the given listener as the communication interface.
If the update package is not located in the '/data' partition, the file is copied there before performing the update.
If the verification flag is set, the update package is verified before performing the update using the given certificates file or the system default one.
A reboot is performed in order to install the update package.updatePackagePath
- Full path of the update package to install.listener
- An object implementing the IFirmwareUpdateListener
interface to receive firmware update progress information.verify
- true
to verify the update package signature,
false
otherwise. Package signature will be verified
using the provided certificates zip file if any. If not,
the default system certificates file will be used.deviceCertsZipFile
- Full path to the zip file of certificates whose
public keys will be accepted. Verification
succeeds if the package is signed by the
private key corresponding to any public key in
this file. May be null
to use the system
default file, currently
"/system/etc/security/otacerts.zip". This
parameter only applies if verify == True
java.lang.NullPointerException
- If updatePackagePath == null
or
if (@code listener == null}.IFirmwareUpdateListener
public void wipeCache() throws java.io.IOException
java.io.IOException
- If there is any error preparing for the wipe.wipeCache(String)
,
wipeUserData()
,
wipeUserData(String)
,
wipeUserData(String, boolean)
public void wipeCache(java.lang.String reason) throws java.io.IOException
reason
- Reason for the wipe if any, may be null
.java.io.IOException
- If there is any error preparing for the wipe.wipeCache()
,
wipeUserData()
,
wipeUserData(String)
,
wipeUserData(String, boolean)
public void wipeUserData() throws java.io.IOException
java.io.IOException
- If there is any error preparing for the wipe.wipeCache()
,
wipeCache(String)
,
wipeUserData(String)
,
wipeUserData(String, boolean)
public void wipeUserData(java.lang.String reason) throws java.io.IOException
reason
- Reason for the wipe if any, may be null
.java.io.IOException
- If there is any error preparing for the wipe.wipeCache()
,
wipeCache(String)
,
wipeUserData()
,
wipeUserData(String, boolean)
public void wipeUserData(java.lang.String reason, boolean shutdown) throws java.io.IOException
reason
- Reason for the wipe if any, may be null
.shutdown
- true
to shutdown the device instead of rebooting
after performing the wipe, false
otherwise.java.io.IOException
- If there is any error preparing for the wipe.wipeCache()
,
wipeCache(String)
,
wipeUserData()
,
wipeUserData(String)
public void installApplication(java.lang.String applicationPath, boolean reboot) throws java.io.IOException
applicationPath
- Full path of the application to install.reboot
- true
to reboot the device after installing the
application, false
otherwise.java.io.IOException
- If there is any error installing the application.java.lang.NullPointerException
- If applicationPath == null