What's the behavior of App killed or restored by Android System or by users?



First, user kills the app by swiping out the screen

The DEMO process is killed and activity stack is cleared. And the system will relaunch the DEMO process automatically.  When user launch the app, it will just likes user taps App icon in home screen.

Second, user force to stop the app on the app information page

The DEMO process is killed and activity stack is cleared. When user launches the app,  it will just likes user taps App icon in home screen.

Third,Killed/restored by system when there’s insufficient memory.

Two behaviours,

1. If DEMO app is running in background (press home button to move DEMO task to background).

For example, go to about -> what’s new , stay in what’s new screen, then press the home menu to move DEMO app to background, the activity stack is:

TaskRecord{671c710 #129 A=com.demo.android U=0sz=3}

        Run #7: ActivityRecord{1f2503f6 u0com.demo.android/.whatsnew.WhatsNewActivity t129}

        Run #6: ActivityRecord{10cbd46 u0com.demo.android/.settings.About t129}

        Run #5: ActivityRecord{867b18f u0com.demo.android/.main t129}

Then kill the DEMO process, system will relaunch the DEMO process automatically, but the activity stack does not be restored, the task record is empty,

TaskRecord{671c710 #129 A=com.demo.android U=0 sz=3}

Then  relaunch the DEMO app from launcher, the task record is:

TaskRecord{671c710 #129 A=com.demo.android U=0 sz=4}

        Run #5: ActivityRecord{229cb1f7 u0com.demo.android/.main t129}

We see here system will launch the root activity (main)instead of keep the last activity (WhatsNewActivity).

2. If DEMO app is running, and switch to other app from notification. 

Follow the same flow of case 1. Keep in what’s new screen:

TaskRecord{671c710 #129 A=com.demo.android U=0 sz=3}

        Run #7: ActivityRecord{69eb835 u0com.demo.android/.whatsnew.WhatsNewActivity t129}

        Run #6: ActivityRecord{2ca853c5 u0com.demo.android/.settings.About t129}

        Run #5: ActivityRecord{867b18f u0com.demo.android/.main t129}

Kill DEMO app, system will relaunch the demo process automatically.Press back key to return DEMO app.

TaskRecord{671c710 #129 A=com.demo .android U=0 sz=3}

        Run #5: ActivityRecord{69eb835 u0com.demo.android/.whatsnew.WhatsNewActivity t129}

We see here we still stay in the What’s new screen, press back will back to about screen. System will restore the activity stack. However,because the new process lose all global data, such as auth status, and otherdata in memory, so the DEMO will be in a
wrong status.

Finally,I trigger the scenario  "system is lack of memory", and we can learn that  Both UI process and Service
process of DEMO app killed /restored bysystem when in low memory, and the activity stack will be empty, once it restored by system, it just likes user taps demo app icon in home screen.

最新文章

  1. scala 学习笔记(07) 一等公民的函数
  2. iOS开发之网络编程--使用NSURLConnection实现文件上传
  3. virtualbox 在window10上的兼容性调整
  4. Zygote(app_process)相关分析1
  5. @synthesize 有什么好处?
  6. 深刻理解Java中final的作用(一):从final的作用剖析String被设计成不可变类的深层原因
  7. 使用tornado让你的请求异步非阻塞
  8. python 下的数据结构与算法---7:查找
  9. oracle实现今年数据 去年同期和增长百分比
  10. POJ 2182 Lost Cows(牛排序,线段树)
  11. KoaHub平台基于Node.js开发的Koa 连接支付宝插件代码信息详情
  12. Python collections模块总结
  13. Kafka 存储机制和副本
  14. 例题:填词-poj
  15. “《编程珠玑》(第2版)第2章”:B题(向量旋转)
  16. DOM随时记
  17. [转]数据库中间件 MyCAT源码分析——跨库两表Join
  18. influence maximization
  19. linux下如何把php升级到5.6
  20. css3实现不同进度条

热门文章

  1. 懒加载js实现和优化
  2. netstat---显示Linux中网络系统的状态信息
  3. FormatMessage函数的使用方法
  4. linux中内存泄漏的检測(五)记录内存泄漏的代码
  5. 跟着鬼哥学so改动,三,作业篇
  6. Day3晚笔记
  7. node:json与csv互转
  8. SQLITE数据表主键设置Id自增方法
  9. 记2018/5/5 qbxt 测试
  10. libiconv 支持的编码