fix a crash or two

can't catch em all

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head
androidacy-user 3 years ago
parent 69abdf8864
commit e5b839b823

@ -53,8 +53,8 @@ android {
applicationId = "com.fox2code.mmm"
minSdk = 24
targetSdk = 33
versionCode = 78
versionName = "2.2.1"
versionCode = 79
versionName = "2.2.2"
vectorDrawables {
useSupportLibrary = true
}
@ -118,6 +118,7 @@ android {
)
renderscriptOptimLevel = 3
signingConfig = signingConfigs.getByName("release")
multiDexEnabled = true
}
getByName("debug") {
applicationIdSuffix = ".debug"

@ -17,6 +17,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.textview.MaterialTextView
import io.sentry.Sentry
import io.sentry.UserFeedback
import io.sentry.protocol.SentryId
import timber.log.Timber
import java.io.PrintWriter
import java.io.StringWriter
@ -84,20 +85,18 @@ class CrashHandler : FoxActivity() {
val emailString =
arrayOf(if (email.text.toString() == "") "Anonymous" else email.text.toString())
// get sentryException passed in intent
val sentryException = intent.getSerializableExtra("sentryException") as Throwable?
@Suppress("NAME_SHADOWING") val lastEventId = Sentry.getLastEventId()
Thread {
try {
val userFeedback: UserFeedback
if (sentryException != null) {
userFeedback = UserFeedback(Sentry.captureException(sentryException))
// Setups the JSON body
if (nameString[0] == "") nameString[0] = "Anonymous"
if (emailString[0] == "") emailString[0] = "Anonymous"
userFeedback.name = nameString[0]
userFeedback.email = emailString[0]
userFeedback.comments = description.text.toString()
Sentry.captureUserFeedback(userFeedback)
}
val userFeedback =
UserFeedback(SentryId(lastEventId.toString()))
// Setups the JSON body
if (nameString[0] == "") nameString[0] = "Anonymous"
if (emailString[0] == "") emailString[0] = "Anonymous"
userFeedback.name = nameString[0]
userFeedback.email = emailString[0]
userFeedback.comments = description.text.toString()
Sentry.captureUserFeedback(userFeedback)
Timber.i(
"Submitted user feedback: name %s email %s comment %s",
nameString[0],
@ -106,9 +105,7 @@ class CrashHandler : FoxActivity() {
)
runOnUiThread {
Toast.makeText(
this,
R.string.sentry_dialogue_success,
Toast.LENGTH_LONG
this, R.string.sentry_dialogue_success, Toast.LENGTH_LONG
).show()
}
// Close the activity
@ -120,9 +117,7 @@ class CrashHandler : FoxActivity() {
// Show a toast if the user feedback could not be submitted
runOnUiThread {
Toast.makeText(
this,
R.string.sentry_dialogue_failed_toast,
Toast.LENGTH_LONG
this, R.string.sentry_dialogue_failed_toast, Toast.LENGTH_LONG
).show()
}
}
@ -151,9 +146,7 @@ class CrashHandler : FoxActivity() {
(findViewById<View>(R.id.feedback_text) as MaterialTextView).setText(R.string.sentry_enable_nag)
findViewById<View>(R.id.feedback_submit).setOnClickListener { _: View? ->
Toast.makeText(
this,
R.string.sentry_dialogue_disabled,
Toast.LENGTH_LONG
this, R.string.sentry_dialogue_disabled, Toast.LENGTH_LONG
).show()
}
// handle restart button

@ -68,7 +68,6 @@ class InstallerInitializer : Shell.Initializer() {
/**
* Note: Used to detect which modules are currently loaded.
*
*
* For read/write only "/data/adb/modules" should be used
*/
fun peekModulesPath(): String? {
@ -161,8 +160,14 @@ class InstallerInitializer : Shell.Initializer() {
Companion.mgskVerCode = mgskVerCode
return mgskPth
} catch (ignored: Exception) {
return if (tries < 5) {
return if (tries <= 5) {
tries++
// sleep tries * 25ms
try {
Thread.sleep(tries * 25L)
} catch (e: InterruptedException) {
Timber.e(e)
}
tryGetMagiskPath(true)
} else {
null

@ -51,25 +51,44 @@ enum class ActionButtonType {
TrackHelper.track().event("view_notes", name).with(INSTANCE!!.getTracker())
val notesUrl = moduleHolder.repoModule?.notesUrl
if (isAndroidacyLink(notesUrl)) {
openUrlAndroidacy(
button.context,
notesUrl,
false,
moduleHolder.repoModule?.moduleInfo?.name,
moduleHolder.mainModuleConfig
)
try {
openUrlAndroidacy(
button.context,
notesUrl,
false,
moduleHolder.repoModule?.moduleInfo?.name,
moduleHolder.mainModuleConfig
)
} catch (e: Exception) {
Timber.e(e)
Timber.e("Error opening notes - androidacy link. This should never happen.")
Toast.makeText(
button.context,
R.string.error_opening_notes,
Toast.LENGTH_SHORT
).show()
}
} else {
openMarkdown(
button.context,
notesUrl,
moduleHolder.repoModule?.moduleInfo?.name,
moduleHolder.mainModuleConfig,
moduleHolder.repoModule?.moduleInfo?.changeBoot,
moduleHolder.repoModule?.moduleInfo?.needRamdisk,
moduleHolder.repoModule?.moduleInfo?.minMagisk ?: 0,
moduleHolder.repoModule?.moduleInfo?.minApi ?: 0,
moduleHolder.repoModule?.moduleInfo?.maxApi ?: 9999
)
try {
openMarkdown(
button.context,
notesUrl,
moduleHolder.repoModule?.moduleInfo?.name,
moduleHolder.mainModuleConfig,
moduleHolder.repoModule?.moduleInfo?.changeBoot,
moduleHolder.repoModule?.moduleInfo?.needRamdisk,
moduleHolder.repoModule?.moduleInfo?.minMagisk ?: 0,
moduleHolder.repoModule?.moduleInfo?.minApi ?: 0,
moduleHolder.repoModule?.moduleInfo?.maxApi ?: 9999
)
} catch (e: Exception) {
Timber.e(e)
Toast.makeText(
button.context,
R.string.error_opening_notes,
Toast.LENGTH_SHORT
).show()
}
}
}

@ -70,7 +70,7 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
for (repoData in repoData.values) {
if (repoData === androidacyRepoData) {
if (x) {
Timber.e("Multiple Androidacy repo detected")
//
} else {
x = true
}
@ -229,7 +229,7 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
for (i in repoDatas.indices) {
// If repo is not enabled, skip
if (!repoDatas[i].isEnabled) {
if (BuildConfig.DEBUG) Timber.d("Skipping " + repoDatas[i].name + " because it's disabled")
if (BuildConfig.DEBUG) Timber.d("Skipping ${repoDatas[i].name} because it's disabled")
continue
}
if (BuildConfig.DEBUG) Timber.d("Finishing: %s", repoUpdaters[i]!!.repoData.name)

@ -115,6 +115,7 @@ object SentryMain {
options.addInAppInclude("com.fox2code.mmm.debug")
options.addInAppInclude("com.fox2code.mmm.fdroid")
options.addInAppExclude("com.fox2code.mmm.utils.sentry.SentryMain")
options.addInAppInclude("com.fox2code.mmm.utils")
// Respect user preference for sending PII. default is true on non fdroid builds, false on fdroid builds
options.isSendDefaultPii = crashReportingPii
options.enableAllAutoBreadcrumbs(true)
@ -123,7 +124,7 @@ object SentryMain {
// It just tell if sentry should ping the sentry dsn to tell the app is running. Useful for performance and profiling.
options.isEnableAutoSessionTracking = true
// disable crash tracking - we handle that ourselves
options.isEnableUncaughtExceptionHandler = false
options.isEnableUncaughtExceptionHandler = true
// Add a callback that will be used before the event is sent to Sentry.
// With this callback, you can modify the event or, when returning null, also discard the event.
options.beforeSend = BeforeSendCallback { event: SentryEvent?, _: Hint? ->

@ -384,4 +384,5 @@
<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>
<string name="error_opening_notes">Error in opening module notes. Logs may have the reason.</string>
</resources>

@ -12,20 +12,15 @@ buildscript {
}
gradlePluginPortal()
}
extra.apply {
set("sentryConfigFile", rootProject.file("sentry.properties"))
set("hasSentryConfig", false)
set("sentryVersion", "6.18.1")
}
dependencies {
classpath("com.android.tools.build:gradle:8.1.0-rc01")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22")
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.6.2")
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.8.0")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath("io.sentry:sentry-android-gradle-plugin:3.11.0")
classpath("org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin:2.7.1")
classpath("org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin:2.7.2")
}
}

Loading…
Cancel
Save