Adapt with new Magisk installation
This commit is contained in:
parent
96eaa833f5
commit
c461fc6daa
@ -8,7 +8,7 @@ android {
|
||||
applicationId "com.topjohnwu.magisk"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
versionCode 71
|
||||
versionCode 72
|
||||
versionName "5.4.3"
|
||||
ndk {
|
||||
moduleName 'zipadjust'
|
||||
|
@ -1,7 +1,8 @@
|
||||
### v5.4.3 (71)
|
||||
### v5.4.3 (72)
|
||||
- Fix dynamic resource loading, should prevent crashing when checking SafetyNet
|
||||
- Update SignAPK to use very little RAM, should expand old device support
|
||||
- Support settings migration after hiding Magisk Manager
|
||||
- Add reboot menu in modules section
|
||||
- Add changelog in app
|
||||
- Add dark theme to superuser requests
|
||||
- Add dark theme to superuser requests
|
||||
- Properly handle new `KEEPVERITY` and `HIGHCOMP` flags for installation
|
@ -138,6 +138,9 @@ public class MagiskFragment extends Fragment
|
||||
expandableContainer.expandLayout = expandLayout;
|
||||
setupExpandable();
|
||||
|
||||
keepVerityChkbox.setChecked(mm.keepVerity);
|
||||
keepEncChkbox.setChecked(mm.keepEnc);
|
||||
|
||||
mSwipeRefreshLayout.setOnRefreshListener(this);
|
||||
updateUI();
|
||||
|
||||
|
@ -51,6 +51,8 @@ public class MagiskManager extends Application {
|
||||
public String managerLink;
|
||||
public String bootBlock = null;
|
||||
public int snetVersion;
|
||||
public boolean keepVerity;
|
||||
public boolean keepEnc;
|
||||
|
||||
// Data
|
||||
public Map<String, Module> moduleMap;
|
||||
@ -197,6 +199,23 @@ public class MagiskManager extends Application {
|
||||
} catch (NumberFormatException e) {
|
||||
magiskHide = true;
|
||||
}
|
||||
|
||||
ret = Shell.su(
|
||||
"getvar KEEPVERITY",
|
||||
"echo $KEEPVERITY");
|
||||
try {
|
||||
keepVerity = Utils.isValidShellResponse(ret) && Boolean.parseBoolean(ret.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
keepVerity = false;
|
||||
}
|
||||
ret = Shell.su(
|
||||
"getvar KEEPFORCEENCRYPT",
|
||||
"echo $KEEPFORCEENCRYPT");
|
||||
try {
|
||||
keepEnc = Utils.isValidShellResponse(ret) && Boolean.parseBoolean(ret.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
keepEnc = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPermissionGrantCallback(Runnable callback) {
|
||||
|
@ -28,6 +28,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -104,8 +105,10 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
|
||||
console.add("! Cannot unzip zip");
|
||||
throw e;
|
||||
}
|
||||
Shell.sh("chmod 755 " + install + "/*");
|
||||
|
||||
File boot = new File(install, "boot.img");
|
||||
boolean highCompression = false;
|
||||
switch (mode) {
|
||||
case PATCH_MODE:
|
||||
console.add("- Use boot image: " + boot);
|
||||
@ -141,6 +144,18 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
|
||||
break;
|
||||
case DIRECT_MODE:
|
||||
console.add("- Use boot image: " + mBootLocation);
|
||||
if (mm.remoteMagiskVersionCode >= 1463) {
|
||||
List<String> ret = new ArrayList<>();
|
||||
Shell.getShell().run(ret, logs,
|
||||
install + "/magiskboot --parse " + mBootLocation,
|
||||
"echo $?"
|
||||
);
|
||||
if (Utils.isValidShellResponse(ret)) {
|
||||
highCompression = Integer.parseInt(ret.get(ret.size() - 1)) == 2;
|
||||
if (highCompression)
|
||||
console.add("! Insufficient boot partition size detected");
|
||||
}
|
||||
}
|
||||
if (boot.createNewFile()) {
|
||||
Shell.su("cat " + mBootLocation + " > " + boot);
|
||||
} else {
|
||||
@ -173,8 +188,8 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
|
||||
// Patch boot image
|
||||
shell.run(console, logs,
|
||||
"cd " + install,
|
||||
"KEEPFORCEENCRYPT=" + mKeepEnc + " KEEPVERITY=" + mKeepVerity + " sh " +
|
||||
"update-binary indep boot_patch.sh " + boot + " || echo 'Failed!'");
|
||||
"KEEPFORCEENCRYPT=" + mKeepEnc + " KEEPVERITY=" + mKeepVerity + " HIGHCOMP=" + highCompression +
|
||||
" sh update-binary indep boot_patch.sh " + boot + " || echo 'Failed!'");
|
||||
|
||||
if (TextUtils.equals(console.get(console.size() - 1), "Failed!"))
|
||||
return false;
|
||||
|
@ -240,7 +240,8 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static void patchDTBO() {
|
||||
if (MagiskManager.get().magiskVersionCode >= 1446) {
|
||||
MagiskManager mm = MagiskManager.get();
|
||||
if (mm.magiskVersionCode >= 1446 && !mm.keepVerity) {
|
||||
List<String> ret = Shell.su("patch_dtbo_image && echo true || echo false");
|
||||
if (Utils.isValidShellResponse(ret) && Boolean.parseBoolean(ret.get(ret.size() - 1))) {
|
||||
ShowUI.dtboPatchedNotification();
|
||||
|
Loading…
Reference in New Issue
Block a user