Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/2522.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the ability to specify bluetooth permission.
4 changes: 4 additions & 0 deletions docs/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ starting from least to most specific, with the most specific taking priority.

Briefcase maintains a set of cross-platform permissions:

.. attribute:: permission.bluetooth

Permission to connect to an external device via Bluetooth.

.. attribute:: permission.camera

Permission to access the camera to take photos or video.
Expand Down
1 change: 1 addition & 0 deletions src/briefcase/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def _x_permissions(self, app: AppConfig):
return {
key: app.permission.pop(key, None)
for key in [
"bluetooth",
"camera",
"microphone",
"coarse_location",
Expand Down
6 changes: 6 additions & 0 deletions src/briefcase/platforms/android/gradle.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ def permissions_context(self, app: AppConfig, x_permissions: dict[str, str]):
# Default feature usage for all Android apps
features = {}

if x_permissions["bluetooth"]:
permissions["android.permission.BLUETOOTH"] = True
Comment thread
depaolim marked this conversation as resolved.
Outdated
permissions["android.permission.BLUETOOTH_ADMIN"] = True
permissions["android.permission.BLUETOOTH_CONNECT"] = True
permissions["android.permission.BLUETOOTH_SCAN"] = True

if x_permissions["camera"]:
permissions["android.permission.CAMERA"] = True
features["android.hardware.camera"] = False
Expand Down
18 changes: 18 additions & 0 deletions tests/platforms/android/gradle/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,24 @@ def test_extract_packages(create_command, first_app_config, test_sources, expect
"features": {},
},
),
# Bluetooth permissions
(
{
"bluetooth": "I need to connect to bluetooth device",
},
{},
{
"permissions": {
"android.permission.ACCESS_NETWORK_STATE": True,
"android.permission.BLUETOOTH": True,
"android.permission.BLUETOOTH_ADMIN": True,
"android.permission.BLUETOOTH_CONNECT": True,
"android.permission.BLUETOOTH_SCAN": True,
"android.permission.INTERNET": True,
},
"features": {},
},
),
# Override and augment by cross-platform definitions
(
{
Expand Down