Merge "healthd: charger: Run animation even if capacity is 0" into lmp-dev
diff --git a/adb/usb_osx.c b/adb/usb_osx.c
index 45ce444..ca4f2af 100644
--- a/adb/usb_osx.c
+++ b/adb/usb_osx.c
@@ -512,14 +512,18 @@
         return -1;
     }
 
-    result =
-      (*handle->interface)->ReadPipe(handle->interface,
-                                    handle->bulkIn, buf, &numBytes);
+    result = (*handle->interface)->ReadPipe(handle->interface, handle->bulkIn, buf, &numBytes);
 
-    if (0 == result)
+    if (kIOUSBPipeStalled == result) {
+        DBG(" Pipe stalled, clearing stall.\n");
+        (*handle->interface)->ClearPipeStall(handle->interface, handle->bulkIn);
+        result = (*handle->interface)->ReadPipe(handle->interface, handle->bulkIn, buf, &numBytes);
+    }
+
+    if (kIOReturnSuccess == result)
         return 0;
     else {
-        DBG("ERR: usb_read failed with status %d\n", result);
+        DBG("ERR: usb_read failed with status %x\n", result);
     }
 
     return -1;
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 03b3177..43d05aa 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -104,7 +104,6 @@
     {"recovery.img", "recovery.sig", "recovery", true},
     {"system.img", "system.sig", "system", false},
     {"vendor.img", "vendor.sig", "vendor", true},
-    {"tos.img", "tos.sig", "tos", true},
 };
 
 void get_my_path(char *path);
@@ -123,8 +122,6 @@
         fn = "system.img";
     } else if(!strcmp(item,"vendor")) {
         fn = "vendor.img";
-    } else if(!strcmp(item,"tos")) {
-        fn = "tos.img";
     } else if(!strcmp(item,"userdata")) {
         fn = "userdata.img";
     } else if(!strcmp(item,"cache")) {
@@ -291,7 +288,7 @@
             "commands:\n"
             "  update <filename>                        reflash device from update.zip\n"
             "  flashall                                 flash boot, system, vendor and if found,\n"
-            "                                           recovery, tos\n"
+            "                                           recovery\n"
             "  flash <partition> [ <filename> ]         write a file to a flash partition\n"
             "  erase <partition>                        erase a flash partition\n"
             "  format[:[<fs type>][:[<size>]] <partition> format a flash partition.\n"
diff --git a/include/system/audio.h b/include/system/audio.h
index 0eb28b0..9a25cfb 100644
--- a/include/system/audio.h
+++ b/include/system/audio.h
@@ -111,7 +111,8 @@
     AUDIO_FLAG_SECURE              = 0x2,
     AUDIO_FLAG_SCO                 = 0x4,
     AUDIO_FLAG_BEACON              = 0x8,
-    AUDIO_FLAG_HW_AV_SYNC          = 0x10
+    AUDIO_FLAG_HW_AV_SYNC          = 0x10,
+    AUDIO_FLAG_HW_HOTWORD          = 0x20,
 };
 
 /* Do not change these values without updating their counterparts
@@ -710,8 +711,9 @@
  * attributes corresponding to the specified flags.
  */
 typedef enum {
-    AUDIO_INPUT_FLAG_NONE = 0x0,        // no attributes
-    AUDIO_INPUT_FLAG_FAST = 0x1,        // prefer an input that supports "fast tracks"
+    AUDIO_INPUT_FLAG_NONE       = 0x0,  // no attributes
+    AUDIO_INPUT_FLAG_FAST       = 0x1,  // prefer an input that supports "fast tracks"
+    AUDIO_INPUT_FLAG_HW_HOTWORD = 0x2,  // prefer an input that captures from hw hotword source
 } audio_input_flags_t;
 
 /* Additional information about compressed streams offloaded to
diff --git a/init/builtins.c b/init/builtins.c
index de83c93..8dbaab7 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -515,7 +515,12 @@
     pid = fork();
     if (pid > 0) {
         /* Parent.  Wait for the child to return */
-        waitpid(pid, &status, 0);
+        int wp_ret = TEMP_FAILURE_RETRY(waitpid(pid, &status, 0));
+        if (wp_ret < 0) {
+            /* Unexpected error code. We will continue anyway. */
+            NOTICE("waitpid failed rc=%d, errno=%d\n", wp_ret, errno);
+        }
+
         if (WIFEXITED(status)) {
             ret = WEXITSTATUS(status);
         } else {