Loading android/app/src/com/android/bluetooth/gatt/GattService.java +21 −10 Original line number Diff line number Diff line Loading @@ -2913,7 +2913,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2944,7 +2944,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2985,7 +2985,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3027,7 +3027,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3311,15 +3311,26 @@ public class GattService extends ProfileService { return; } Log.v(TAG, "sendResponse() - address=" + address); Log.v(TAG, "sendResponse() - address=" + address + ", requestId=" + requestId); int handle = 0; Integer connId = 0; if (!Flags.gattServerRequestsFix()) { HandleMap.Entry entry = mHandleMap.getByRequestId(requestId); if (entry != null) { handle = entry.handle; } Integer connId = mServerMap.connIdByAddress(serverIf, address); connId = mServerMap.connIdByAddress(serverIf, address); } else { HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId); if (requestData != null) { handle = requestData.mHandle; connId = requestData.mConnId; } else { connId = mServerMap.connIdByAddress(serverIf, address); } } mNativeInterface.gattServerSendResponse( serverIf, connId != null ? connId : 0, Loading android/app/src/com/android/bluetooth/gatt/HandleMap.java +34 −5 Original line number Diff line number Diff line Loading @@ -86,13 +86,23 @@ class HandleMap { } } static class RequestData { int mConnId; int mHandle; RequestData(int connId, int handle) { mConnId = connId; mHandle = handle; } } List<Entry> mEntries = null; Map<Integer, Integer> mRequestMap = null; Map<Integer, RequestData> mRequestMap = null; int mLastCharacteristic = 0; HandleMap() { mEntries = new CopyOnWriteArrayList<Entry>(); mRequestMap = new ConcurrentHashMap<Integer, Integer>(); mRequestMap = new ConcurrentHashMap<Integer, RequestData>(); } void clear() { Loading Loading @@ -170,8 +180,8 @@ class HandleMap { return mEntries; } void addRequest(int requestId, int handle) { mRequestMap.put(requestId, handle); void addRequest(int connId, int requestId, int handle) { mRequestMap.put(requestId, new RequestData(connId, handle)); } void deleteRequest(int requestId) { Loading @@ -179,7 +189,12 @@ class HandleMap { } Entry getByRequestId(int requestId) { Integer handle = mRequestMap.get(requestId); Integer handle = null; RequestData data = mRequestMap.get(requestId); if (data != null) { handle = data.mHandle; } if (handle == null) { Log.e(TAG, "getByRequestId() - Request ID " + requestId + " not found!"); return null; Loading @@ -187,6 +202,20 @@ class HandleMap { return getByHandle(handle); } RequestData getRequestDataByRequestId(int requestId) { RequestData data = mRequestMap.get(requestId); if (data == null) { Log.e(TAG, "getRequestDataByRequestId() - Request ID " + requestId + " not found!"); } else { Log.d( TAG, ("getRequestDataByRequestId(), requestId=" + requestId) + (", connId=" + data.mConnId + ",handle=" + data.mHandle)); } return data; } /** Logs debug information. */ void dump(StringBuilder sb) { sb.append(" Entries: ").append(mEntries.size()).append("\n"); Loading Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +21 −10 Original line number Diff line number Diff line Loading @@ -2913,7 +2913,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2944,7 +2944,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2985,7 +2985,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3027,7 +3027,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3311,15 +3311,26 @@ public class GattService extends ProfileService { return; } Log.v(TAG, "sendResponse() - address=" + address); Log.v(TAG, "sendResponse() - address=" + address + ", requestId=" + requestId); int handle = 0; Integer connId = 0; if (!Flags.gattServerRequestsFix()) { HandleMap.Entry entry = mHandleMap.getByRequestId(requestId); if (entry != null) { handle = entry.handle; } Integer connId = mServerMap.connIdByAddress(serverIf, address); connId = mServerMap.connIdByAddress(serverIf, address); } else { HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId); if (requestData != null) { handle = requestData.mHandle; connId = requestData.mConnId; } else { connId = mServerMap.connIdByAddress(serverIf, address); } } mNativeInterface.gattServerSendResponse( serverIf, connId != null ? connId : 0, Loading
android/app/src/com/android/bluetooth/gatt/HandleMap.java +34 −5 Original line number Diff line number Diff line Loading @@ -86,13 +86,23 @@ class HandleMap { } } static class RequestData { int mConnId; int mHandle; RequestData(int connId, int handle) { mConnId = connId; mHandle = handle; } } List<Entry> mEntries = null; Map<Integer, Integer> mRequestMap = null; Map<Integer, RequestData> mRequestMap = null; int mLastCharacteristic = 0; HandleMap() { mEntries = new CopyOnWriteArrayList<Entry>(); mRequestMap = new ConcurrentHashMap<Integer, Integer>(); mRequestMap = new ConcurrentHashMap<Integer, RequestData>(); } void clear() { Loading Loading @@ -170,8 +180,8 @@ class HandleMap { return mEntries; } void addRequest(int requestId, int handle) { mRequestMap.put(requestId, handle); void addRequest(int connId, int requestId, int handle) { mRequestMap.put(requestId, new RequestData(connId, handle)); } void deleteRequest(int requestId) { Loading @@ -179,7 +189,12 @@ class HandleMap { } Entry getByRequestId(int requestId) { Integer handle = mRequestMap.get(requestId); Integer handle = null; RequestData data = mRequestMap.get(requestId); if (data != null) { handle = data.mHandle; } if (handle == null) { Log.e(TAG, "getByRequestId() - Request ID " + requestId + " not found!"); return null; Loading @@ -187,6 +202,20 @@ class HandleMap { return getByHandle(handle); } RequestData getRequestDataByRequestId(int requestId) { RequestData data = mRequestMap.get(requestId); if (data == null) { Log.e(TAG, "getRequestDataByRequestId() - Request ID " + requestId + " not found!"); } else { Log.d( TAG, ("getRequestDataByRequestId(), requestId=" + requestId) + (", connId=" + data.mConnId + ",handle=" + data.mHandle)); } return data; } /** Logs debug information. */ void dump(StringBuilder sb) { sb.append(" Entries: ").append(mEntries.size()).append("\n"); Loading