Fix SecurityException crashes

This commit is contained in:
Mygod
2018-06-13 19:25:35 +08:00
parent 09690f19c8
commit 836292b5cc

View File

@@ -23,15 +23,24 @@ object ManageBar : Manager() {
context.startActivity(Intent()
.setClassName("com.android.settings", "com.android.settings.Settings\$TetherSettingsActivity"))
} catch (e: ActivityNotFoundException) {
try {
context.startActivity(Intent()
.setClassName("com.android.settings", "com.android.settings.TetherSettings"))
e.printStackTrace()
Crashlytics.logException(e)
} catch (e: ActivityNotFoundException) {
e.printStackTrace()
Crashlytics.logException(e)
}
startAlternative(context, e)
} catch (e: SecurityException) {
startAlternative(context, e)
}
}
private fun startAlternative(context: Context, e: Exception) {
try {
context.startActivity(Intent()
.setClassName("com.android.settings", "com.android.settings.TetherSettings"))
e.printStackTrace()
Crashlytics.logException(e)
} catch (e: ActivityNotFoundException) {
e.printStackTrace()
Crashlytics.logException(e)
} catch (e: SecurityException) {
e.printStackTrace()
Crashlytics.logException(e)
}
}
}