final tweaks in prep for release

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head
androidacy-user 2 years ago
parent 1484195854
commit be34fc0f59

@ -53,7 +53,7 @@ android {
applicationId = "com.fox2code.mmm" applicationId = "com.fox2code.mmm"
minSdk = 24 minSdk = 24
targetSdk = 33 targetSdk = 33
versionCode = 77 versionCode = 78
versionName = "2.2.1" versionName = "2.2.1"
vectorDrawables { vectorDrawables {
useSupportLibrary = true useSupportLibrary = true

@ -196,6 +196,21 @@
-keepclassmembers class org.apache.commons.compress.archivers.zip.* { *; } -keepclassmembers class org.apache.commons.compress.archivers.zip.* { *; }
#-keep class com.fox2code.mmm.installer.InstallerInitializer { *; } #-keep class com.fox2code.mmm.installer.InstallerInitializer { *; }
# Strip out debugging stuffs
-assumenosideeffects class com.topjohnwu.superuser.internal.Utils {
public static void log(...);
public static void ex(...);
public static boolean vLog() return false;
public static boolean hasStartupAgents(android.content.Context) return false;
}
# Keep classes referenced by reflection
-keep,allowobfuscation class * extends com.topjohnwu.superuser.Shell$Initializer { *; }
-keep,allowobfuscation class * extends com.topjohnwu.superuser.ipc.RootService { *; }
-keep class com.topjohnwu.superuser.Shell$Job
-keep class com.topjohnwu.superuser.Shell$Result
-keep class com.topjohnwu.superuser.Shell
# dontwarn # dontwarn
-dontwarn android.os.SystemProperties -dontwarn android.os.SystemProperties
-dontwarn android.view.ThreadedRenderer -dontwarn android.view.ThreadedRenderer

@ -30,8 +30,8 @@ class InstallerInitializer : Shell.Initializer() {
private val MAGISK_SBIN = File("/sbin/magisk") private val MAGISK_SBIN = File("/sbin/magisk")
private val MAGISK_SYSTEM = File("/system/bin/magisk") private val MAGISK_SYSTEM = File("/system/bin/magisk")
private val MAGISK_SYSTEM_EX = File("/system/xbin/magisk") private val MAGISK_SYSTEM_EX = File("/system/xbin/magisk")
private val HAS_MAGISK = MAGISK_SBIN.exists() || private val HAS_MAGISK =
MAGISK_SYSTEM.exists() || MAGISK_SYSTEM_EX.exists() MAGISK_SBIN.exists() || MAGISK_SYSTEM.exists() || MAGISK_SYSTEM_EX.exists()
private var mgskPth: String? = null private var mgskPth: String? = null
private var mgskVerCode = 0 private var mgskVerCode = 0
private var hsRmdsk = false private var hsRmdsk = false
@ -43,9 +43,7 @@ class InstallerInitializer : Shell.Initializer() {
val errorNotification: NotificationType? val errorNotification: NotificationType?
get() { get() {
val hasRoot = Shell.isAppGrantedRoot() val hasRoot = Shell.isAppGrantedRoot()
if (mgskPth != null && if (mgskPth != null && hasRoot !== java.lang.Boolean.FALSE) {
hasRoot !== java.lang.Boolean.FALSE
) {
return null return null
} }
if (!HAS_MAGISK) { if (!HAS_MAGISK) {
@ -130,47 +128,46 @@ class InstallerInitializer : Shell.Initializer() {
if (mgskPth != null && !forceCheck) return mgskPth if (mgskPth != null && !forceCheck) return mgskPth
val output = ArrayList<String>() val output = ArrayList<String>()
try { try {
if (!Shell.cmd( if (!Shell.cmd(
"if grep ' / ' /proc/mounts | grep -q '/dev/root' &> /dev/null; " + "if grep ' / ' /proc/mounts | grep -q '/dev/root' &> /dev/null; " + "then echo true; else echo false; fi",
"then echo true; else echo false; fi", "magisk -V", "magisk --path" "magisk -V",
) "magisk --path"
.to(output).exec().isSuccess ).to(output).exec().isSuccess
) { ) {
if (output.size != 0) { if (output.size != 0) {
hsRmdsk = "false" == output[0] || hsRmdsk = "false" == output[0] || "true".equals(
"true".equals( System.getProperty("ro.build.ab_update"), ignoreCase = true
System.getProperty("ro.build.ab_update"), )
ignoreCase = true }
) Companion.hsRmdsk = hsRmdsk
return null
} }
Companion.hsRmdsk = hsRmdsk mgskPth = if (output.size < 3) "" else output[2]
return null Timber.i("Magisk runtime path: %s", mgskPth)
} mgskVerCode = output[1].toInt()
mgskPth = if (output.size < 3) "" else output[2] Timber.i("Magisk version code: %s", mgskVerCode)
Timber.i("Magisk runtime path: %s", mgskPth) if (mgskVerCode >= Constants.MAGISK_VER_CODE_FLAT_MODULES && mgskVerCode < Constants.MAGISK_VER_CODE_PATH_SUPPORT && (mgskPth.isEmpty() || !File(
mgskVerCode = output[1].toInt() mgskPth
Timber.i("Magisk version code: %s", mgskVerCode) ).exists())
if (mgskVerCode >= Constants.MAGISK_VER_CODE_FLAT_MODULES && mgskVerCode < Constants.MAGISK_VER_CODE_PATH_SUPPORT && ) {
(mgskPth.isEmpty() || !File(mgskPth).exists()) mgskPth = "/sbin"
) { }
mgskPth = "/sbin" if (mgskPth.isNotEmpty() && existsSU(File(mgskPth))) {
} Companion.mgskPth = mgskPth
if (mgskPth.isNotEmpty() && existsSU(File(mgskPth))) { } else {
Companion.mgskPth = mgskPth Timber.e("Failed to get Magisk path (Got $mgskPth)")
} else { mgskPth = null
Timber.e("Failed to get Magisk path (Got $mgskPth)") }
mgskPth = null Companion.mgskVerCode = mgskVerCode
} return mgskPth
Companion.mgskVerCode = mgskVerCode
return mgskPth
} catch (ignored: Exception) { } catch (ignored: Exception) {
if (tries < 5) { return if (tries < 5) {
tries++ tries++
return tryGetMagiskPath(true) tryGetMagiskPath(true)
} else { } else {
return null null
} }
} }
} }
} }
} }

@ -189,11 +189,9 @@ class ModuleHolder : Comparable<ModuleHolder?> {
INSTANCE!!.modulesHaveUpdates, INSTANCE!!.modulesHaveUpdates,
INSTANCE!!.updateModuleCount INSTANCE!!.updateModuleCount
) )
Timber.d("Module %s has update", moduleId)
Type.UPDATABLE Type.UPDATABLE
} }
} else { } else {
Timber.i("Module %s is installed", moduleId)
Type.INSTALLED Type.INSTALLED
} }

