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"
minSdk = 24
targetSdk = 33
versionCode = 77
versionCode = 78
versionName = "2.2.1"
vectorDrawables {
useSupportLibrary = true

@ -196,6 +196,21 @@
-keepclassmembers class org.apache.commons.compress.archivers.zip.* { *; }
#-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 android.os.SystemProperties
-dontwarn android.view.ThreadedRenderer

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

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

@ -1014,40 +1014,37 @@ class SettingsActivity : FoxActivity(), LanguageActivity {
try {
logsFile.createNewFile()
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(
"""FoxMagiskModuleManager version: ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})
""".toByteArray()
String.format(
"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(
"""Android version: ${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT})
""".toByteArray()
)
fileOutputStream.write(
"""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()
// next, the logs
// get our logs from logcat
val process = Runtime.getRuntime().exec("logcat -d")
val bufferedReader = BufferedReader(
InputStreamReader(process.inputStream)
)
fileOutputStream.write("Beginning of logs:\n".toByteArray())
// read our logcat but format the output to be more readable
val process = Runtime.getRuntime().exec("logcat -d -v tag")
val bufferedReader = BufferedReader(InputStreamReader(process.inputStream))
var line: String
while (bufferedReader.readLine().also { line = it } != null) {
fileOutputStream.write(
"""$line
""".toByteArray()
)
var line: String?
val iterator: Iterator<String> = bufferedReader.lines().iterator()
while (iterator.hasNext()) {
line = iterator.next()
fileOutputStream.write(line.toByteArray())
fileOutputStream.write("\n".toByteArray())
}
fileOutputStream.flush()
Toast.makeText(
requireContext(),
R.string.logs_saved,
Toast.LENGTH_SHORT
).show()
} catch (e: IOException) {
e.printStackTrace()
Toast.makeText(

@ -383,4 +383,5 @@
<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="download_latest">Download latest</string>
<string name="logs_saved">Saved logs successfully</string>
</resources>

Loading…
Cancel
Save