由于关机充电,healthd是没有启动ADB服务的,对于调试或者学习关机充电的流程比较不方便,本文介绍的是一种在Android系统起来后,手动触发charger的可执行文件进行调试的方法。
1.首先你需要更改surfaceflinger.rc
原生如下:
out/target/product/msm8953_64/system/etc/init/surfaceflinger.rc
service surfaceflinger /system/bin/surfaceflinger
class core
user system
group graphics drmrpc readproc
onrestart restart zygote
writepid /dev/stune/foreground/tasks
更改为下面的代码
service surfaceflinger /system/bin/surfaceflinger
class core
user system
group graphics drmrpc readproc
oneshot
writepid /dev/stune/foreground/tasks
我们需要在Android系统起来后,首先杀掉surfaceflinger进程,这里的改动是为了保证surfaceflinger不会被系统重启
2.先杀掉surfaceflinger进程
zqp1659_v2:/ # ps | grep "sur"
system 439 1 48728 9684 SyS_epoll_ b4de0438 S /system/bin/surfaceflinger
zqp1659_v2:/ # kill -9 439
3.启动关机充电的charger进程
zqp1659_v2:/ # ./charger
failed to read font: res=-1
cannot find/open a drm device: No such file or directory
fb0 reports (possibly inaccurate):
vi.bits_per_pixel = 32
vi.red.offset = 0 .length = 8
vi.green.offset = 8 .length = 8
vi.blue.offset = 16 .length = 8
framebuffer: 0 (720 x 1440)
4.如果一切正常,你将能够看到关机充电的动画