diff --git a/device.mk b/device.mk index bfa6f43..2837422 100644 --- a/device.mk +++ b/device.mk @@ -89,6 +89,17 @@ TARGET_USES_MKE2FS := true TW_NO_SCREEN_BLANK := true TW_EXCLUDE_APEX := true +# TWRP Debug Flags +TARGET_USES_LOGD := true +TWRP_EVENT_LOGGING := false +TWRP_INCLUDE_LOGCAT := true +TARGET_RECOVERY_DEVICE_MODULES += debuggerd +TW_RECOVERY_ADDITIONAL_RELINK_FILES += $(TARGET_OUT_EXECUTABLES)/debuggerd + +# TWRP Installer +RECOVERY_INSTALLER_PATH := bootable/recovery/installer +USE_RECOVERY_INSTALLER := true + # Crypto TW_USE_FSCRYPT_POLICY := 1 TW_INCLUDE_CRYPTO := true @@ -119,9 +130,7 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/prebuilt/libandroidicu.so:$(TARGET_COPY_OUT_RECOVERY)/root/system/lib64/libandroidicu.so \ $(LOCAL_PATH)/prebuilt/android.hardware.boot@1.0-impl-1.1-qti.so:$(TARGET_COPY_OUT_RECOVERY)/root/system/lib64/hw/android.hardware.boot@1.0-impl-1.1-qti.so \ $(LOCAL_PATH)/prebuilt/librecovery_updater_msm.so:$(TARGET_COPY_OUT_RECOVERY)/root/system/lib64/librecovery_updater_msm.so \ - $(LOCAL_PATH)/prebuilt/libboot_control_qti.so:$(TARGET_COPY_OUT_RECOVERY)/root/system/lib64/libboot_control_qti.so \ - $(LOCAL_PATH)/prebuilt/android.hardware.fastboot@1.0-impl-mock.so:$(TARGET_COPY_OUT_RECOVERY)/root/system/lib64/hw/android.hardware.fastboot@1.0-impl-mock.so - + $(LOCAL_PATH)/prebuilt/libboot_control_qti.so:$(TARGET_COPY_OUT_RECOVERY)/root/system/lib64/libboot_control_qti.so PRODUCT_PACKAGES += \ qcom_decrypt \ qcom_decrypt_fbe diff --git a/prebuilt/android.hardware.fastboot@1.0-impl-mock.so b/prebuilt/android.hardware.fastboot@1.0-impl-mock.so deleted file mode 100644 index f0afb94..0000000 Binary files a/prebuilt/android.hardware.fastboot@1.0-impl-mock.so and /dev/null differ diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc index 5fce2a2..9bc99b0 100644 --- a/recovery/root/init.recovery.qcom.rc +++ b/recovery/root/init.recovery.qcom.rc @@ -1,4 +1,5 @@ import /init.recovery.qcom_decrypt.rc +import /init.recovery.usb.rc on init write /sys/class/backlight/panel0-backlight/brightness 200 diff --git a/recovery/root/init.recovery.usb.rc b/recovery/root/init.recovery.usb.rc index d185f52..5eee014 100644 --- a/recovery/root/init.recovery.usb.rc +++ b/recovery/root/init.recovery.usb.rc @@ -25,26 +25,27 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -on early-init - setprop sys.usb.configfs 0 - on init mkdir /config mount configfs none /config mkdir /config/usb_gadget/g1 0770 shell shell write /config/usb_gadget/g1/bcdUSB 0x0200 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0xd001 + write /config/usb_gadget/g1/idVendor 0x22b8 + write /config/usb_gadget/g1/idProduct 0x2e81 mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} mkdir /config/usb_gadget/g1/functions/ffs.adb + mkdir /config/usb_gadget/g1/functions/ffs.fastboot mkdir /config/usb_gadget/g1/functions/mass_storage.0 mkdir /config/usb_gadget/g1/functions/mtp.gs0 write /config/usb_gadget/g1/os_desc/use 1 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell setprop sys.usb.configfs 1 on boot @@ -77,21 +78,23 @@ on property:sys.usb.ffs.ready=1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${sys.usb.controller} -on property:sys.usb.config=mtp && property:vendor.usb.use_ffs_mtp=1 && property:sys.usb.configfs=1 +on property:sys.usb.config=none && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/UDC "none" + stop adbd + setprop sys.usb.ffs.ready 0 + write /config/usb_gadget/g1/bDeviceClass 0 + write /config/usb_gadget/g1/bDeviceSubClass 0 + write /config/usb_gadget/g1/bDeviceProtocol 0 rm /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.config=mtp && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp" rm /config/usb_gadget/g1/configs/b.1/f2 rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x0B05 - write /config/usb_gadget/g1/idProduct 0x7772 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} + rmdir /config/usb_gadget/g1/functions/rndis.gs4 setprop sys.usb.state ${sys.usb.config} +on property:init.svc.adbd=stopped + setprop sys.usb.ffs.ready 0 + +# Recovery Mode- ADB & MTP on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 start adbd @@ -111,6 +114,7 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:s write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} +# Mass Storage USB Mode on property:sys.usb.config=mass_storage && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "msc" rm /config/usb_gadget/g1/configs/b.1/f1 @@ -128,6 +132,7 @@ on property:sys.usb.config=mass_storage && property:sys.usb.configfs=1 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} +# Mass Storage & ADB USB Mode on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1 start adbd @@ -149,6 +154,25 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && p write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} -on property:ro.boot.usbcontroller=* - setprop sys.usb.controller ${ro.boot.usbcontroller} - write /sys/class/udc/${ro.boot.usbcontroller}/device/../mode peripheral +# FastbootD ADB Functionality +on property:sys.usb.config=adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Motorola Recovery ADB" + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +# FastbootD fastboot Functionality +on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/UDC "none" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Motorola Recovery Fastboot" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/idVendor 0x22b8 + write /config/usb_gadget/g1/idProduct 0x2e80 + symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} diff --git a/system.prop b/system.prop index 862e4ad..57e4997 100644 --- a/system.prop +++ b/system.prop @@ -1,3 +1,5 @@ +ro.adb.secure=0 + # Audio audio.offload.min.duration.secs=30 persist.vendor.audio.hac.enable=false