Snap for 5606001 from 9e28c5448b0e8adca9b2061496e313d8d9ce4634 to qt-qpr1-release

Change-Id: Icebe98006154dd2ad7dc04743a8efe80a82230e9
diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp
index 806ed8c..1abae87 100644
--- a/adb/daemon/usb.cpp
+++ b/adb/daemon/usb.cpp
@@ -380,7 +380,12 @@
                                   << ", wLength = " << static_cast<int>(event.u.setup.wLength);
 
                         if ((event.u.setup.bRequestType & USB_DIR_IN)) {
-                            LOG(WARNING) << "received a device-to-host control transfer, ignoring";
+                            LOG(INFO) << "acking device-to-host control transfer";
+                            ssize_t rc = adb_write(control_fd_.get(), "", 0);
+                            if (rc != 0) {
+                                PLOG(ERROR) << "failed to write empty packet to host";
+                                break;
+                            }
                         } else {
                             std::string buf;
                             buf.resize(event.u.setup.wLength + 1);
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 558e6c4..7b60524 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -1086,17 +1086,8 @@
 void LogBootInfoToStatsd(std::chrono::milliseconds end_time,
                          std::chrono::milliseconds total_duration, int32_t bootloader_duration_ms,
                          double time_since_last_boot_sec) {
-  const auto reason = android::base::GetProperty(bootloader_reboot_reason_property, "");
-
-  if (reason.empty()) {
-    android::util::stats_write(android::util::BOOT_SEQUENCE_REPORTED, "<EMPTY>", "<EMPTY>",
-                               end_time.count(), total_duration.count(),
-                               (int64_t)bootloader_duration_ms,
-                               (int64_t)time_since_last_boot_sec * 1000);
-    return;
-  }
-
-  const auto system_reason = android::base::GetProperty(system_reboot_reason_property, "");
+  auto reason = android::base::GetProperty(bootloader_reboot_reason_property, "<EMPTY>");
+  auto system_reason = android::base::GetProperty(system_reboot_reason_property, "<EMPTY>");
   android::util::stats_write(android::util::BOOT_SEQUENCE_REPORTED, reason.c_str(),
                              system_reason.c_str(), end_time.count(), total_duration.count(),
                              (int64_t)bootloader_duration_ms,
diff --git a/init/property_service.cpp b/init/property_service.cpp
index bca73c9..fce8d57 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -883,8 +883,12 @@
     load_properties_from_file("/system/build.prop", nullptr, &properties);
     load_properties_from_file("/vendor/default.prop", nullptr, &properties);
     load_properties_from_file("/vendor/build.prop", nullptr, &properties);
-    load_properties_from_file("/odm/default.prop", nullptr, &properties);
-    load_properties_from_file("/odm/build.prop", nullptr, &properties);
+    if (SelinuxGetVendorAndroidVersion() >= __ANDROID_API_Q__) {
+        load_properties_from_file("/odm/etc/build.prop", nullptr, &properties);
+    } else {
+        load_properties_from_file("/odm/default.prop", nullptr, &properties);
+        load_properties_from_file("/odm/build.prop", nullptr, &properties);
+    }
     load_properties_from_file("/product/build.prop", nullptr, &properties);
     load_properties_from_file("/product_services/build.prop", nullptr, &properties);
     load_properties_from_file("/factory/factory.prop", "ro.*", &properties);
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 6217bc8..a5f4f0e 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -159,8 +159,9 @@
     { 00750, AID_ROOT,      AID_SHELL,     0, "data/nativetest64/*" },
     { 00600, AID_ROOT,      AID_ROOT,      0, "default.prop" }, // legacy
     { 00600, AID_ROOT,      AID_ROOT,      0, "system/etc/prop.default" },
-    { 00600, AID_ROOT,      AID_ROOT,      0, "odm/build.prop" },
-    { 00600, AID_ROOT,      AID_ROOT,      0, "odm/default.prop" },
+    { 00600, AID_ROOT,      AID_ROOT,      0, "odm/build.prop" }, // legacy; only for P release
+    { 00600, AID_ROOT,      AID_ROOT,      0, "odm/default.prop" }, // legacy; only for P release
+    { 00600, AID_ROOT,      AID_ROOT,      0, "odm/etc/build.prop" },
     { 00444, AID_ROOT,      AID_ROOT,      0, odm_conf_dir + 1 },
     { 00444, AID_ROOT,      AID_ROOT,      0, odm_conf_file + 1 },
     { 00444, AID_ROOT,      AID_ROOT,      0, oem_conf_dir + 1 },
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 1b7367c..2601997 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -586,7 +586,6 @@
     symlink /data/data /data/user/0
 
     mkdir /data/media 0770 media_rw media_rw
-    mkdir /data/media/obb 0770 media_rw media_rw
 
     mkdir /data/cache 0770 system cache
     mkdir /data/cache/recovery 0770 system cache
diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp
index 2b35819..0acea72 100644
--- a/sdcard/sdcard.cpp
+++ b/sdcard/sdcard.cpp
@@ -214,7 +214,14 @@
 
     if (multi_user) {
         std::string obb_path = source_path + "/obb";
-        fs_prepare_dir(obb_path.c_str(), 0775, uid, gid);
+        // Only attempt to prepare the /obb dir if it already exists. We want
+        // the legacy obb path "/data/media/obb" to be fixed up so that we can
+        // migrate it to its new location, but we don't want the directory to be
+        // created if it doesn't already exist.
+        struct stat sb;
+        if (TEMP_FAILURE_RETRY(lstat(obb_path.c_str(), &sb)) == 0) {
+            fs_prepare_dir(obb_path.c_str(), 0775, uid, gid);
+        }
     }
 
     exit(0);