public class RecoverySystem extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RecoverySystem.ProgressListener
Interface definition for a callback to be invoked regularly as
verification proceeds.
|
Constructor and Description |
---|
RecoverySystem() |
Modifier and Type | Method and Description |
---|---|
static String |
handleAftermath()
Called after booting to process and remove recovery-related files.
|
static void |
installPackage(Context context,
File packageFile)
Reboots the device in order to install the given update
package.
|
static void |
rebootWipeCache(Context context)
Reboot into the recovery system to wipe the /cache partition.
|
static void |
rebootWipeUserData(Context context)
Reboots the device and wipes the user data partition.
|
static void |
verifyPackage(File packageFile,
RecoverySystem.ProgressListener listener,
File deviceCertsZipFile)
Verify the cryptographic signature of a system update package
before installing it.
|
public static void verifyPackage(File packageFile, RecoverySystem.ProgressListener listener, File deviceCertsZipFile) throws IOException, GeneralSecurityException
packageFile
- the package to be verifiedlistener
- an object to receive periodic progress
updates as verification proceeds. May be null.deviceCertsZipFile
- the zip file of certificates whose
public keys we will accept. 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").IOException
- if there were any errors reading the
package or certs files.GeneralSecurityException
- if verification failedpublic static void installPackage(Context context, File packageFile) throws IOException
android.Manifest.permission#REBOOT
permission.context
- the Context to usepackageFile
- the update package to install. Must be on
a partition mountable by recovery. (The set of partitions
known to recovery may vary from device to device. Generally,
/cache and /data are safe.)IOException
- if writing the recovery command file
fails, or if the reboot itself fails.public static void rebootWipeUserData(Context context) throws IOException
android.Manifest.permission#REBOOT
permission.context
- the Context to useIOException
- if writing the recovery command file
fails, or if the reboot itself fails.public static void rebootWipeCache(Context context) throws IOException
IOException
- if something goes wrong.public static String handleAftermath()