我有一部连接了太阳能充电器的智能手机。白天可以正常充电,但是在晚上由于能量不足有时会自动关机。
我的问题是:是否可以在电池充电超过一定百分比后(通过编程)将其重新打开? 我希望找到一个干净合法的方法,而不是漏洞或攻击。我在官方文档中没有找到任何信息。谢谢。
我有一部连接了太阳能充电器的智能手机。白天可以正常充电,但是在晚上由于能量不足有时会自动关机。
我的问题是:是否可以在电池充电超过一定百分比后(通过编程)将其重新打开? 我希望找到一个干净合法的方法,而不是漏洞或攻击。我在官方文档中没有找到任何信息。谢谢。
/system/bin
目录中。三星设备通常将脚本命名为playlpm
,我见过的其他脚本名称包括ipod
、lpm
和battery_charging
。但这种方法并不一定适用于所有设备,因为它远离了标准的Android框架——某些设备可能没有等效的脚本,或者它们可能以不同的方式实现。#!/system/bin/sh
# battery threshold before boot-up (in percent)
bthresh=10
# time to sleep between checks (in seconds)
sleeptime=600
# file that contains current battery level as integer between 0 and 100
cfi=/sys/class/power_supply/battery/capacity
# file that contains 1 if we're plugged in to AC, 0 if not
acfi=/sys/class/power_supply/battery/subsystem/ac/online
# if either file doesn't exist, just do normal sleep+boot
[ ! -f $cfi ] && sleep $sleeptime && /system/bin/reboot
[ ! -f $acfi ] && sleep $sleeptime && /system/bin/reboot
# populate capacity and AC variables
c=`cat $cfi`
ac=`cat $acfi`
# stop loop if we're not plugged into AC
until [ "$ac" -eq 0 ]
do
# if capacity above threshold, boot up
if [ "$c" -gt "$bthresh" ]; then
/system/bin/reboot
fi
# wait some time before next check
sleep $sleeptime
# update capacity and AC variables
c=`cat $cfi`
ac=`cat $acfi`
done
没有对设备进行 root,是不可能的。
如果设备已经关闭,就无法在其上运行任何类型的软件。
启动设备是一项硬件任务,必须有物理电源来运行设备(例如按下电源按钮)。因此您无法仅通过代码进行此操作。必须存在物理电源。