启动优化(中篇)
本文链接:https://blog.youkuaiyun.com/feather_wch/article/details/131587046
1、我们可以优化部分
Application构建到主界面onWindowFocusChanged
2、启动方式(官方)
- 冷启动
- 热启动
- 温启动
3、怎么样算是卡顿?
- 卡顿:2-5-8原则
- 2秒以内:流程
- 2-5秒:可以接受
- 5-8秒:有些卡顿
- 8秒以上:非常卡顿,没办法接受,垃圾应用
4、Android Vitals是什么?
- google提出的计划,检测三种启动方式的耗时
- 冷5 热1.5 温2
5、如何查看App启动耗时时长?(app点击->可操作的时候onWindowFocuseChanged)
- 系统日志统计:
ActivityManager:Displayed
- adb 命令统计启动时间:
adb shell am start -S -W
6、CPU Profile/TraceView(废弃)相关图表
- Call Chart
- Flame Chart
- Top Down Tree
- Bottom Up Tree
7、假如版本不支持CPU Profiler怎么办?
- Debug.start/stopMethodTracing()
- Application创建时调用start(需要手动给予文件权限)
- onWindowFocuseC