Android N Behavior Changes 笔记
来源:互联网 发布:linux 查找字符串 编辑:程序博客网 时间:2024/05/16 03:13
一、性能改进
1.Doze模式的优化
在安卓6.0中,安卓引入了新的省电机制Doze,当时针对的场景只是当手机同时处于灭屏以及静止状态来减少应用对电量的消耗。但是在实际使用中手机灭屏时不仅仅是处于静止状态,还有很多情况下是处于运动状态的,例如步行,坐车,坐飞机等情况,这时Doze就不会生效。比如你出门在外把手机放在裤子口袋,若是Android 6.0的Doze则会认为用户还可能会使用设备而不启动后台省电管理机制。然而Android N在此基础上更近了一步,将Doze分成多个层次.
When a device is on battery power, and the screen has been off for a certain time, the device enters Doze and applies the first subset of restrictions: It shuts off app network access, and defers jobs and syncs. If the device is stationary for a certain time after entering Doze, the system applies the rest of the Doze restrictions toPowerManager.WakeLock
, AlarmManager
alarms, GPS, and Wi-Fi scans. Regardless of whether some or all Doze restrictions are being applied, the system wakes the device for brief maintenance windows, during which applications are allowed network access and can execute any deferred jobs/syncs.
从这段文字可以看出。
Android 对于Doze在原来的基础上变得更加严格。
当一个设备使用电池供电,屏幕关闭一段时间后,就会进入Doze。这一点上跟原来6.0机制一样。进入Doze后,将关掉应用网络访问能力同时延期一些系统工作与同步任务。
当设备进入Doze一段时间并持续保持静止时,进入途中第三阶段的Doze,系统将限制PowerManager.WakeLock
, AlarmManager
alarms, GPS, and Wi-Fi scans这些功能的使用。
(在Android 6.0中,AlarmManager新增了setAndAllowWhileIdle()
and setExactAndAllowWhileIdle()
方法,如果你的app需要在Doze下用AlarmManger设置alarm做点什么,如唤起进程等,可以改用这两个方法,这两个方法设置的Alarms在系统处于Doze也能起作用。)
但是从图中可以看出,每隔一段时间,系统会周期性地唤起一个 brief maintenance 窗口,在唤起窗口的这段时间,应用将被允许联网和执行其他活动。在这个窗口结束之后,设备将再次进入Doze。随着时间的增长,系统唤起maintenance windows的频率将越来越低。
更详细的Doze解释可以查看官方文档Optimizing for Doze and App Standby
2.项目瘦身:后台的优化
ACTION_NEW_PICTURE
and ACTION_NEW_VIDEO
这三个广播。ACTION_NEW_PICTURE
and ACTION_NEW_VIDEO
这两个广播,用户用照相机拍一张照片,这些广播被监听也将导致apps被唤起。To alleviate these issues, Android N applies the following optimizations:
- Apps targeting Android N do not receive
CONNECTIVITY_ACTION
broadcasts, even if they have manifest entries to request notification of these events. Apps running in the foreground can still listen forCONNECTIVITY_CHANGE
on their main thread if they request notification with aBroadcastReceiver
. - Apps cannot send or receive
ACTION_NEW_PICTURE
orACTION_NEW_VIDEO
broadcasts. This optimization affects all apps, not only those targeting Android N.
ACTION_NEW_PICTURE
or ACTION_NEW_VIDEO
广播了。二、权限更改
1.弃用了GET_ACCOUNTS权限。
2.文件系统权限变更
MODE_WORLD_READABLE
and/or MODE_WORLD_WRITEABLE
来修改文件权限,将会抛出SecurityException;三、可访问性的改进
1.屏幕放大
2.在安装向导有视觉设置
四、NDK Apps Linking to Platform Libraries
五、其他重点:
所有tartgetSDK低于Android N版本的应用运行在Android N系统上时,用户的以下操作可能会导致崩溃,需要引起注意:
1.修改了屏幕显示图标大小或者字体大小,并从最近使用的程序中回到应用。
2.从DDMS中手动杀死应用
- Android N Behavior Changes 笔记
- android 4.4 - Important Behavior Changes
- Android 7.0 Behavior Changes(Android 7.0 新特征)
- 和开发者相关的 Android N Changes(新特性)
- Android Behavior
- Android开发笔记(一百三十七)自定义行为Behavior
- Behavior Desing教程笔记
- YII2 学习笔记 --- Behavior
- Behavior Designer 入门笔记.
- android setbackgroundresource changes padding
- 【Android】Configuration Changes
- Android 5.0 Changes
- Android Handling Runtime Changes
- Android 6.0 Changes
- Changes of Android 6.0
- Android 6.0 Changes
- Android Handling Runtime Changes
- Android 6.0 changes 上
- github代码不能更新
- Caffe学习系列(15):计算图片数据的均值
- freemark
- android DPI 计算 及单位换算
- 并发 并行 同步 异步 多线程 多进程 阻塞 非阻塞
- Android N Behavior Changes 笔记
- 设计模式-8-外观模式
- C# winform中实现Datagridview中只允许输入数字类型
- IntelliJ IDEA 使用 Resin + JRebel 实现热部署
- angualrjs动态加载分析
- hadoop学习从0开始-mapreduce
- SystemServer的诞生过程
- 图片处理(缩放、压缩)
- 硬中断机制(powerpc版)