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