diff --git a/src/main/java/com/topjohnwu/magisk/FlashActivity.java b/src/main/java/com/topjohnwu/magisk/FlashActivity.java index e84363e65..9bdc3afdd 100644 --- a/src/main/java/com/topjohnwu/magisk/FlashActivity.java +++ b/src/main/java/com/topjohnwu/magisk/FlashActivity.java @@ -109,19 +109,16 @@ public class FlashActivity extends Activity { Intent intent = getIntent(); Uri uri = intent.getData(); - boolean keepEnc = intent.getBooleanExtra(Const.Key.FLASH_SET_ENC, false); - boolean keepVerity = intent.getBooleanExtra(Const.Key.FLASH_SET_VERITY, false); - switch (intent.getStringExtra(Const.Key.FLASH_ACTION)) { case Const.Value.FLASH_ZIP: new FlashZip(this, uri, console, logs).exec(); break; case Const.Value.PATCH_BOOT: - new InstallMagisk(this, console, logs, uri, keepEnc, keepVerity, (Uri) intent.getParcelableExtra(Const.Key.FLASH_SET_BOOT)) + new InstallMagisk(this, console, logs, uri, (Uri) intent.getParcelableExtra(Const.Key.FLASH_SET_BOOT)) .exec(); break; case Const.Value.FLASH_MAGISK: - new InstallMagisk(this, console, logs, uri, keepEnc, keepVerity, intent.getStringExtra(Const.Key.FLASH_SET_BOOT)) + new InstallMagisk(this, console, logs, uri, intent.getStringExtra(Const.Key.FLASH_SET_BOOT)) .exec(); break; } diff --git a/src/main/java/com/topjohnwu/magisk/MagiskFragment.java b/src/main/java/com/topjohnwu/magisk/MagiskFragment.java index 0fbb9107f..f62ee330f 100644 --- a/src/main/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/src/main/java/com/topjohnwu/magisk/MagiskFragment.java @@ -117,8 +117,7 @@ public class MagiskFragment extends Fragment } ((NotificationManager) mm.getSystemService(Context.NOTIFICATION_SERVICE)).cancelAll(); - ShowUI.magiskInstallDialog(getActivity(), - keepEncChkbox.isChecked(), keepVerityChkbox.isChecked()); + ShowUI.magiskInstallDialog(getActivity()); } @OnClick(R.id.uninstall_button) @@ -139,7 +138,13 @@ public class MagiskFragment extends Fragment setupExpandable(); keepVerityChkbox.setChecked(mm.keepVerity); + keepVerityChkbox.setOnCheckedChangeListener((view, isChecked) -> { + mm.keepVerity = isChecked; + }); keepEncChkbox.setChecked(mm.keepEnc); + keepEncChkbox.setOnCheckedChangeListener((view, isChecked) -> { + mm.keepEnc = isChecked; + }); mSwipeRefreshLayout.setOnRefreshListener(this); updateUI(); diff --git a/src/main/java/com/topjohnwu/magisk/MagiskManager.java b/src/main/java/com/topjohnwu/magisk/MagiskManager.java index c8940648e..fc1eb5a44 100644 --- a/src/main/java/com/topjohnwu/magisk/MagiskManager.java +++ b/src/main/java/com/topjohnwu/magisk/MagiskManager.java @@ -50,8 +50,8 @@ public class MagiskManager extends Application { public String managerLink; public String bootBlock = null; public int snetVersion; - public boolean keepVerity; - public boolean keepEnc; + public boolean keepVerity = false; + public boolean keepEnc = false; // Data public Map moduleMap; @@ -186,22 +186,33 @@ public class MagiskManager extends Application { magiskHide = true; } + ret = Shell.su("echo \"$BOOTIMAGE\""); + if (Utils.isValidShellResponse(ret)) + bootBlock = ret.get(0); + + ret = Shell.su("echo \"$DTBOIMAGE\""); + if (Utils.isValidShellResponse(ret)) + keepVerity = true; + ret = Shell.su( "getvar KEEPVERITY", "echo $KEEPVERITY"); try { - keepVerity = Utils.isValidShellResponse(ret) && Boolean.parseBoolean(ret.get(0)); - } catch (NumberFormatException e) { - keepVerity = false; - } + if (Utils.isValidShellResponse(ret)) + keepVerity = Boolean.parseBoolean(ret.get(0)); + } catch (NumberFormatException ignored) {} + + ret = Shell.sh("getprop ro.crypto.state"); + if (Utils.isValidShellResponse(ret) && ret.get(0).equals("encrypted")) + keepEnc = true; + ret = Shell.su( "getvar KEEPFORCEENCRYPT", "echo $KEEPFORCEENCRYPT"); try { - keepEnc = Utils.isValidShellResponse(ret) && Boolean.parseBoolean(ret.get(0)); - } catch (NumberFormatException e) { - keepEnc = false; - } + if (Utils.isValidShellResponse(ret)) + keepEnc = Boolean.parseBoolean(ret.get(0)); + } catch (NumberFormatException ignored) {} if (suDB != null && !SuDatabaseHelper.verified) { suDB.close(); diff --git a/src/main/java/com/topjohnwu/magisk/SplashActivity.java b/src/main/java/com/topjohnwu/magisk/SplashActivity.java index c8f304abd..114adecdc 100644 --- a/src/main/java/com/topjohnwu/magisk/SplashActivity.java +++ b/src/main/java/com/topjohnwu/magisk/SplashActivity.java @@ -62,11 +62,6 @@ public class SplashActivity extends Activity { // Magisk working as expected if (Shell.rootAccess() && mm.magiskVersionCode > 0) { - List ret = Shell.su("echo \"$BOOTIMAGE\""); - if (Utils.isValidShellResponse(ret)) { - mm.bootBlock = ret.get(0); - } - // Add update checking service if (Const.Value.UPDATE_SERVICE_VER > mm.prefs.getInt(Const.Key.UPDATE_SERVICE_VER, -1)) { ComponentName service = new ComponentName(this, UpdateCheckService.class); diff --git a/src/main/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java b/src/main/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java index 90abb03ba..55e47bb3f 100644 --- a/src/main/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java +++ b/src/main/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java @@ -40,26 +40,23 @@ public class InstallMagisk extends ParallelTask { private Uri mBootImg, mZip; private List console, logs; private String mBootLocation; - private boolean mKeepEnc, mKeepVerity; private int mode; - private InstallMagisk(Activity context, List console, List logs, Uri zip, boolean enc, boolean verity) { + private InstallMagisk(Activity context, List console, List logs, Uri zip) { super(context); this.console = console; this.logs = logs; mZip = zip; - mKeepEnc = enc; - mKeepVerity = verity; } - public InstallMagisk(Activity context, List console, List logs, Uri zip, boolean enc, boolean verity, Uri boot) { - this(context, console, logs, zip, enc, verity); + public InstallMagisk(Activity context, List console, List logs, Uri zip, Uri boot) { + this(context, console, logs, zip); mBootImg = boot; mode = PATCH_MODE; } - public InstallMagisk(Activity context, List console, List logs, Uri zip, boolean enc, boolean verity, String boot) { - this(context, console, logs, zip, enc, verity); + public InstallMagisk(Activity context, List console, List logs, Uri zip, String boot) { + this(context, console, logs, zip); mBootLocation = boot; mode = DIRECT_MODE; } @@ -190,7 +187,7 @@ public class InstallMagisk extends ParallelTask { "cd " + install, Utils.fmt("KEEPFORCEENCRYPT=%b KEEPVERITY=%b HIGHCOMP=%b " + "sh update-binary indep boot_patch.sh %s || echo 'Failed!'", - mKeepEnc, mKeepVerity, highCompression, boot)); + mm.keepEnc, mm.keepVerity, highCompression, boot)); if (TextUtils.equals(console.get(console.size() - 1), "Failed!")) return false; @@ -250,7 +247,7 @@ public class InstallMagisk extends ParallelTask { Utils.fmt("cp -af %s/* %s; rm -rf %s", install, binPath, install), Utils.fmt("flash_boot_image %s %s", patched_boot, mBootLocation), mm.remoteMagiskVersionCode >= 1464 ? "[ -L /data/magisk.img ] || cp /data/magisk.img /data/adb/magisk.img" : "", - "patch_dtbo_image"); + mm.keepVerity ? "" : "patch_dtbo_image"); break; default: return false; diff --git a/src/main/java/com/topjohnwu/magisk/utils/Const.java b/src/main/java/com/topjohnwu/magisk/utils/Const.java index 7afd65463..e1e60deab 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/Const.java +++ b/src/main/java/com/topjohnwu/magisk/utils/Const.java @@ -112,9 +112,6 @@ public class Const { public static final String INTENT_PERM = "perm_dialog"; public static final String FLASH_ACTION = "action"; public static final String FLASH_SET_BOOT = "boot"; - public static final String FLASH_SET_ENC = "enc"; - public static final String FLASH_SET_VERITY = "verity"; - // others public static final String UPDATE_NOTIFICATION = "notification"; diff --git a/src/main/java/com/topjohnwu/magisk/utils/Shell.java b/src/main/java/com/topjohnwu/magisk/utils/Shell.java index 044776326..db0b2ccc0 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/Shell.java +++ b/src/main/java/com/topjohnwu/magisk/utils/Shell.java @@ -94,6 +94,7 @@ public class Shell { "export PATH=" + bbpath + ":$PATH", "mount_partitions", "find_boot_image", + "find_dtbo_image", "migrate_boot_backup"); } } diff --git a/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java b/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java index 76b881134..28d7d579e 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java +++ b/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java @@ -96,7 +96,7 @@ public class ShowUI { notificationManager.notify(Const.ID.DTBO_NOTIFICATION_ID, builder.build()); } - public static void magiskInstallDialog(Activity activity, boolean enc, boolean verity) { + public static void magiskInstallDialog(Activity activity) { MagiskManager mm = Utils.getMagiskManager(activity); String filename = Utils.fmt("Magisk-v%s.zip", mm.remoteMagiskVersionString); new AlertDialogBuilder(activity) @@ -145,8 +145,6 @@ public class ShowUI { intent.setData(uri) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(Const.Key.FLASH_SET_BOOT, data.getData()) - .putExtra(Const.Key.FLASH_SET_ENC, enc) - .putExtra(Const.Key.FLASH_SET_VERITY, verity) .putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT); mm.startActivity(intent); } @@ -175,8 +173,6 @@ public class ShowUI { Intent intent = new Intent(mm, FlashActivity.class); intent.setData(uri) .putExtra(Const.Key.FLASH_SET_BOOT, boot) - .putExtra(Const.Key.FLASH_SET_ENC, enc) - .putExtra(Const.Key.FLASH_SET_VERITY, verity) .putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_MAGISK); activity.startActivity(intent); } @@ -203,8 +199,6 @@ public class ShowUI { Intent intent = new Intent(mm, FlashActivity.class); intent.setData(uri) .putExtra(Const.Key.FLASH_SET_BOOT, boot) - .putExtra(Const.Key.FLASH_SET_ENC, enc) - .putExtra(Const.Key.FLASH_SET_VERITY, verity) .putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_MAGISK); activity.startActivity(intent); } diff --git a/src/main/res/values-ar/strings.xml b/src/main/res/values-ar/strings.xml index fa56a14ce..05362d068 100644 --- a/src/main/res/values-ar/strings.xml +++ b/src/main/res/values-ar/strings.xml @@ -24,7 +24,7 @@ إعدادات متقدمة الحفاظ علي قوه التشفير - إبقاء dm-verity + إبقاء AVB 2.0/dm-verity نسخة Magisk المثبته: %1$s آخر نسخة Magisk: %1$s إلغاء التثبيت diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index 4197ae500..3f2192fff 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -20,7 +20,7 @@ Pokročilá Nastavení Udržet "force encryption" - Udržet dm-verity + Udržet AVB 2.0/dm-verity Nainstalovaná verze: %1$s Poslední verze: %1$s Odinstalovat diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index cecaee6b3..e43f07e53 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -28,7 +28,7 @@ Erweiterte Optionen \"force encryption\" beibehalten - \"dm-verity\"-Test beibehalten + AVB 2.0/dm-verity beibehalten Installierte Version: %1$s Neueste Version: %1$s Deinstallieren diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index 68ad4beab..811363b19 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -25,7 +25,7 @@ Προηγμένες ρυθμίσεις Διατήρηση επιβεβλημένης κρυπτογράφησης - Διατήρηση dm-verity + Διατήρηση AVB 2.0/dm-verity Εγκατεστημένη έκδοση: %1$s Τελευταία έκδοση: %1$s Απεγκατάσταση diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index 0489b8715..34096e16a 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -25,7 +25,7 @@ Ajustes avanzados Mantener cifrado forzado - Mantener dm-verity + Mantener AVB 2.0/dm-verity Versión instalada: %1$s Última versión: %1$s Desinstalar diff --git a/src/main/res/values-et/strings.xml b/src/main/res/values-et/strings.xml index 527fe2a0d..bee3df47a 100644 --- a/src/main/res/values-et/strings.xml +++ b/src/main/res/values-et/strings.xml @@ -26,7 +26,7 @@ Täpsemad seaded Säilita sunnitud krüpteering - Säilita dm-verity + Säilita AVB 2.0/dm-verity Installitud versioon: %1$s Viimane versioon: %1$s Eemalda diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 5bb19dc8b..e46a6d759 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -21,7 +21,7 @@ Paramètres avancés Garder le chiffrement forcé - Garder dm-verity + Garder AVB 2.0/dm-verity Version installée : %1$s Dernière Magisk : %1$s Désinstaller diff --git a/src/main/res/values-hr/strings.xml b/src/main/res/values-hr/strings.xml index 0b4ef14ec..c83c29918 100644 --- a/src/main/res/values-hr/strings.xml +++ b/src/main/res/values-hr/strings.xml @@ -25,7 +25,7 @@ Napredne postavke Zadrži prisilno šifirannje - Zadrži dm-istinitost + Zadrži AVB 2.0/dm-verity Instalirana inačica: %1$s Najnovija inačica: %1$s Deinstaliraj diff --git a/src/main/res/values-in/strings.xml b/src/main/res/values-in/strings.xml index ddc7100bc..f120c1249 100644 --- a/src/main/res/values-in/strings.xml +++ b/src/main/res/values-in/strings.xml @@ -25,7 +25,7 @@ Pengaturan Lanjutan Biarkan enkripsi paksa - Biarkan dm-verity + Biarkan AVB 2.0/dm-verity Versi yang Terpasang: %1$s Versi Terbaru: %1$s Copot diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index f24334b0e..232c2cfc9 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -25,7 +25,7 @@ Impostazioni avanzate Mantieni crittografia forzata - Mantieni dm-verity + Mantieni AVB 2.0/dm-verity Versione installata: %1$s Ultima versione disponibile: %1$s Disinstalla diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml index d207a7767..09eef9484 100644 --- a/src/main/res/values-ja/strings.xml +++ b/src/main/res/values-ja/strings.xml @@ -20,7 +20,7 @@ 高度な設定 強制的な暗号化を維持する - dm-verityを維持する + AVB 2.0/dm-verityを維持する インストール済: %1$s 最新: %1$s アンインストール diff --git a/src/main/res/values-ko/strings.xml b/src/main/res/values-ko/strings.xml index ec64590a9..cad88de70 100644 --- a/src/main/res/values-ko/strings.xml +++ b/src/main/res/values-ko/strings.xml @@ -20,7 +20,7 @@ 고급 설정 강제 암호화 유지 - dm-verity 유지 + AVB 2.0/dm-verity 유지 설치된버전: %1$s 최신버전: %1$s 제거 diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index d59efaa1b..28908dd9b 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -25,7 +25,7 @@ Geavanceerde instellingen Behoud afgedwongen versleuteling - Behoud dm-verity + Behoud AVB 2.0/dm-verity Geïnstalleerde versie: %1$s Recentste versie: %1$s Deïnstalleren diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml index a0c4dfabe..8e7e597e4 100644 --- a/src/main/res/values-pl/strings.xml +++ b/src/main/res/values-pl/strings.xml @@ -28,7 +28,7 @@ Zaawansowane Ustawienia Zachowaj Szyfrowanie - Zachowaj dm-verity + Zachowaj AVB 2.0/dm-verity Zainstalowana Wersja: %1$s Ostatnia Wersja: %1$s Odinstaluj diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml index dc2c03cf6..c1162a5cb 100644 --- a/src/main/res/values-pt-rBR/strings.xml +++ b/src/main/res/values-pt-rBR/strings.xml @@ -28,7 +28,7 @@ Configurações avançadas Keep force encryption - Keep dm-verity + Keep AVB 2.0/dm-verity Versão instalada: %1$s Última versão: %1$s Desinstalar diff --git a/src/main/res/values-pt-rPT/strings.xml b/src/main/res/values-pt-rPT/strings.xml index aaf56e171..898cea902 100644 --- a/src/main/res/values-pt-rPT/strings.xml +++ b/src/main/res/values-pt-rPT/strings.xml @@ -25,7 +25,7 @@ Definições avançadas Manter encriptação forçada -Manter dm-verity +Manter AVB 2.0/dm-verity Versão instalada: %1$s Última versão: %1$s Desinstalar diff --git a/src/main/res/values-ro/strings.xml b/src/main/res/values-ro/strings.xml index b594d6e45..d9dc0d5d6 100644 --- a/src/main/res/values-ro/strings.xml +++ b/src/main/res/values-ro/strings.xml @@ -22,7 +22,7 @@ Setări avansate Păstrare criptare forţată - Păstrare dm-verity + Păstrare AVB 2.0/dm-verity Versiune instalată: %1$s Ultima versiune: %1$s Dezinstalare diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index 412671a7f..a975a4444 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -25,7 +25,7 @@ Расширенные настройки Оставить шифрование - Оставить dm-verity + Оставить AVB 2.0/dm-verity Установлена версия: %1$s Последняя версия: %1$s Удаление diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml index 9f5252346..a8a62f7f1 100644 --- a/src/main/res/values-sr/strings.xml +++ b/src/main/res/values-sr/strings.xml @@ -25,7 +25,7 @@ Напредна Подешавања Задржи форсирану енкрипцију - Задржи dm-verity + Задржи AVB 2.0/dm-verity Инсталирана верзија: %1$s Најновија верзија: %1$s Унинсталирај diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index 1f1575146..18a4016f8 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -24,7 +24,7 @@ Advancerade inställningar Fortsätt tvinga kryptering - Behåll dm-verity + Behåll AVB 2.0/dm-verity Installerad: %1$s Senaste: %1$s Avinstallera diff --git a/src/main/res/values-tr/strings.xml b/src/main/res/values-tr/strings.xml index 19775877e..92a2a2f23 100644 --- a/src/main/res/values-tr/strings.xml +++ b/src/main/res/values-tr/strings.xml @@ -24,7 +24,7 @@ Gelişmiş Ayarlar Şifrelemeyi zorlamayı sürdür - "Dm-verity\'yi koru" + AVB 2.0/dm-verity \'yi koru Yüklü Sürüm: %1$s Yeni Sürüm: %1$s Kaldır diff --git a/src/main/res/values-uk/strings.xml b/src/main/res/values-uk/strings.xml index c8be29c50..de9ca24ca 100644 --- a/src/main/res/values-uk/strings.xml +++ b/src/main/res/values-uk/strings.xml @@ -24,7 +24,7 @@ Розширені налаштування Залишити примусове шифрування - Залишити dm-verity + Залишити AVB 2.0/dm-verity Поточна версія: %1$s Найновіша версія: %1$s Видалити diff --git a/src/main/res/values-vi/strings.xml b/src/main/res/values-vi/strings.xml index 71a336c5e..288ca435d 100644 --- a/src/main/res/values-vi/strings.xml +++ b/src/main/res/values-vi/strings.xml @@ -20,7 +20,7 @@ Thiết lập nâng cao Giữ bắt buộc mã hoá - Giữ dm-verity + Giữ AVB 2.0/dm-verity Đã cài đặt phiên bản: %1$s Phiên bản mới nhất: %1$s Gỡ bỏ diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml index 2cf8bb702..465e9095e 100644 --- a/src/main/res/values-zh-rCN/strings.xml +++ b/src/main/res/values-zh-rCN/strings.xml @@ -25,7 +25,7 @@ 高级设置 保持强制加密 - 保留 dm-verity + 保留 AVB 2.0/dm-verity 已安装版本:%1$s 最新的版本:%1$s 卸载 diff --git a/src/main/res/values-zh-rTW/strings.xml b/src/main/res/values-zh-rTW/strings.xml index dbab670b6..b9156675f 100644 --- a/src/main/res/values-zh-rTW/strings.xml +++ b/src/main/res/values-zh-rTW/strings.xml @@ -20,7 +20,7 @@ 高級設置 保持強制加密 - 保留 dm-verity + 保留 AVB 2.0/dm-verity 已安裝版本:%1$s 最新的版本:%1$s 解除安裝 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 479b40cdd..80b2913e9 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -27,8 +27,8 @@ Advanced Settings - Keep force encryption - Keep dm-verity + Preserve force encryption + Preserve AVB 2.0/dm-verity Installed Version: %1$s Latest Version: %1$s Uninstall