Fix crash when looking up ALWAYS_FINISH_ACTIVITIES

pull/3792/head
Alex Baker 4 months ago
parent 977edf4d8d
commit 07ac9f9ead

@ -26,15 +26,15 @@ class Device @Inject constructor(
val pm = context.packageManager val pm = context.packageManager
val activities = val activities =
pm.queryIntentActivities(Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0) pm.queryIntentActivities(Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0)
return (activities.size != 0) return activities.isNotEmpty()
} }
private fun isDontKeepActivitiesEnabled(): Boolean { private fun isDontKeepActivitiesEnabled(): Boolean? {
return try { return try {
Settings.Global.getInt(context.contentResolver, Settings.Global.ALWAYS_FINISH_ACTIVITIES) == 1 Settings.Global.getInt(context.contentResolver, Settings.Global.ALWAYS_FINISH_ACTIVITIES) == 1
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e) Timber.e("failed to fetch ${Settings.Global.ALWAYS_FINISH_ACTIVITIES}: ${e.message}")
false null
} }
} }

Loading…
Cancel
Save