Fix NPE in permissionCheck
permissionCheck can throw NPE when notification is received before
GATT database is discovered. Assume that permission is granted when
receiving notifications for unknown characteristic.
Bug: 30853729
Change-Id: I02aab1197b036584b2021d76f290c2c57db24a19
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java
index 7a164c6..854e9ae 100644
--- a/src/com/android/bluetooth/gatt/GattService.java
+++ b/src/com/android/bluetooth/gatt/GattService.java
@@ -222,6 +222,7 @@
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()) {