Allow devices to override USB init
This enables devices to provide their own USB configuration. The
contents of init.recovery.usb.rc can most simply be modified and
included in a device's init.recovery.${ro.hardware}.rc.
Use option:
TW_EXCLUDE_DEFAULT_USB_INIT := true
Rationale: Some devices handle USB pid switching in the kernel. In this
case, USB init provides switching functions which differ from the
standard on property:sys.usb.config=xyz. Other devices should not see
USB attempt mtp,adb mode when TW_EXCLUDE_MTP is set.
Cherry-picked from android-5.0
Change-Id: Ief0fcaf46a1782102166fc1b733a34b1a1ba0802
diff --git a/Android.mk b/Android.mk
index 0f923a8..664c487 100644
--- a/Android.mk
+++ b/Android.mk
@@ -308,6 +308,9 @@
ifneq ($(wildcard bionic/libc/include/sys/capability.h),)
LOCAL_CFLAGS += -DHAVE_CAPABILITIES
endif
+ifneq ($(TARGET_RECOVERY_INITRC),)
+ TW_EXCLUDE_DEFAULT_USB_INIT := true
+endif
LOCAL_ADDITIONAL_DEPENDENCIES := \
dump_image \
@@ -370,6 +373,9 @@
ifeq ($(TW_INCLUDE_INJECTTWRP), true)
LOCAL_ADDITIONAL_DEPENDENCIES += injecttwrp
endif
+ifneq ($(TW_EXCLUDE_DEFAULT_USB_INIT), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += init.recovery.usb.rc
+endif
# Allow devices to specify device-specific recovery dependencies
ifneq ($(TARGET_RECOVERY_DEVICE_MODULES),)
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_RECOVERY_DEVICE_MODULES)
@@ -503,7 +509,8 @@
$(commands_recovery_local_path)/twrpTarMain/Android.mk \
$(commands_recovery_local_path)/mtp/Android.mk \
$(commands_recovery_local_path)/minzip/Android.mk \
- $(commands_recovery_local_path)/dosfstools/Android.mk
+ $(commands_recovery_local_path)/dosfstools/Android.mk \
+ $(commands_recovery_local_path)/etc/Android.mk
ifeq ($(TW_INCLUDE_CRYPTO), true)
include $(commands_recovery_local_path)/crypto/lollipop/Android.mk