@@ -189,6 +189,7 @@ protected void onCreate(Bundle savedInstanceState) {
189189 boolean noPatch = false ;
190190 boolean isModule = false ;
191191 boolean isAnyKernel3 = false ;
192+ boolean isInstallZipModule = false ;
192193 errMessage = "File is not a valid zip file" ;
193194 try (ZipInputStream zipInputStream = new ZipInputStream (
194195 new ByteArrayInputStream (rawModule ))) {
@@ -203,14 +204,21 @@ protected void onCreate(Bundle savedInstanceState) {
203204 noPatch = true ;
204205 isModule = true ;
205206 break ;
207+ } if (entryName .equals ("META-INF/com/google/android/magisk/module.prop" )) {
208+ noPatch = true ;
209+ isInstallZipModule = true ;
210+ break ;
206211 } else if (entryName .endsWith ("/tools/ak3-core.sh" )) {
207212 isAnyKernel3 = true ;
213+ } else if (entryName .endsWith (
214+ "/META-INF/com/google/android/magisk/module.prop" )) {
215+ isInstallZipModule = true ;
208216 } else if (entryName .endsWith ("/module.prop" )) {
209217 isModule = true ;
210218 }
211219 }
212220 }
213- if (!isModule && !isAnyKernel3 ) {
221+ if (!isModule && !isAnyKernel3 && ! isInstallZipModule ) {
214222 if (androidacyBlame ) {
215223 this .installerTerminal .addLine (
216224 "! Note: The following error is probably an Androidacy backend error" );
@@ -313,6 +321,7 @@ private void doInstall(File file, boolean noExtensions, boolean rootless) {
313321 String moduleId = null ;
314322 boolean anyKernel3 = false ;
315323 boolean magiskModule = false ;
324+ boolean installZipMagiskModule = false ;
316325 boolean mmtReborn = false ;
317326 String MAGISK_PATH = InstallerInitializer .peekMagiskPath ();
318327 if (MAGISK_PATH == null ) {
@@ -338,10 +347,11 @@ private void doInstall(File file, boolean noExtensions, boolean rootless) {
338347 bufferedReader .close ();
339348 }
340349 }
341- if (zipFile .getEntry ( // Check if module hard require 32bit support
350+ if (( zipFile .getEntry ( // Check if module hard require 32bit support
342351 "common/addon/Volume-Key-Selector/tools/arm64/keycheck" ) == null &&
343- zipFile .getEntry (
344- "common/addon/Volume-Key-Selector/install.sh" ) != null ) {
352+ zipFile .getEntry ("common/addon/Volume-Key-Selector/install.sh" ) != null ) ||
353+ (zipFile .getEntry ("META-INF/zbin/keycheck_arm64" ) == null &&
354+ zipFile .getEntry ("META-INF/zbin/keycheck_arm" ) != null )) {
345355 needs32bit = true ;
346356 }
347357 ZipEntry moduleProp = zipFile .getEntry ("module.prop" );
@@ -351,8 +361,11 @@ private void doInstall(File file, boolean noExtensions, boolean rootless) {
351361 zipFile .getEntry ("setup.sh" ) != null && magiskModule ) {
352362 mmtReborn = true ; // MMT-Reborn require a separate runtime
353363 }
354- moduleId = PropUtils .readModuleId (zipFile
355- .getInputStream (zipFile .getEntry ("module.prop" )));
364+ if (!magiskModule && (moduleProp = zipFile .getEntry (
365+ "META-INF/com/google/android/magisk/module.prop" )) != null ) {
366+ installZipMagiskModule = true ;
367+ }
368+ moduleId = PropUtils .readModuleId (zipFile .getInputStream (moduleProp ));
356369 } catch (IOException ignored ) {
357370 }
358371 int compatFlags = AppUpdateManager .getFlagsForModule (moduleId );
@@ -406,6 +419,17 @@ private void doInstall(File file, boolean noExtensions, boolean rootless) {
406419 installCommand = "unshare -m " + ASH + " \" " +
407420 installExecutable .getAbsolutePath () + "\" " +
408421 " 3 1 \" " + file .getAbsolutePath () + "\" " ;
422+ } else if (installZipMagiskModule ||
423+ (compatFlags & AppUpdateManager .FLAG_COMPAT_ZIP_WRAPPER ) != 0 ) {
424+ installExecutable = this .extractInstallScript ("module_installer_wrapper.sh" );
425+ if (installExecutable == null ) {
426+ this .setInstallStateFinished (false ,
427+ "! Failed to extract Magisk module wrapper script" , "" );
428+ return ;
429+ }
430+ installCommand = ASH + " \" " +
431+ installExecutable .getAbsolutePath () + "\" " +
432+ " 3 1 \" " + file .getAbsolutePath () + "\" " ;
409433 } else if (InstallerInitializer .peekMagiskVersion () >=
410434 Constants .MAGISK_VER_CODE_INSTALL_COMMAND &&
411435 ((compatFlags & AppUpdateManager .FLAG_COMPAT_MAGISK_CMD ) != 0 ||
0 commit comments