Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed671ae4 authored by Pat Erley's avatar Pat Erley Committed by Gerrit Code Review
Browse files

Only call uncrypt when we're encrypted

We were always generating a block map for encrypted update, even
when the device was not encrypted.  This leads to a spectacular
failure.  Fix this by only calling uncrypt when we're encrypted.

Additionally, only pass block.map as the update file in the case
that the device was encrypted and requires it.

NIGHTLIES-3012
Change-Id: Ia34eb5115ac4365605fd57f76179854a6042c5e4
parent 2b21b18e
Loading
Loading
Loading
Loading
+20 −15
Original line number Diff line number Diff line
@@ -335,6 +335,10 @@ public class RecoverySystem {
        throws IOException {
        String filename = packageFile.getCanonicalPath();

        final String cryptoStatus = SystemProperties.get("ro.crypto.state", "unsupported");
        final boolean isEncrypted = "encrypted".equalsIgnoreCase(cryptoStatus);

        if (isEncrypted) {
            FileWriter uncryptFile = new FileWriter(UNCRYPT_FILE);
            try {
                uncryptFile.write(filename + "\n");
@@ -352,6 +356,7 @@ public class RecoverySystem {
            if (filename.startsWith("/data/")) {
                filename = "@/cache/recovery/block.map";
            }
        }

        final String filenameArg = "--update_package=" + filename;
        final String localeArg = "--locale=" + Locale.getDefault().toString();
+4 −1
Original line number Diff line number Diff line
@@ -630,7 +630,10 @@ public final class ShutdownThread extends Thread {
            }
        };

        if (mRebootUpdate) {
        final String cryptoStatus = SystemProperties.get("ro.crypto.state", "unsupported");
        final boolean isEncrypted = "encrypted".equalsIgnoreCase(cryptoStatus);

        if (mRebootUpdate && isEncrypted) {
            sInstance.setRebootProgress(MOUNT_SERVICE_STOP_PERCENT, null);

            // If it's to reboot to install update, invoke uncrypt via init service.