OSDN Git Service

Give run_unit_tests an exit code
authorScott James Remnant <keybuk@google.com>
Wed, 18 Nov 2015 19:17:29 +0000 (19:17 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Wed, 18 Nov 2015 19:17:29 +0000 (19:17 +0000)
am: 0ff191abbf

* commit '0ff191abbfa3d23d4e8a81cb674509580873bdc2':
  Give run_unit_tests an exit code

bta/dm/bta_dm_act.c
hci/src/hci_hal_h4.c
osi/src/alarm.c
stack/gatt/gatt_auth.c

index af879b7..a34a2c9 100644 (file)
@@ -3513,7 +3513,6 @@ static void bta_dm_disable_conn_down_timer_cback(timer_entry_t *p_te)
 *******************************************************************************/
 static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
 {
-
     UINT8 j;
     tBTA_PREF_ROLES role;
     tBTA_DM_PEER_DEVICE *p_dev;
@@ -3567,7 +3566,11 @@ static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
         APPL_TRACE_WARNING("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
     }
 
-    bta_dm_adjust_roles(FALSE);
+    /* Don't adjust roles for each busy/idle state transition to avoid
+       excessive switch requests when individual profile busy/idle status
+       changes */
+    if ((status != BTA_SYS_CONN_BUSY) && (status != BTA_SYS_CONN_IDLE))
+        bta_dm_adjust_roles(FALSE);
 }
 
 /*******************************************************************************
index 49e9463..f77e9b8 100644 (file)
@@ -194,7 +194,7 @@ done:;
 static bool stream_corrupted_during_le_scan_workaround(const uint8_t byte_read)
 {
   if (!stream_corruption_detected && byte_read == HCI_BLE_EVENT) {
-    LOG_ERROR(LOG_TAG, "%s HCI stream corrupted (message type 0x3E)!", __func__);
+    LOG_ERROR("%s HCI stream corrupted (message type 0x3E)!", __func__);
     stream_corruption_detected = true;
     return true;
   }
@@ -202,13 +202,13 @@ static bool stream_corrupted_during_le_scan_workaround(const uint8_t byte_read)
   if (stream_corruption_detected) {
     if (stream_corruption_bytes_to_ignore == 0) {
       stream_corruption_bytes_to_ignore = byte_read;
-      LOG_ERROR(LOG_TAG, "%s About to skip %d bytes...", __func__, stream_corruption_bytes_to_ignore);
+      LOG_ERROR("%s About to skip %d bytes...", __func__, stream_corruption_bytes_to_ignore);
     } else {
       --stream_corruption_bytes_to_ignore;
     }
 
     if (stream_corruption_bytes_to_ignore == 0) {
-      LOG_ERROR(LOG_TAG, "%s Back to our regularly scheduled program...", __func__);
+      LOG_ERROR("%s Back to our regularly scheduled program...", __func__);
       stream_corruption_detected = false;
     }
     return true;
index c8c1f83..3e7115f 100644 (file)
 #include "osi/include/semaphore.h"
 #include "osi/include/thread.h"
 
+// Make callbacks run at high thread priority. Some callbacks are used for audio
+// related timer tasks as well as re-transmissions etc. Since we at this point
+// cannot differentiate what callback we are dealing with, assume high priority
+// for now.
+// TODO(eisenbach): Determine correct thread priority (from parent?/per alarm?)
+static const int CALLBACK_THREAD_PRIORITY_HIGH = -19;
+
 struct alarm_t {
   // The lock is held while the callback for this alarm is being executed.
   // It allows us to release the coarse-grained monitor lock while a potentially
@@ -262,6 +269,7 @@ static bool lazy_initialize(void) {
     goto error;
   }
 
+  thread_set_priority(callback_thread, CALLBACK_THREAD_PRIORITY_HIGH);
   thread_post(callback_thread, callback_dispatch, NULL);
   return true;
 
index 3789519..206985b 100644 (file)
@@ -103,6 +103,11 @@ void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
     UINT8   *p, *p_orig = (UINT8 *)(p_buf + 1) + p_buf->offset;
     UINT32  counter;
 
+    if (p_buf->len < GATT_AUTH_SIGN_LEN + 4) {
+        GATT_TRACE_ERROR("%s: Data length %u less than expected %u",
+                         __func__, p_buf->len, GATT_AUTH_SIGN_LEN + 4);
+        return;
+    }
     cmd_len = p_buf->len - GATT_AUTH_SIGN_LEN + 4;
     p =  p_orig + cmd_len - 4;
     STREAM_TO_UINT32(counter, p);