Do not deregister HH GATT IF in bta_gattc_disable for hid over GATT

The root cause is bta_gattc_disable de-register the HH GATT IF
which cause  bta_hh_cleanup_disable called
before we receive BTA_HH_INT_CLOSE_EVT.
The fix is "don't deregister HH GATT IF  in bta_gattc_disable and
let HH module to de-register the HH GATT IF by bta_hh_le_deregister".
because HH GATT IF is a special GATT IF
which won't be exposed to uplayer and
HH GATT IF belong to BTA HH module, it should be managed by BTA HH.
bug:11284861

Change-Id: Ia14cd2be3f3548a4d1e2dcfbc89fa3a75d9651db
diff --git a/bta/Android.mk b/bta/Android.mk
index 2a2551f..f4b8a7e 100644
--- a/bta/Android.mk
+++ b/bta/Android.mk
@@ -88,6 +88,7 @@
                    $(LOCAL_PATH)/include \
                    $(LOCAL_PATH)/sys \
                    $(LOCAL_PATH)/dm \
+                   $(LOCAL_PATH)/hh \
                    $(LOCAL_PATH)/../gki/common \
                    $(LOCAL_PATH)/../gki/ulinux \
                    $(LOCAL_PATH)/../include \
diff --git a/bta/gatt/bta_gattc_act.c b/bta/gatt/bta_gattc_act.c
index 8ab7992..f5b60fa 100644
--- a/bta/gatt/bta_gattc_act.c
+++ b/bta/gatt/bta_gattc_act.c
@@ -33,6 +33,9 @@
 #include "bta_gattc_int.h"
 #include "l2c_api.h"
 
+#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
+#include "bta_hh_int.h"
+#endif
 
 #include <string.h>
 
@@ -137,7 +140,15 @@
         if (p_cb->cl_rcb[i].in_use)
         {
             p_cb->state = BTA_GATTC_STATE_DISABLING;
-            bta_gattc_deregister(p_cb, &p_cb->cl_rcb[i]);
+            /* don't deregister HH GATT IF */
+            /* HH GATT IF will be deregistered by bta_hh_le_deregister when disable HH */
+#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
+            if (!bta_hh_le_is_hh_gatt_if(p_cb->cl_rcb[i].client_if)) {
+#endif
+                bta_gattc_deregister(p_cb, &p_cb->cl_rcb[i]);
+#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
+            }
+#endif
         }
     }
 
diff --git a/bta/hh/bta_hh_int.h b/bta/hh/bta_hh_int.h
index 0fa7c17..99a8b82 100644
--- a/bta/hh/bta_hh_int.h
+++ b/bta/hh/bta_hh_int.h
@@ -380,6 +380,7 @@
 
 /* functions for LE HID */
 extern void bta_hh_le_enable(void);
+extern BOOLEAN bta_hh_le_is_hh_gatt_if(tBTA_GATTC_IF client_if);
 extern void bta_hh_le_deregister(void);
 extern BOOLEAN bta_hh_is_le_device(tBTA_HH_DEV_CB *p_cb, BD_ADDR remote_bda);
 extern void bta_hh_le_open_conn(tBTA_HH_DEV_CB *p_cb, BD_ADDR remote_bda);
diff --git a/bta/hh/bta_hh_le.c b/bta/hh/bta_hh_le.c
index 41512d4..4d77cb9 100644
--- a/bta/hh/bta_hh_le.c
+++ b/bta/hh/bta_hh_le.c
@@ -238,6 +238,21 @@
 
 /*******************************************************************************
 **
+** Function         bta_hh_le_is_hh_gatt_if
+**
+** Description      Check to see if client_if is BTA HH LE GATT interface
+**
+**
+** Returns          whether it is HH GATT IF
+**
+*******************************************************************************/
+BOOLEAN bta_hh_le_is_hh_gatt_if(tBTA_GATTC_IF client_if)
+{
+    return (bta_hh_cb.gatt_if == client_if);
+}
+
+/*******************************************************************************
+**
 ** Function         bta_hh_le_deregister
 **
 ** Description      De-register BTA HH from BTA GATTC