Merge "Don't display bugreport progress when it recedes."
diff --git a/adb/jdwp_service.cpp b/adb/jdwp_service.cpp
index 9589d88..f0dff06 100644
--- a/adb/jdwp_service.cpp
+++ b/adb/jdwp_service.cpp
@@ -179,8 +179,6 @@
     fdevent* fde = nullptr;
 
     std::vector<unique_fd> out_fds;
-    char in_buf[PID_LEN + 1];
-    ssize_t in_len = 0;
 };
 
 static size_t jdwp_process_list(char* buffer, size_t bufferlen) {
@@ -224,33 +222,16 @@
     if (events & FDE_READ) {
         if (proc->pid < 0) {
             /* read the PID as a 4-hexchar string */
-            if (proc->in_len < 0) {
-                fatal("attempting to read JDWP pid again?");
-            }
-
-            char* p = proc->in_buf + proc->in_len;
-            size_t size = PID_LEN - proc->in_len;
-
-            ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, p, size, 0));
-            if (rc < 0) {
-                if (errno == EAGAIN) {
-                    return;
-                }
-
+            char buf[PID_LEN + 1];
+            ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, buf, PID_LEN, 0));
+            if (rc != PID_LEN) {
                 D("failed to read jdwp pid: %s", strerror(errno));
                 goto CloseProcess;
             }
+            buf[PID_LEN] = '\0';
 
-            proc->in_len += rc;
-            if (proc->in_len != PID_LEN) {
-                return;
-            }
-
-            proc->in_buf[PID_LEN] = '\0';
-            proc->in_len = -1;
-
-            if (sscanf(proc->in_buf, "%04x", &proc->pid) != 1) {
-                D("could not decode JDWP %p PID number: '%s'", proc, p);
+            if (sscanf(buf, "%04x", &proc->pid) != 1) {
+                D("could not decode JDWP %p PID number: '%s'", proc, buf);
                 goto CloseProcess;
             }
 
@@ -405,7 +386,7 @@
     addr.sun_family = AF_UNIX;
     memcpy(addr.sun_path, sockname, socknamelen);
 
-    s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
+    s = socket(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0);
     if (s < 0) {
         D("could not create vm debug control socket. %d: %s", errno, strerror(errno));
         return -1;
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
index 48a0e61..d200070 100644
--- a/include/private/android_filesystem_config.h
+++ b/include/private/android_filesystem_config.h
@@ -129,6 +129,7 @@
 #define AID_TOMBSTONED    1058  /* tombstoned user */
 #define AID_MEDIA_OBB     1059  /* GID for OBB files on internal media storage */
 #define AID_ESE           1060  /* embedded secure element (eSE) subsystem */
+#define AID_OTA_UPDATE    1061  /* resource tracking UID for OTA updates */
 /* Changes to this file must be made in AOSP, *not* in internal branches. */
 
 #define AID_SHELL         2000  /* adb and debug shell user */