@ -1014,40 +1014,37 @@ class SettingsActivity : FoxActivity(), LanguageActivity {
try { try {
logsFile.createNewFile() logsFile.createNewFile()
fileOutputStream = FileOutputStream(logsFile) fileOutputStream = FileOutputStream(logsFile)
// first, write some info about the device // first, some device and app info: namely device oem and model, android version and build, app version and build
fileOutputStream.write( fileOutputStream.write(
"""FoxMagiskModuleManager version: ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE}) String.format(
""".toByteArray() "Device: %s %s\nAndroid Version: %s\nROM: %s\nApp Version: %s (%s)\n\n",
Build.MANUFACTURER,
Build.MODEL,
Build.VERSION.RELEASE,
Build.FINGERPRINT,
BuildConfig.VERSION_NAME,
BuildConfig.VERSION_CODE
).toByteArray()
) )
fileOutputStream.write( // next, the logs
"""Android version: ${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT}) // get our logs from logcat
""".toByteArray() val process = Runtime.getRuntime().exec("logcat -d")
) val bufferedReader = BufferedReader(
fileOutputStream.write( InputStreamReader(process.inputStream)
"""Device: ${Build.MANUFACTURER} ${Build.MODEL} (${Build.DEVICE})
""".toByteArray()
)
fileOutputStream.write(
"""Magisk version: ${peekMagiskVersion()}
""".toByteArray()
)
fileOutputStream.write(
("Has internet: " + (if (getINSTANCE()!!
.hasConnectivity()
) "Yes" else "No") + "\n").toByteArray()
) )
fileOutputStream.write("Beginning of logs:\n".toByteArray()) var line: String?
val iterator: Iterator<String> = bufferedReader.lines().iterator()
// read our logcat but format the output to be more readable while (iterator.hasNext()) {
val process = Runtime.getRuntime().exec("logcat -d -v tag") line = iterator.next()
val bufferedReader = BufferedReader(InputStreamReader(process.inputStream)) fileOutputStream.write(line.toByteArray())
var line: String fileOutputStream.write("\n".toByteArray())
while (bufferedReader.readLine().also { line = it } != null) {
fileOutputStream.write(
"""$line
""".toByteArray()
)
} }
fileOutputStream.flush()
Toast.makeText(
requireContext(),
R.string.logs_saved,
Toast.LENGTH_SHORT
).show()
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
Toast.makeText( Toast.makeText(

@ -383,4 +383,5 @@
<string name="expired">This build has expired!</string> <string name="expired">This build has expired!</string>
<string name="expired_message">The build you are using is expired and will no longer run. Please update to the latest stable build.</string> <string name="expired_message">The build you are using is expired and will no longer run. Please update to the latest stable build.</string>
<string name="download_latest">Download latest</string> <string name="download_latest">Download latest</string>
<string name="logs_saved">Saved logs successfully</string>
</resources> </resources>

Loading…
Cancel
Save