Revert "HID: Fix scroll issue with Apple Magic Mouse"

Reverting due to the fact that this causes many HID issues with fugu.
The general problem seems to be that this patch requires kernel 3.18
while fugu is currently on 3.10. Will investigate further later but
reverting for now to fix fugu.

This reverts commit 3e2201163b609aab6dcc0778158e790c3201353b.
Fixes: 35667962
Fixes: 35712367
Change-Id: I536da368fc9796b26dc52892eda6501772683330

(cherry picked from commit f11e42b1c2a1c185bf83b1d08e033c4e5aec54c2)
diff --git a/bta/hh/bta_hh_act.cc b/bta/hh/bta_hh_act.cc
index b84f6b9..371b317 100644
--- a/bta/hh/bta_hh_act.cc
+++ b/bta/hh/bta_hh_act.cc
@@ -620,7 +620,7 @@
  *
  * Function         bta_hh_handsk_act
  *
- * Description      HID Host process a handshake acknowledgement.
+ * Description      HID Host process a handshake acknoledgement.
  *
  *
  * Returns          void
@@ -650,8 +650,7 @@
       /* if handshake gives an OK code for these transaction, fill in UNSUPT */
       hs_data.status = bta_hh_get_trans_status(p_data->hid_cback.data);
       if (hs_data.status == BTA_HH_OK) hs_data.status = BTA_HH_HS_TRANS_NOT_SPT;
-      if (p_cb->w4_evt == BTA_HH_GET_RPT_EVT)
-          bta_hh_co_get_rpt_rsp(cback_data.handle, hs_data.status, NULL, 0);
+
       (*bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH*)&hs_data);
       p_cb->w4_evt = 0;
       break;
@@ -662,8 +661,6 @@
     case BTA_HH_SET_IDLE_EVT:
       cback_data.handle = p_cb->hid_handle;
       cback_data.status = bta_hh_get_trans_status(p_data->hid_cback.data);
-      if (p_cb->w4_evt == BTA_HH_SET_RPT_EVT)
-          bta_hh_co_set_rpt_rsp(cback_data.handle, cback_data.status);
       (*bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH*)&cback_data);
       p_cb->w4_evt = 0;
       break;
@@ -718,7 +715,6 @@
       break;
     case BTA_HH_GET_RPT_EVT:
       hs_data.rsp_data.p_rpt_data = pdata;
-      bta_hh_co_get_rpt_rsp(hs_data.handle, hs_data.status, pdata->data, pdata->len);
       break;
     case BTA_HH_GET_PROTO_EVT:
       /* match up BTE/BTA report/boot mode def*/
diff --git a/bta/include/bta_hh_co.h b/bta/include/bta_hh_co.h
index c6fa384..d2b0382 100644
--- a/bta/include/bta_hh_co.h
+++ b/bta/include/bta_hh_co.h
@@ -77,30 +77,6 @@
  ******************************************************************************/
 extern void bta_hh_co_close(uint8_t dev_handle, uint8_t app_id);
 
