当前位置:主页 > 刷机教程 >

关机状态下充电自动开机 移除充电器自动关机方案

分类栏目:刷机教程

19489

关机状态下充电自动开机 移除充电器自动关机方案

1. Enter Fastboot Mode (adb reboot bootloader)
2. Enter Command: fastboot oem off-mode charge 0
3. Enter Command: fastboot reboot

if that is not working for you maybe this one will work:

1. search in /system/bin/ for playlpm, ipod, lpm, kpoc_charger or any other file that have inside some reference to battery animation.
2. edit that file, delete all content inside and add
#!/system/bin/sh
/system/bin/reboot

if that is not working you can try this:

1. Unpack boot.img and edit init.rc. 
2. Add following to the end of file:
#Check if chargermode and start autoreboot service.
on property:ro.bootmode=charger
start autoreboot 

#autoreboot service which command reboot
service autoreboot /su/bin/su /system/bin/reboot -c reboot now
user root
oneshot

3. re-pack boot.img

None of that worked for me but I had an idea. Why not just create that damn file inside /bin ???

1. unpack boot.img
2. edit > ramdisk > init.target.rc (your file may have a different name then mine but search every file for "on charger" word using notepad++ and when you see that below that line are some "start" services you found it)
3. add start kpoc_charger to "on charger" line *** "kpoc_charger" can have any name be free to name it ***
4. add after:
service kpoc_charger /system/bin/kpoc_charger
class charge

5. create kpoc_charger file on root/system/bin/ with 755 permissions using any root file managers 
6. edit file and add:
#!/system/bin/sh
/system/bin/reboot


↑↑↑↑↑↑↑↑↑↑↑↑↑↑
基本上市面上常见的所有充电开机的方法

美图M4以上都方法无效,经测试,发现插电时的确调用了kpoc_charger这个文件,但是就是不执行reboot命令,用init 6 、powerctl等也不行,权限也正确是755。
后来用getprop 抓取系统属性,发现加载的服务很少,不像是加载init.rc的表现。猜测是某些服务没有运行导致reboot等命令无法执行。但是执行了kpoc_charger,说明了肯定加载了init.charging.rc,最后试验无数,大胆在init.charging.rc中加载init.rc,OK,成功了。
具体如下,修改init.charging.rc,增加import /init.rc 这一句。
# Copyright (C) 2012 The Android Open Source Project
#
# IMPORTANT: Do not create world writable files or directories.
# This is a common source of Android security bugs.
#
#import /init.${ro.hardware}.rc

import /init.rc
import /init.trace.rc
#import init.xlog.rc

然后按楼上的方法修改kpoc_charger,改成成脚本添加reboot命令就可以了。
改好重刷boot.img就可以了