From f9c5bcbc5d4b9f4902e16aec002cd7ca6dbb13f7 Mon Sep 17 00:00:00 2001 From: Akash Shah Date: Fri, 13 Oct 2023 11:04:39 -0400 Subject: [PATCH] Close BluetoothGatt after disconnect. (#382) This would cause issues on some readers with some devices. Left previous connection open and was prone to further unexpected communications. --- .../com/android/identity/android/mdoc/transport/GattClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/identity-android/src/main/java/com/android/identity/android/mdoc/transport/GattClient.java b/identity-android/src/main/java/com/android/identity/android/mdoc/transport/GattClient.java index 688ac96b8..a65e24111 100644 --- a/identity-android/src/main/java/com/android/identity/android/mdoc/transport/GattClient.java +++ b/identity-android/src/main/java/com/android/identity/android/mdoc/transport/GattClient.java @@ -547,6 +547,7 @@ void drainWritingQueue() { Logger.d(TAG, "Chunk is length 0, shutting down GattClient"); try { mGatt.disconnect(); + mGatt.close(); } catch (SecurityException e) { Logger.e(TAG, "Caught SecurityException while shutting down: " + e); }