Fixed bluetooth permissions on API levels < 30
This commit is contained in:
parent
1f1cb5ca17
commit
5739b33f06
|
@ -377,7 +377,12 @@ class SidebandApp(MDApp):
|
|||
mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
|
||||
Context = autoclass('android.content.Context')
|
||||
|
||||
if check_permission("android.permission.BLUETOOTH_CONNECT"):
|
||||
if android_api_version > 30:
|
||||
bt_permission_name = "android.permission.BLUETOOTH_CONNECT"
|
||||
else:
|
||||
bt_permission_name = "android.permission.BLUETOOTH"
|
||||
|
||||
if check_permission(bt_permission_name):
|
||||
RNS.log("Have bluetooth connect permissions", RNS.LOG_DEBUG)
|
||||
self.sideband.setpersistent("permissions.bluetooth", True)
|
||||
else:
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
|
||||
|
||||
{% for perm in args.permissions %}
|
||||
{% if '.' in perm %}
|
||||
<uses-permission android:name="{{ perm }}" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
__debug_build__ = False
|
||||
__debug_build__ = True
|
||||
|
||||
import time
|
||||
import RNS
|
||||
|
|
|
@ -1551,6 +1551,8 @@ class SidebandCore():
|
|||
else:
|
||||
target_port = None
|
||||
|
||||
bt_device_name = None
|
||||
rnode_allow_bluetooth = False
|
||||
if self.getpersistent("permissions.bluetooth"):
|
||||
if self.config["hw_rnode_bluetooth"]:
|
||||
# TODO: Remove
|
||||
|
@ -1558,8 +1560,7 @@ class SidebandCore():
|
|||
rnode_allow_bluetooth = True
|
||||
if self.config["hw_rnode_bt_device"] != None:
|
||||
bt_device_name = self.config["hw_rnode_bt_device"]
|
||||
else:
|
||||
bt_device_name = None
|
||||
|
||||
else:
|
||||
# TODO: Remove
|
||||
RNS.log("Disallowing RNode bluetooth since config is disabled")
|
||||
|
@ -1567,7 +1568,7 @@ class SidebandCore():
|
|||
else:
|
||||
# TODO: Remove
|
||||
RNS.log("Disallowing RNode bluetooth due to missing permission")
|
||||
rnode_allow_bluetooth = True
|
||||
rnode_allow_bluetooth = False
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue