1

I need shutdown android system after disconnect charger.

I have android 6.0.1 (rooted), and I'm looking for to power off phone, when it's not charging. I'm looking for programming solution. I have power on phone when I start charging phone. To do it I changed init.rc file. Now I looking for which file I can change, to achive power off phone after disconneted charger.

I have this code in init.rc:

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

To test, I added this to function "on charge"r too:

sleep 300
/system/bin/busybox poweroff -f

and finally I have:

on charger
    setprop ro.bootmode "normal"
    setprop sys.powerctl "reboot"
    sleep 300
    /system/bin/busybox poweroff -f

but it didn't work.

I tested:

/system/bin/setprop sys.powerctl shutdown
/system/bin/svc power shutdown
/system/bin/busybox poweroff -f

Phone never shutdown after connect charger (this was only test, I need shutdown after disconnect charger, not after connect, but why this commands didn't work?).

3

0

You must log in to answer this question.

Browse other questions tagged .