Hearing Aid: Clean up GATT on disconnect

When user requests Disconnect(), after disconnecting GATT,
OnGattDisconnected() never cleans up GATT queue, because the
corresponding device is already removed from HearingDevices. We need to
clean up the queue before connecting the same device again. Without the
fix, sometimes ACL is connected, but the host failed to read GATT
characteristic to open COC. Also clean up connection update status
during disconnect

Bug: 116317072
Bug: 115365334
Test: connect to both devices -> disconnect -> connect, and repeat
Change-Id: I158b19b3d1f2cb2123ec554eb1ffe8c842df998e
diff --git a/bta/hearing_aid/hearing_aid.cc b/bta/hearing_aid/hearing_aid.cc
index e49875e..27780ef 100644
--- a/bta/hearing_aid/hearing_aid.cc
+++ b/bta/hearing_aid/hearing_aid.cc
@@ -1106,6 +1106,8 @@
     // cancel autoconnect
     BTA_GATTC_CancelOpen(gatt_if, address, false);
 
+    DoDisconnectCleanUp(hearingDevice);
+
     hearingDevices.Remove(address);
 
     if (connected)
@@ -1121,22 +1123,26 @@
       return;
     }
 
+    DoDisconnectCleanUp(hearingDevice);
+
+    callbacks->OnConnectionState(ConnectionState::DISCONNECTED, remote_bda);
+  }
+
+  void DoDisconnectCleanUp(HearingDevice* hearingDevice) {
     if (hearingDevice->connection_update_status != NONE) {
       LOG(INFO) << __func__ << ": connection update not completed. Current="
                 << hearingDevice->connection_update_status;
 
       if (hearingDevice->connection_update_status == STARTED) {
-        OnConnectionUpdateComplete(conn_id);
+        OnConnectionUpdateComplete(hearingDevice->conn_id);
       }
       hearingDevice->connection_update_status = NONE;
     }
 
+    BtaGattQueue::Clean(hearingDevice->conn_id);
+
     hearingDevice->accepting_audio = false;
     hearingDevice->conn_id = 0;
-
-    BtaGattQueue::Clean(conn_id);
-
-    callbacks->OnConnectionState(ConnectionState::DISCONNECTED, remote_bda);
   }
 
   void SetVolume(int8_t volume) override {