Merge 543fe8ae09f9176d0f718e07ddc15b6bc9b01434 on remote branch
Change-Id: Ib29afb89d070cac5e57d0f1cbd4ab5871c0e2cd5
diff --git a/etc/Android.bp b/etc/Android.bp
index f5d3a05..e90b151 100644
--- a/etc/Android.bp
+++ b/etc/Android.bp
@@ -5,6 +5,13 @@
sub_dir: "init/hw",
}
+prebuilt_etc {
+ name: "init.qti.usb.debug.rc",
+ src: "init.qti.usb.debug.rc",
+ vendor: true,
+ sub_dir: "init",
+}
+
sh_binary {
name: "init.qcom.usb.sh",
src: "init.qcom.usb.sh",
diff --git a/etc/init.qcom.usb.rc b/etc/init.qcom.usb.rc
index 0ae66c5..d666426 100644
--- a/etc/init.qcom.usb.rc
+++ b/etc/init.qcom.usb.rc
@@ -42,9 +42,6 @@
setprop sys.usb.config mass_storage
setprop sys.usb.configfs 1
-on init
- exec u:r:vendor-qti-testscripts:s0 -- /vendor/bin/sh /vendor/bin/init.qti.usb.debug.sh
-
on boot
mount configfs none /config
mkdir /config/usb_gadget/g1 0770
diff --git a/etc/init.qti.usb.debug.rc b/etc/init.qti.usb.debug.rc
new file mode 100644
index 0000000..f0c3602
--- /dev/null
+++ b/etc/init.qti.usb.debug.rc
@@ -0,0 +1,30 @@
+# Copyright (c) 2021 The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of The Linux Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+on init && property:ro.build.type=userdebug
+ exec u:r:vendor-qti-testscripts:s0 -- /vendor/bin/sh /vendor/bin/init.qti.usb.debug.sh
diff --git a/vendor_product.mk b/vendor_product.mk
index 3343e01..a2cb8b5 100644
--- a/vendor_product.mk
+++ b/vendor_product.mk
@@ -4,6 +4,7 @@
# additional debugging on userdebug/eng builds
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += init.qti.usb.debug.sh
+ PRODUCT_PACKAGES += init.qti.usb.debug.rc
endif
ifneq ($(TARGET_KERNEL_VERSION),$(filter $(TARGET_KERNEL_VERSION),4.9 4.14))