Example usage for android.os RecoverySystem verifyPackage

List of usage examples for android.os RecoverySystem verifyPackage

Introduction

In this page you can find the example usage for android.os RecoverySystem verifyPackage.

Prototype

public static void verifyPackage(File packageFile, ProgressListener listener, File deviceCertsZipFile)
        throws IOException, GeneralSecurityException 

Source Link

Document

Verify the cryptographic signature of a system update package before installing it.

Usage

From source file:org.wso2.emm.system.service.api.OTAServerManager.java

public void startVerifyUpgradePackage() {
    Preference.putBoolean(context, context.getResources().getString(R.string.verification_failed_flag), false);
    File recoveryFile = new File(FileUtils.getUpgradePackageFilePath());
    try {/*www.  ja v a2 s . c  om*/
        wakeLock.acquire();
        Log.d(TAG, "Verifying upgrade package");
        RecoverySystem.verifyPackage(recoveryFile, recoveryVerifyListener, null);
    } catch (IOException e) {
        reportInstallError(OTAStateChangeListener.ERROR_PACKAGE_VERIFY_FAILED);
        String message = "Update verification failed due to file error.";
        Log.e(TAG, message);
    } catch (GeneralSecurityException e) {
        reportInstallError(OTAStateChangeListener.ERROR_PACKAGE_VERIFY_FAILED);
        String message = "Update verification failed due to security check failure.";
        Log.e(TAG, message);
    } finally {
        wakeLock.release();
    }
}