Merge "Small debuggerd improvements."
diff --git a/adb/transport_usb.cpp b/adb/transport_usb.cpp
index e16cf12..516b4f2 100644
--- a/adb/transport_usb.cpp
+++ b/adb/transport_usb.cpp
@@ -102,7 +102,7 @@
 #if defined(_WIN32) || !ADB_HOST
     return false;
 #else
-    static bool enable = getenv("ADB_LIBUSB") && strcmp(getenv("ADB_LIBUSB"), "1") == 0;
-    return enable;
+    static bool disable = getenv("ADB_LIBUSB") && strcmp(getenv("ADB_LIBUSB"), "0") == 0;
+    return !disable;
 #endif
 }
diff --git a/init/Android.mk b/init/Android.mk
index 18cbedc..2fc6f19 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -107,6 +107,24 @@
     libnl \
     libavb
 
+# Include SELinux policy. We do this here because different modules
+# need to be included based on the value of PRODUCT_FULL_TREBLE. This
+# type of conditional inclusion cannot be done in top-level files such
+# as build/target/product/embedded.mk.
+# This conditional inclusion closely mimics the conditional logic
+# inside init/init.cpp for loading SELinux policy from files.
+ifeq ($(PRODUCT_FULL_TREBLE),true)
+# Use split SELinux policy
+LOCAL_REQUIRED_MODULES += \
+    mapping_sepolicy.cil \
+    nonplat_sepolicy.cil \
+    plat_sepolicy.cil \
+    secilc
+else
+# Use monolithic SELinux policy
+LOCAL_REQUIRED_MODULES += sepolicy
+endif
+
 # Create symlinks.
 LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
     ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
diff --git a/init/init.cpp b/init/init.cpp
index 53e7482..28e6008 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -669,7 +669,7 @@
     }
 }
 
-static constexpr const char plat_policy_cil_file[] = "/plat_sepolicy.cil";
+static constexpr const char plat_policy_cil_file[] = "/system/etc/selinux/plat_sepolicy.cil";
 
 static bool selinux_is_split_policy_device() { return access(plat_policy_cil_file, R_OK) != -1; }
 
@@ -701,7 +701,8 @@
 
     const char* compile_args[] = {"/system/bin/secilc", plat_policy_cil_file, "-M", "true", "-c",
                                   "30",  // TODO: pass in SELinux policy version from build system
-                                  "/mapping_sepolicy.cil", "/nonplat_sepolicy.cil", "-o",
+                                  "/vendor/etc/selinux/mapping_sepolicy.cil",
+                                  "/vendor/etc/selinux/nonplat_sepolicy.cil", "-o",
                                   compiled_sepolicy,
                                   // We don't care about file_contexts output by the compiler
                                   "-f", "/sys/fs/selinux/null",  // /dev/null is not yet available