Introduce a build configuration without accessibility services (#4625)

* Create `accessibility` flavor dimension

* Only use accessibility sleep method on withAccessibility builds

* Move LawnchairAccessibilityService manifest declaration to withAccessibility

* Revert "Create `accessibility` flavor dimension"

This reverts commit 1c180aa630.

* Use `github` instead of the new `withAccessibility` flavor

* Move manifest into channel/github

* Update quickstep/AndroidManifest-launcher.xml

---------

Co-authored-by: Goooler <wangzongler@gmail.com>
Co-authored-by: John Andrew Camu <werdna.jac@gmail.com>
This commit is contained in:
Yasan
2024-08-12 12:36:09 +02:00
committed by GitHub
parent 4bed2cc086
commit c776a2c524
4 changed files with 38 additions and 18 deletions

View File

@@ -285,6 +285,14 @@ android {
}
}
github {
manifest.srcFile "channel/github/AndroidManifest.xml"
}
market {
manifest.srcFile "channel/market/AndroidManifest.xml"
}
lawnWithQuickstepGithub {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<application tools:ignore="MissingApplicationIcon">
<service
android:name="app.lawnchair.LawnchairAccessibilityService"
android:exported="false"
android:label="@string/derived_app_name"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config" />
</service>
</application>
</manifest>

View File

@@ -93,19 +93,6 @@
</intent-filter>
</receiver>
<service
android:name="app.lawnchair.LawnchairAccessibilityService"
android:exported="false"
android:label="@string/derived_app_name"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config" />
</service>
<provider
android:name="app.lawnchair.bugreport.FileProvider"
android:authorities="${applicationId}.fileprovider"

View File

@@ -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
@@ -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_channel == "github") {
add(SleepMethodPieAccessibility(context))
}
add(SleepMethodDeviceAdmin(context))
}
sealed class SleepMethod(protected val context: Context) {
abstract suspend fun isSupported(): Boolean