anasfanani/magisk-autoboot

OnePlus 8 Pro (Android 13)

Closed this issue · 3 comments

On my OnePlus 8 Pro running Android 13, the module didn't do anything once it was installed.

To get autoboot to work, I had to edit scripts/files/init.autoboot.rc to this:

on property:ro.bootmode=charger
  setprop sys.powerctl "reboot"

(Found here: https://github.com/hasanbulat/android-autoboot/blob/master/autoboot.op8t12.rc)

What would be the best way to provide this as an option to others?

Thankyou brother for using my module.

What would be the best way to provide this as an option to others?

Hmm, I dont have best idea for now, currently I dont have much time to edit the repository, I'm doing job on a election here, also the rc script is not supported for some devices, i dont know is that because can't execute autoboot.sh or already executed but cant boot because cant detect battery capacity at this line

CAPACITY=$(cat /sys/class/power_supply/battery/capacity)

or cant boot because when call on charger then execute

    setprop ro.bootmode "normal"
    setprop sys.powerctl "reboot"

is doing nothing, or even cant boot because the on charger is not executed any command when charger is connected.

This module is my first implementation of patching boot.img directly with TWRP or Magisk App as module, because in earlier I must patch manual with command.

There is so many reason why phone cant autoboot with this module.

How do you think about just separate the module with minimal function and extended function ( battery threshold ).
Also how if just create initrc with all available option for most known rc, just set this

on property:ro.bootmode=charger
  setprop sys.powerctl "reboot"

on charger
  setprop ro.bootmode "normal"
  setprop sys.powerctl "reboot"

If first method not work, the rc still have more attempt, if first attempt is work, the device not going respond to next attempt because the device already rebooted.

Apologize my english, this is my first time typing without validate my text to google translate 🤣

For now, I think people can manually edit the init.autoboot.rc and autoboot.sh if they need something not standard.

Long term, maybe it would be possible to ask for what options someone wants during installation?

Maybe something like this?:

# Define variables
BASE_LIB_DIR=$MODPATH/common/libs
MODDED_LIB=com.qti.chi.override.so
MODULE_LIB=$MODPATH/system/vendor/lib64/hw/$MODDED_LIB
SELECTION=1

# Use volume key selection to choose the vendor firmware version
ui_print " "
ui_print "- Please select the vendor firmware"
ui_print "  your ROM is presently using by"
ui_print "  pressing the desired volume button:"
ui_print " "
ui_print "  Vol + / Up   = Next Option"
ui_print "  Vol - / Down = Finalize Selection"
ui_print " "
ui_print "  1. OxygenOS 11"
ui_print "  2. OxygenOS 11 (Alternative)"
ui_print "  3. OxygenOS 12"
ui_print "  4. OxygenOS 13"
ui_print " "
ui_print "- Current Selection:"

while true; do
  ui_print "  $SELECTION"
  if chooseport 30; then
    SELECTION=$((SELECTION + 1))
  else
    break
  fi
  if [ $SELECTION -gt 4 ]; then
    SELECTION=1
  fi
done

# Copy the modded library to the module folder as per the vendor firmware selected
case $SELECTION in
  1)
    ui_print " "
	ui_print "- Selected Vendor Firmware:"
	ui_print " "
	ui_print "  OxygenOS 11"
	ui_print " "
	ui_print "- Copying appropriate modded library"
	cp_ch "$BASE_LIB_DIR"/oos11/$MODDED_LIB "$MODULE_LIB"
	;;
  2)
    ui_print " "
	ui_print "- Selected Vendor Firmware:"
	ui_print " "
	ui_print "  OxygenOS 11 (Alternative)"
	ui_print " "
	ui_print "- Copying appropriate modded library"
	cp_ch "$BASE_LIB_DIR"/oos11-alt/$MODDED_LIB "$MODULE_LIB"
	;;
  3)
    ui_print " "
	ui_print "- Selected Vendor Firmware:"
	ui_print " "
	ui_print "  OxygenOS 12"
	ui_print " "
	ui_print "- Copying appropriate modded library"
	cp_ch "$BASE_LIB_DIR"/oos12/$MODDED_LIB "$MODULE_LIB"
	;;
  4)
    ui_print " "
	ui_print "- Selected Vendor Firmware:"
	ui_print " "
	ui_print "  OxygenOS 13"
	ui_print " "
	ui_print "- Copying appropriate modded library"
	cp_ch "$BASE_LIB_DIR"/oos13/$MODDED_LIB "$MODULE_LIB"
	;;
esac


(From https://www.celsoazevedo.com/files/android/p/camera-unlocker-oneplus-8-9r/ )

Anyway thankyou, now I use all known available rc value to trigger autoboot.

on property:ro.bootmode=charger
    setprop ro.bootmode "normal"
    setprop sys.powerctl "reboot"
on charger
    setprop ro.bootmode "normal"
    setprop sys.powerctl "reboot"
on property:sys.boot_from_charger_mode=1
    setprop ro.bootmode "normal"
    setprop sys.powerctl "reboot"

Implemented on simple version.

Also fix the autoboot.sh error handling, should work for all device.

I do not have any clue about specific OEM setting, so I choose to use all known rc.
https://github.com/anasfanani/magisk-autoboot/releases/tag/v2.0.0

Thankyou again, sorry for late response, let me close this issue.