Allow to check if an update is of type AB from anywhere

This commit is contained in:
Gabriele M
2017-07-16 22:28:11 +02:00
parent 4182e3d30e
commit 12688ba761
4 changed files with 20 additions and 14 deletions

View File

@@ -36,6 +36,7 @@ import org.lineageos.updater.UpdateDownload;
import org.lineageos.updater.UpdateStatus;
import org.lineageos.updater.UpdaterReceiver;
import org.lineageos.updater.UpdatesActivity;
import org.lineageos.updater.misc.Utils;
import java.io.IOException;
import java.text.NumberFormat;
@@ -165,10 +166,7 @@ public class UpdaterService extends Service {
throw new IllegalArgumentException(update.getDownloadId() + " is not verified");
}
try {
ZipFile zipFile = new ZipFile(update.getFile());
boolean isABUpdate = ABUpdateInstaller.isABUpdate(zipFile);
zipFile.close();
if (isABUpdate) {
if (Utils.isABUpdate(update.getFile())) {
ABUpdateInstaller.start(mUpdaterController, downloadId);
} else {
android.os.RecoverySystem.installPackage(this, update.getFile());