Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 1c3894e

Browse files
committed
Improve AnyKernel support. Close #138
1 parent 8f57515 commit 1c3894e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/src/main/java/com/fox2code/mmm/installer/InstallerActivity.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,17 @@ protected void onCreate(Bundle savedInstanceState) {
159159
Files.fixJavaZipHax(rawModule);
160160
boolean noPatch = false;
161161
boolean isModule = false;
162+
boolean isAnyKernel = false;
162163
errMessage = "File is not a valid zip file";
163164
try (ZipInputStream zipInputStream = new ZipInputStream(
164165
new ByteArrayInputStream(rawModule))) {
165166
ZipEntry zipEntry;
166167
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
167168
String entryName = zipEntry.getName();
168-
if (entryName.equals("module.prop")) {
169+
if (entryName.equals("anykernel.sh")) {
170+
isAnyKernel = true;
171+
break;
172+
} else if (entryName.equals("module.prop")) {
169173
noPatch = true;
170174
isModule = true;
171175
break;
@@ -175,7 +179,8 @@ protected void onCreate(Bundle savedInstanceState) {
175179
}
176180
}
177181
if (!isModule) {
178-
this.setInstallStateFinished(false,
182+
this.setInstallStateFinished(false, isAnyKernel ?
183+
"! AnyKernel modules can only be installed on recovery" :
179184
"! File is not a valid magisk module", "");
180185
return;
181186
}

app/src/main/java/com/fox2code/mmm/utils/PropUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ public static void readProperties(ModuleInfo moduleInfo, InputStream inputStream
249249
if (readIdSec && local) {
250250
// Using the name for module id is not really appropriate, so beautify it a bit
251251
moduleInfo.name = makeNameFromId(moduleInfo.id);
252-
} else if (local) { // Allow local module to not declare ids
253-
invalid = true;
254-
} else {
252+
} else if (!local) { // Allow local modules to not declare ids
255253
throw new IOException("Didn't read module id at least once!");
256254
}
257255
}

0 commit comments

Comments
 (0)