Skip to content

Grant Bluetooth runtime permissions for MultipeerReplicator on Android#421

Merged
barkha06 merged 3 commits into
mainfrom
bt-permissions
Jun 8, 2026
Merged

Grant Bluetooth runtime permissions for MultipeerReplicator on Android#421
barkha06 merged 3 commits into
mainfrom
bt-permissions

Conversation

@pasin

@pasin pasin commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
  • Declare permissions required for Bluetooth in AndroidManifest.xml

  • AndroidBridge.install: run "adb pm grant" for the dangerous runtime permissions after install so the test server never blocks on a system permission dialog. Noted that this step is only required for MultipeerReplicator testing with bluetooth. When running the test manually on your local device (not via Jenkins pipeline, this step is also required. Here are the sample commands :

    adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.BLUETOOTH_SCAN
    adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.BLUETOOTH_CONNECT
    adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.BLUETOOTH_ADVERTISE
    adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.ACCESS_FINE_LOCATION
    
  • Fix missing semicolon on the EnumSet import in MultipeerReplicatorManager

* Declare permissions required for Bluetooth in AndroidManifest.xml

* AndroidBridge.install: run "adb pm grant" for the dangerous runtime permissions after install so the test server never blocks on a system permission dialog. Noted that this step is only required for MultipeerReplicator testing with bluetooth. When running the test manually on your local device (not via Jenkins pipeline, this step is also required. Here are the sample commands :

```
adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.BLUETOOTH_SCAN
adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.BLUETOOTH_CONNECT
adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.BLUETOOTH_ADVERTISE
adb shell pm grant com.couchbase.lite.android.mobiletest android.permission.ACCESS_FINE_LOCATION
```
- Fix missing semicolon on the EnumSet import in MultipeerReplicatorManager

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Android JAK test server harness to ensure MultipeerReplicator Bluetooth transport can run unattended (e.g., in CI) by declaring the required Bluetooth permissions and pre-granting dangerous runtime permissions after installation, avoiding blocking system permission dialogs.

Changes:

  • Declare Bluetooth-related permissions in the AndroidManifest for both API ≤ 30 and API 31+.
  • Add a fail-fast permission sanity check before starting a MultipeerReplicator, with explicit adb pm grant commands in the error message.
  • Update the AWS Android bridge to grant relevant runtime permissions immediately after APK install; also fixes a missing EnumSet import semicolon.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
servers/jak/android/app/src/main/java/com/couchbase/lite/android/mobiletest/services/MultipeerReplicatorService.java Adds a pre-start missing-permissions check that fails fast with actionable adb pm grant guidance.
servers/jak/android/app/src/main/java/com/couchbase/lite/android/mobiletest/endpoints/v1/MultipeerReplicatorManager.java Fixes EnumSet import syntax (missing semicolon).
servers/jak/android/app/src/main/java/com/couchbase/lite/android/mobiletest/AndroidTestApp.kt Exposes Android Context via getContext() for permission checks.
servers/jak/android/app/src/main/AndroidManifest.xml Declares Bluetooth permissions for MultipeerReplicator across Android API levels.
environment/aws/topology_setup/test_server_platforms/android_bridge.py Grants MultipeerReplicator-related dangerous permissions post-install via adb.

Comment thread servers/jak/android/app/src/main/AndroidManifest.xml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@barkha06 barkha06 merged commit 9f25a4a into main Jun 8, 2026
5 checks passed
@barkha06 barkha06 deleted the bt-permissions branch June 8, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants