factaory data reset

来源:互联网 发布:软件设计师考什么 编辑:程序博客网 时间:2024/06/03 05:57

 

1,write file recovery.sh in system/core/rootdir/etc/

 

2,modify file system/core/rootdir/Android.mk to copy recovery.sh to devices's system/etc/ when building.

 

3,modify file system/core/rootdir/init.rc to add a sevices.

 

e.g

 

service recovery /system/bin/logwrapper /system/etc/recovery.sh

 

disabled

 

 

oneshot

 

on property:persist.service.recovery.enable=1

 

start recovery

 

on property:persist.service.recovery.enable=0

 

 

stop recovery

 

add chmod 0777 /system/etc/recovery.sh on file init.rc to recovery.sh can run

 

"/system/bin/logwrapper" can see recovery.sh'log on "adb logcat"
java layer

 

 

SystemProperties.set(string key,string val); can modify "persist.service.recovery.enable"'s valua .

 

there is a file that you must to edit ,

 

system/core/init/property_service.c   这个文件增加属性的用户

 

 

the last file you must to edit

 

system/core/include/private/android_filesystem_config.h 增加脚本的执行权限