-/*******************************************************************************
- *
- * Function         bta_hh_co_set_rpt_rsp
- *
- * Description      This callout function is executed by HH when Set Report
- *                  Response is received on Control Channel.
- *
- * Returns          void.
- *
- ******************************************************************************/
-extern void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status);
-
-/*******************************************************************************
- *
- * Function         bta_hh_co_get_rpt_rsp
- *
- * Description      This callout function is executed by HH when Get Report
- *                  Response is received on Control Channel.
- *
- * Returns          void.
- *
- ******************************************************************************/
-extern void bta_hh_co_get_rpt_rsp(uint8_t dev_handle, uint8_t status, uint8_t *p_rpt, uint16_t len);
-
 #if (BTA_HH_LE_INCLUDED == TRUE)
 /*******************************************************************************
  *
diff --git a/btif/co/bta_hh_co.cc b/btif/co/bta_hh_co.cc
index 530ae7d..797bd42 100644
--- a/btif/co/bta_hh_co.cc
+++ b/btif/co/bta_hh_co.cc
@@ -141,49 +141,11 @@
       }
       APPL_TRACE_DEBUG("UHID_OUTPUT_EV from uhid-dev\n");
       break;
-    case UHID_SET_REPORT: {
-      if (ret < (ssize_t)(sizeof(ev.type) + sizeof(ev.u.set_report))) {
-        APPL_TRACE_ERROR(
-            "%s: UHID_SET_REPORT: Invalid size read from "
-            "uhid-dev: %zd < %zu",
-            __func__, ret, sizeof(ev.type) + sizeof(ev.u.set_report));
-        return -EFAULT;
-      }
-      APPL_TRACE_DEBUG(
-          "UHID_SET_REPORT: Report type = %d, report_size = %d"
-          " report id = %d",
-          ev.u.set_report.rtype, ev.u.set_report.size, ev.u.set_report.id);
-      if (p_dev->set_rpt_id_queue) {
-        void* set_rpt_id = (void*)&ev.u.set_report.id;
-        fixed_queue_enqueue(p_dev->set_rpt_id_queue, set_rpt_id);
-      }
-      if (ev.u.set_report.rtype == UHID_FEATURE_REPORT)
-        btif_hh_setreport(p_dev, BTHH_FEATURE_REPORT, ev.u.set_report.size,
-                          ev.u.set_report.data);
-      else if (ev.u.set_report.rtype == UHID_OUTPUT_REPORT)
-        btif_hh_setreport(p_dev, BTHH_OUTPUT_REPORT, ev.u.set_report.size,
-                          ev.u.set_report.data);
-      else
-        btif_hh_setreport(p_dev, BTHH_INPUT_REPORT, ev.u.set_report.size,
-                          ev.u.set_report.data);
-    } break;
-    case UHID_GET_REPORT:
-      if (ret < (ssize_t)(sizeof(ev.type) + sizeof(ev.u.get_report))) {
-        APPL_TRACE_ERROR(
-            "%s: UHID_GET_REPORT: Invalid size read from "
-            "uhid-dev: %zd < %zu",
-            __func__, ret, sizeof(ev.type) + sizeof(ev.u.get_report));
-        return -EFAULT;
-      }
-      APPL_TRACE_DEBUG("UHID_GET_REPORT: Report type = %d",
-                       ev.u.get_report.rtype);
-      p_dev->get_rpt_snt++;
-      if (ev.u.get_report.rtype == UHID_FEATURE_REPORT)
-        btif_hh_getreport(p_dev, BTHH_FEATURE_REPORT, ev.u.get_report.rnum, 0);
-      else if (ev.u.get_report.rtype == UHID_OUTPUT_REPORT)
-        btif_hh_getreport(p_dev, BTHH_OUTPUT_REPORT, ev.u.get_report.rnum, 0);
-      else
-        btif_hh_getreport(p_dev, BTHH_INPUT_REPORT, ev.u.get_report.rnum, 0);
+    case UHID_FEATURE:
+      APPL_TRACE_DEBUG("UHID_FEATURE from uhid-dev\n");
+      break;
+    case UHID_FEATURE_ANSWER:
+      APPL_TRACE_DEBUG("UHID_FEATURE_ANSWER from uhid-dev\n");
       break;
 
     default:
@@ -382,9 +344,6 @@
   }
 
   p_dev->dev_status = BTHH_CONN_STATE_CONNECTED;
-  p_dev->set_rpt_id_queue = fixed_queue_new(SIZE_MAX);
-  CHECK(p_dev->set_rpt_id_queue);
-
   APPL_TRACE_DEBUG("%s: Return device status %d", __func__, p_dev->dev_status);
 }
 
@@ -414,8 +373,6 @@
 
   for (i = 0; i < BTIF_HH_MAX_HID; i++) {
     p_dev = &btif_hh_cb.devices[i];
-    fixed_queue_free(p_dev->set_rpt_id_queue, NULL);
-    p_dev->set_rpt_id_queue = NULL;
     if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN &&
         p_dev->dev_handle == dev_handle) {
       APPL_TRACE_WARNING(
@@ -546,85 +503,6 @@
   }
 }
 
-/*******************************************************************************
- *
- * Function         bta_hh_co_set_rpt_rsp
- *
- * Description      This callout function is executed by HH when Set Report
- *                  Response is received on Control Channel.
- *
- * Returns          void.
- *
- ******************************************************************************/
-void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status) {
-  btif_hh_device_t* p_dev;
-
-  APPL_TRACE_VERBOSE("%s: dev_handle = %d", __func__, dev_handle);
-
-  p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
-  if (p_dev == NULL) {
-    APPL_TRACE_WARNING("%s: Error: unknown HID device handle %d", __func__,
-                       dev_handle);
-    return;
-  }
-  // Send the HID report to the kernel.
-  if (!p_dev->set_rpt_id_queue)
-      return;
-
-  struct uhid_event ev;
-  uint32_t* set_rpt_id =
-      (uint32_t*)fixed_queue_dequeue(p_dev->set_rpt_id_queue);
-  memset(&ev, 0, sizeof(ev));
-  ev.type = UHID_SET_REPORT_REPLY;
-  /* get the report id from queue_start pointer */
-  ev.u.set_report_reply.id = *set_rpt_id;
-  APPL_TRACE_VERBOSE("%s: set_report_reply_id = %d", __func__,
-                     ev.u.set_report_reply.id);
-  ev.u.set_report_reply.err = status;
-  uhid_write(p_dev->fd, &ev);
-}
-
-/*******************************************************************************
- *
- * Function         bta_hh_co_get_rpt_rsp
- *
- * Description      This callout function is executed by HH when Get Report
- *                  Response is received on Control Channel.
- *
- * Returns          void.
- *
- ******************************************************************************/
-void bta_hh_co_get_rpt_rsp(uint8_t dev_handle, uint8_t status, uint8_t* p_rpt,
-                           uint16_t len) {
-  struct uhid_event ev;
-  btif_hh_device_t* p_dev;
-
-  APPL_TRACE_VERBOSE("%s: dev_handle = %d", __func__, dev_handle);
-
-  p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
-  if (p_dev == NULL) {
-    APPL_TRACE_WARNING("%s: Error: unknown HID device handle %d", __func__,
-                       dev_handle);
-    return;
-  }
-  // Send the HID report to the kernel.
-  if (p_dev->fd >= 0 && p_dev->get_rpt_snt--) {
-    memset(&ev, 0, sizeof(ev));
-    ev.type = UHID_GET_REPORT_REPLY;
-    ev.u.get_report_reply.err = status;
-    ev.u.get_report_reply.size = len;
-    if (len > 0) {
-      if (len > UHID_DATA_MAX) {
-        APPL_TRACE_WARNING("%s: Report size greater than allowed size",
-                           __func__);
-        return;
-      }
-      memcpy(ev.u.get_report_reply.data, p_rpt, len);
-      uhid_write(p_dev->fd, &ev);
-    }
-  }
-}
-
 #if (BTA_HH_LE_INCLUDED == TRUE)
 /*******************************************************************************
  *
diff --git a/btif/include/btif_hh.h b/btif/include/btif_hh.h
index 305cd6c..95ab382 100644
--- a/btif/include/btif_hh.h
+++ b/btif/include/btif_hh.h
@@ -25,7 +25,6 @@
 #include <stdint.h>
 #include "bta_hh_api.h"
 #include "btu.h"
-#include "osi/include/fixed_queue.h"
 
 /*******************************************************************************
  *  Constants & Macros
@@ -68,8 +67,6 @@
   pthread_t hh_poll_thread_id;
   uint8_t hh_keep_polling;
   alarm_t* vup_timer;
-  fixed_queue_t* set_rpt_id_queue;
-  uint8_t get_rpt_snt;
   bool local_vup;  // Indicated locally initiated VUP
 } btif_hh_device_t;
 
@@ -104,13 +101,10 @@
 bool btif_hh_add_added_dev(bt_bdaddr_t bda, tBTA_HH_ATTR_MASK attr_mask);
 extern bt_status_t btif_hh_virtual_unplug(bt_bdaddr_t* bd_addr);
 extern void btif_hh_disconnect(bt_bdaddr_t* bd_addr);
-extern void btif_hh_service_registration(bool enable);
 extern void btif_hh_setreport(btif_hh_device_t* p_dev,
                               bthh_report_type_t r_type, uint16_t size,
                               uint8_t* report);
-extern void btif_hh_getreport(btif_hh_device_t* p_dev,
-                              bthh_report_type_t r_type, uint8_t reportId,
-                              uint16_t bufferSize);
+extern void btif_hh_service_registration(bool enable);
 
 bool btif_hh_add_added_dev(bt_bdaddr_t bd_addr, tBTA_HH_ATTR_MASK attr_mask);
 
diff --git a/btif/src/btif_hh.cc b/btif/src/btif_hh.cc
index 02907dd..b60c8c8 100644
--- a/btif/src/btif_hh.cc
+++ b/btif/src/btif_hh.cc
@@ -700,21 +700,6 @@
   }
 }
 
-/*******************************************************************************
- *
- *
- * Function         btif_hh_getreport
- *
- * Description      getreport initiated from the BTIF thread context
- *
- * Returns          void
- *
- *******************************************************************************/
-void btif_hh_getreport(btif_hh_device_t *p_dev, bthh_report_type_t r_type,
-                        uint8_t reportId, uint16_t bufferSize) {
-    BTA_HhGetReport(p_dev->dev_handle, r_type, reportId, bufferSize);
-}
-
 /*****************************************************************************
  *   Section name (Group of functions)
  ****************************************************************************/