Skip to content

Commit

Permalink
Fix probable incorrect auto start state
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxiongjun committed Sep 15, 2021
1 parent 6a3b4d3 commit 4e3480d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ fun setAutoStartComponentEnable(enabled: Boolean) {
}

fun isShizukuAutoStartEnabled(): Boolean {
return isComponentEnabled(shizukuAutoStartComponentName)
return isComponentEnabled(shizukuAutoStartComponentName, true)
}

private fun isComponentEnabled(componentName: ComponentName): Boolean {
private fun isComponentEnabled(componentName: ComponentName, def: Boolean = false): Boolean {
return try {
when (packageManager.getComponentEnabledSetting(componentName)) {
PackageManager.COMPONENT_ENABLED_STATE_DISABLED -> false
PackageManager.COMPONENT_ENABLED_STATE_ENABLED -> true
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT -> false
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT -> def
else -> false
}
} catch (t: Throwable) {
Expand Down

0 comments on commit 4e3480d

Please sign in to comment.