Skip to content

Commit

Permalink
Only use accessibility sleep method on withAccessibility builds
Browse files Browse the repository at this point in the history
  • Loading branch information
yasanglass committed Aug 10, 2024
1 parent fdb661b commit dc3f120
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import app.lawnchair.lawnchairApp
import app.lawnchair.ui.ModalBottomSheetContent
import app.lawnchair.util.requireSystemService
import app.lawnchair.views.ComposeBottomSheet
import com.android.launcher3.BuildConfig
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.topjohnwu.superuser.Shell
Expand All @@ -51,11 +52,13 @@ class SleepGestureHandler(context: Context) : GestureHandler(context) {
methods.first { it.isSupported() }.sleep(launcher)
}

private val methods = listOf(
SleepMethodRoot(context),
SleepMethodPieAccessibility(context),
SleepMethodDeviceAdmin(context),
)
private val methods = buildList {
add(SleepMethodRoot(context))
if (BuildConfig.FLAVOR_accessibility == "withAccessibility") {
add(SleepMethodPieAccessibility(context))
}
add(SleepMethodDeviceAdmin(context))
}

sealed class SleepMethod(protected val context: Context) {
abstract suspend fun isSupported(): Boolean
Expand Down

0 comments on commit dc3f120

Please sign in to comment.