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() context.startActivity(Intent()
.setClassName("com.android.settings", "com.android.settings.Settings\$TetherSettingsActivity")) .setClassName("com.android.settings", "com.android.settings.Settings\$TetherSettingsActivity"))
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
try { startAlternative(context, e)
context.startActivity(Intent() } catch (e: SecurityException) {
.setClassName("com.android.settings", "com.android.settings.TetherSettings")) startAlternative(context, e)
e.printStackTrace() }
Crashlytics.logException(e) }
} catch (e: ActivityNotFoundException) {
e.printStackTrace() private fun startAlternative(context: Context, e: Exception) {
Crashlytics.logException(e) 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)
} }
} }
} }