Android: 怎样设置app不被系统k掉
2013-12-31 11:04
435 查看
Android: 怎样设置app不被系统k掉
2013-09-14 11:24:28 我来说两句 作者:u011884154
收藏
我要投稿
有一种方法可以设置app永远不会被kill,AndroidManifest.xml 中添加:
android:persistent="true"
适用于放在/system/app下的app
设置后app提升为系统核心级别,任何情况下不会被kill掉, settings->applications里面也会屏蔽掉stop操作,
设置前 Proc #19: adj=svc /B 4067b028 255:com.xxx.xxx/10001
(started-services)
# cat /proc/255/oom_adj
4
设置后 PERS #19: adj=core /F 406291f0 155:com.xxx.xxx/10001 (fixed)
# cat /proc/155/oom_adj
-12
lowmemorykiller的操作规则比如为
write /sys/module/lowmemorykiller/parameters/adj 0,1,2,4,7,15
write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192
可以看到,设置persistent后, oom_adj=-12,永远没有机会被lowmemorykiller处理
android:persistent
Whether or not the application should remain running at all times — "true" if it should, and "false" if not. The default value is "false". Applications should not normally set this flag;
persistence mode is intended only for certain system applications
代码
?
可以看到同时符合FLAG_SYSTEM(/system/app目录)及FLAG_PERSISTENT(android:persistent="true")
的app,设置app.maxAdj = CORE_SERVER_ADJ(-12),而adj=-12不会被lowmemorykiller处理
2013-09-14 11:24:28 我来说两句 作者:u011884154
收藏
我要投稿
有一种方法可以设置app永远不会被kill,AndroidManifest.xml 中添加:
android:persistent="true"
适用于放在/system/app下的app
设置后app提升为系统核心级别,任何情况下不会被kill掉, settings->applications里面也会屏蔽掉stop操作,
设置前 Proc #19: adj=svc /B 4067b028 255:com.xxx.xxx/10001
(started-services)
# cat /proc/255/oom_adj
4
设置后 PERS #19: adj=core /F 406291f0 155:com.xxx.xxx/10001 (fixed)
# cat /proc/155/oom_adj
-12
lowmemorykiller的操作规则比如为
write /sys/module/lowmemorykiller/parameters/adj 0,1,2,4,7,15
write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192
可以看到,设置persistent后, oom_adj=-12,永远没有机会被lowmemorykiller处理
android:persistent
Whether or not the application should remain running at all times — "true" if it should, and "false" if not. The default value is "false". Applications should not normally set this flag;
persistence mode is intended only for certain system applications
代码
?
可以看到同时符合FLAG_SYSTEM(/system/app目录)及FLAG_PERSISTENT(android:persistent="true")
的app,设置app.maxAdj = CORE_SERVER_ADJ(-12),而adj=-12不会被lowmemorykiller处理
相关文章推荐
- 怎样使一个Android应用不被杀死//Android: HowTo设置app不被系统kill掉
- 【代码】Android: 怎样设置app不被系统k掉
- 【代码】Android: 怎样设置app不被系统k掉
- zhu的工作日记:设置app语言与系统语言(android)
- Android: 设置 app 字体大小不跟随系统字体调整而变化
- Android 设置app字体不受Android系统控制
- Android_下载应用程序源代码(找到系统怎样在"系统设置"中识别哪些应用程序是用户下载(非系统)的应用程序的源代码)
- Android系统使用global key 一键启动指定APP或者打开WiFi/蓝牙等系统设置界面
- android系统设置里的触摸提示音功能怎样实现开启和关闭?
- Android如何在app中通过一个按钮直接跳转到的系统的权限设置页面
- 【Android】 设置App字体不跟随系统字体改变
- 设置Android app的字体不随系统全局字体大小的变动而变动
- Android: HowTo设置app不被系统kill掉
- android设置系统文字大小后App的文字会变化
- Android: HowTo设置app不被系统kill掉
- Android: HowTo设置app不被系统kill掉
- Android设置App字体不跟随系统字体大小变化
- Android App 设置persist 类型系统变量异常分析
- Android中设置APP应用字体不缩放,文字不随系统字体大小变化
- 转:设置Android app的字体不随系统全局字体大小的变动而变动