Merge "metricsd: Update the daily/weekly metrics name."
diff --git a/adb/adb.cpp b/adb/adb.cpp
index e973603..0e1859c 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -239,6 +239,10 @@
     // "device::ro.product.name=x;ro.product.model=y;ro.product.device=z;".
     std::vector<std::string> pieces = android::base::Split(banner, ":");
 
+    // Reset the features list or else if the server sends no features we may
+    // keep the existing feature set (http://b/24405971).
+    t->SetFeatures("");
+
     if (pieces.size() > 2) {
         const std::string& props = pieces[2];
         for (auto& prop : android::base::Split(props, ";")) {
diff --git a/adb/adb.h b/adb/adb.h
index 037c010..a20b345 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -50,7 +50,7 @@
 std::string adb_version();
 
 // Increment this when we want to force users to start a new adb server.
-#define ADB_SERVER_VERSION 32
+#define ADB_SERVER_VERSION 33
 
 class atransport;
 struct usb_handle;
diff --git a/adb/transport.cpp b/adb/transport.cpp
index ffbb107..2a2fac7 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -786,6 +786,9 @@
     // Local static allocation to avoid global non-POD variables.
     static const FeatureSet* features = new FeatureSet{
         kFeatureShell2
+        // Increment ADB_SERVER_VERSION whenever the feature list changes to
+        // make sure that the adb client and server features stay in sync
+        // (http://b/24370690).
     };
 
     return *features;
@@ -796,6 +799,10 @@
 }
 
 FeatureSet StringToFeatureSet(const std::string& features_string) {
+    if (features_string.empty()) {
+        return FeatureSet();
+    }
+
     auto names = android::base::Split(features_string,
                                       {kFeatureStringDelimiter});
     return FeatureSet(names.begin(), names.end());
diff --git a/adb/transport_test.cpp b/adb/transport_test.cpp
index 7d69c3e..97fc069 100644
--- a/adb/transport_test.cpp
+++ b/adb/transport_test.cpp
@@ -167,6 +167,9 @@
     ASSERT_FALSE(t.has_feature("foo"));
     ASSERT_TRUE(t.has_feature("bar"));
     ASSERT_TRUE(t.has_feature("baz"));
+
+    t.SetFeatures("");
+    ASSERT_EQ(0U, t.features().size());
 }
 
 TEST(transport, parse_banner_no_features) {
diff --git a/include/utils/Compat.h b/include/utils/Compat.h
index c5f9d6a..b2ba55e 100644
--- a/include/utils/Compat.h
+++ b/include/utils/Compat.h
@@ -33,6 +33,10 @@
     return pread(fd, buf, nbytes, offset);
 }
 
+static inline ssize_t pwrite64(int fd, const void* buf, size_t nbytes, off64_t offset) {
+    return pwrite(fd, buf, nbytes, offset);
+}
+
 #endif /* __APPLE__ */
 
 #if defined(_WIN32)
diff --git a/logd/main.cpp b/logd/main.cpp
index 9b88983..f90da37 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -422,7 +422,7 @@
 
     LogListener *swl = new LogListener(logBuf, reader);
     // Backlog and /proc/sys/net/unix/max_dgram_qlen set to large value
-    if (swl->startListener(300)) {
+    if (swl->startListener(600)) {
         exit(1);
     }
 
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 5f1169d..dc85d98 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -86,7 +86,7 @@
     write /proc/sys/kernel/kptr_restrict 2
     write /proc/sys/vm/mmap_min_addr 32768
     write /proc/sys/net/ipv4/ping_group_range "0 2147483647"
-    write /proc/sys/net/unix/max_dgram_qlen 300
+    write /proc/sys/net/unix/max_dgram_qlen 600
     write /proc/sys/kernel/sched_rt_runtime_us 950000
     write /proc/sys/kernel/sched_rt_period_us 1000000