在android\system\core\rootdir\init.rc中添加
service setupreboot /system/bin/setupreboot.sh
class main
disabled
oneshot
service cleanapps /system/bin/cleanapps.sh
class main
disabled
oneshot
在应用中添加以下语句调用:
import android.os.SystemProperties;
SystemProperties.set("ctl.start", "cleanapps");