Fix SecurityException crashes

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

View File

@@ -23,6 +23,13 @@ object ManageBar : Manager() {
context.startActivity(Intent()
.setClassName("com.android.settings", "com.android.settings.Settings\$TetherSettingsActivity"))
} catch (e: ActivityNotFoundException) {
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"))
@@ -31,7 +38,9 @@ object ManageBar : Manager() {
} catch (e: ActivityNotFoundException) {
e.printStackTrace()
Crashlytics.logException(e)
}
} catch (e: SecurityException) {
e.printStackTrace()
Crashlytics.logException(e)
}
}
}