summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/gatt/GattService.java
diff options
context:
space:
mode:
authorLalit Kansara <lkansara@codeaurora.org>2016-12-06 14:47:45 +0530
committerLalit Kansara <lkansara@codeaurora.org>2016-12-06 14:47:45 +0530
commitaa2a937e6c8c9c93cc1a5fe344c368b4276243c1 (patch)
tree05648e985b986d372f3a3d7f60cab8d6b77e244d /src/com/android/bluetooth/gatt/GattService.java
parentc7ae94e96c0c7bb93ec80d548c024a968c411d32 (diff)
parent1c40f9218d815e4e67482fb8913fce6850e4fb1c (diff)
downloadandroid_packages_apps_Bluetooth-aa2a937e6c8c9c93cc1a5fe344c368b4276243c1.tar.gz
android_packages_apps_Bluetooth-aa2a937e6c8c9c93cc1a5fe344c368b4276243c1.tar.bz2
android_packages_apps_Bluetooth-aa2a937e6c8c9c93cc1a5fe344c368b4276243c1.zip
Merge commit '1c40f9218d815e4e67482fb8913fce6850e4fb1c' into remote
Conflicts: jni/com_android_bluetooth_hfp.cpp src/com/android/bluetooth/avrcp/Avrcp.java src/com/android/bluetooth/btservice/AdapterService.java src/com/android/bluetooth/btservice/RemoteDevices.java src/com/android/bluetooth/hfp/HeadsetStateMachine.java src/com/android/bluetooth/map/BluetoothMapContentObserver.java src/com/android/bluetooth/map/BluetoothMapService.java src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java src/com/android/bluetooth/pan/PanService.java src/com/android/bluetooth/pbap/BluetoothPbapReceiver.java Change-Id: I41068ac7787983519220fe6fee1e65ff66298db1
Diffstat (limited to 'src/com/android/bluetooth/gatt/GattService.java')
-rw-r--r--src/com/android/bluetooth/gatt/GattService.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java
index 0595ae510..f8bef759d 100644
--- a/src/com/android/bluetooth/gatt/GattService.java
+++ b/src/com/android/bluetooth/gatt/GattService.java
@@ -237,6 +237,7 @@ public class GattService extends ProfileService {
boolean permissionCheck(int connId, int handle) {
List<BluetoothGattService> db = gattClientDatabases.get(connId);
+ if (db == null) return true;
for (BluetoothGattService service : db) {
for (BluetoothGattCharacteristic characteristic: service.getCharacteristics()) {
@@ -759,7 +760,15 @@ public class GattService extends ProfileService {
void onSearchCompleted(int connId, int status) throws RemoteException {
if (DBG) Log.d(TAG, "onSearchCompleted() - connId=" + connId+ ", status=" + status);
// Gatt DB is ready!
- gattClientGetGattDbNative(connId);
+
+ // This callback was called from the jni_workqueue thread. If we make request to the stack
+ // on the same thread, it might cause deadlock. Schedule request on a new thread instead.
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ gattClientGetGattDbNative(connId);
+ }
+ });
+ t.start();
}
GattDbElement GetSampleGattDbElement() {
@@ -1638,12 +1647,11 @@ public class GattService extends ProfileService {
void connectionParameterUpdate(int clientIf, String address, int connectionPriority) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- // Default spec recommended interval is 30->50 ms
- int minInterval = 24; // 24 * 1.25ms = 30ms
- int maxInterval = 40; // 40 * 1.25ms = 50ms
+ int minInterval;
+ int maxInterval;
// Slave latency
- int latency = 0;
+ int latency;
// Link supervision timeout is measured in N * 10ms
int timeout = 2000; // 20s
@@ -1653,12 +1661,22 @@ public class GattService extends ProfileService {
case BluetoothGatt.CONNECTION_PRIORITY_HIGH:
minInterval = getResources().getInteger(R.integer.gatt_high_priority_min_interval);
maxInterval = getResources().getInteger(R.integer.gatt_high_priority_max_interval);
+ latency = getResources().getInteger(R.integer.gatt_high_priority_latency);
break;
case BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER:
minInterval = getResources().getInteger(R.integer.gatt_low_power_min_interval);
maxInterval = getResources().getInteger(R.integer.gatt_low_power_max_interval);
- latency = 2;
+ latency = getResources().getInteger(R.integer.gatt_low_power_latency);
+ break;
+
+ default:
+ // Using the values for CONNECTION_PRIORITY_BALANCED.
+ minInterval =
+ getResources().getInteger(R.integer.gatt_balanced_priority_min_interval);
+ maxInterval =
+ getResources().getInteger(R.integer.gatt_balanced_priority_max_interval);
+ latency = getResources().getInteger(R.integer.gatt_balanced_priority_latency);
break;
}