有一种方法可以设置app永远不会被kill,AndroidManifest.xml 中添加:
android:persistent="true"
适用于放在/system/app下的app
设置后app提升为系统核心级别,任何情况下不会被kill掉, settings->applications里面也会屏蔽掉stop操作,
设置前 Proc#19:adj=svc/B4067b028255:com.xxx.xxx/10001(started-services)
设置后 PERS#19:adj=core/F406291f0155: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处理
分享到:
相关推荐
HDR Deghosting: How to deal with Saturation, http://www.cs.duke.edu/~junhu/CVPR2013/
本书是互联网产品经理必读刊物,讲述了如何打造让用户上瘾的产品。
Web Hacking 101: How to Make Money Hacking Ethically By 作者: Peter Yaworski Pub Date: 2018 ISBN: n/a Pages: 255 Language: English Format: PDF Size: 10 Mb With a Foreword written by HackerOne Co-...
Think Perl 6: How to Think Like a Computer Scientist by Laurent Rosenfeld English | 8 May 2017 | ASIN: B0716P9W11 | 466 Pages | AZW3 | 1.02 MB Want to learn how to program and think like a computer ...
英文原版《Building Secure Software:How to avoid security problems the right way》By John Viega and Gary McGraw,PDF格式。
Quantitative Trading - How to Build Your Own Algorithmic Trading Business.
OpenCL in Action is a thorough, hands-on presentation of OpenCL, with an eye toward showing developers how to build high-performance applications of their own. It begins by presenting the core ...
Think Java: How to Think Like a Computer Scientist by Allen B. Downey, Chris Mayfield 2016 | ISBN: 1491929561 Currently used at many colleges, universities, and high schools, this hands-on ...
。。。。。。。Java: How to Program, 9th Edition (Deitel)
本书是针对没有经验或没有经验的人的计算机科学和编程的简介。 它从最基本的概念开始,并在首次使用时仔细定义所有术语。
Think Python-How to Think Like a Computer Scientist-Release 2nd Edition
Stealing the Network: How to Own the Box
大班英语教案:how to make tea.doc
Android is a software toolkit for mobile phones, created by Google and ... In addition, two new appendixes show you how to create Widgets for the Home screen and publish your application to the Android
How to create a media app for Android TV What are the game design/development considerations for Android TV How to distribute Android TV apps Audience:Developers with some experience with Android ...
think python:how to think like a computer scientist 2nd,英文原版
Android How to Program(2nd) 英文无水印pdf 第2版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开
1.Thinking With Data How To Turn Information Into Insights 2014; 2.英文原版,PDF格式;