Skip to content

Commit 1a9da5d

Browse files
fix ksu detection
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent edc4ad6 commit 1a9da5d

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

app/src/main/kotlin/com/fox2code/mmm/installer/InstallerInitializer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class InstallerInitializer {
162162
if (BuildConfig.DEBUG) {
163163
Timber.i("Magisk path 1: %s", mgskPth)
164164
}
165-
} else if (Shell.cmd("if [ -f /data/adb/ksu ]; then echo true; else echo false; fi").to(
165+
} else if (Shell.cmd("if [ -d /data/adb/ksu ] && [ -f /data/adb/ksud ]; then echo true; else echo false; fi", "su -V").to(
166166
output
167167
).exec().isSuccess && "true" == output[0]
168168
) {

app/src/main/kotlin/com/fox2code/mmm/utils/sentry/SentryMain.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.fox2code.mmm.CrashHandler
1414
import com.fox2code.mmm.MainApplication
1515
import com.fox2code.mmm.androidacy.AndroidacyUtil.Companion.hideToken
1616
import com.fox2code.mmm.androidacy.AndroidacyUtil.Companion.isAndroidacyLink
17+
import com.fox2code.mmm.utils.io.net.HttpException
1718
import io.sentry.Breadcrumb
1819
import io.sentry.Hint
1920
import io.sentry.Sentry
@@ -129,16 +130,26 @@ object SentryMain {
129130
return@BeforeSendCallback null
130131
}
131132
crashExceptionId = event?.eventId
132-
// if debug build, log everything, but for release only log warnings and errors
133+
// if debug build, log everything, but for release only log errors
133134
if (!BuildConfig.DEBUG) {
134-
if (event?.level == SentryLevel.DEBUG || event?.level == SentryLevel.INFO) {
135+
if (event?.level == SentryLevel.DEBUG || event?.level == SentryLevel.INFO || event?.level == SentryLevel.WARNING) {
135136
return@BeforeSendCallback null
136137
}
137138
}
138139
// remove all failed to fetch data messages
139-
if (event?.message?.message?.contains("Failed to fetch") == true) {
140+
if (event?.message?.message?.contains("Failed to fetch") == true || event?.message?.message?.contains("Failed to load") == true) {
140141
return@BeforeSendCallback null
141142
}
143+
// for httpexception, do not send if error is 401, 403, 404, 429
144+
// get exception from event
145+
val exception = event?.throwable ?: return@BeforeSendCallback event
146+
// check status code
147+
if (exception is HttpException) {
148+
if (exception.errorCode in intArrayOf(401, 403, 404, 429)) {
149+
return@BeforeSendCallback null
150+
}
151+
}
152+
// if exception is null, return event
142153
event
143154
}
144155
// Filter breadcrumb content from crash report.

0 commit comments

Comments
 (0)