在有/无部分/全部唤醒锁的情况下,打ze模式如何影响后台/前台服务? [英] How does doze mode affect background/foreground services, with/without partial/full wakelocks?

查看:167
本文介绍了在有/无部分/全部唤醒锁的情况下,打ze模式如何影响后台/前台服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个简单的问题,看到有关Google+的大量帖子( 此处 ),并且缺少有关官方文档的信息( 此处 ):

This is a simple question, seeing that there is a huge post about this on G+ (here), and lack of information on official docs (here ):

当设备进入打ze"模式时,应用程序的服务会发生什么?

What happens to the app's services when the device goes to "doze" mode?

在有/没有部分/全部唤醒锁的情况下,它对后台/前台服务(绑定/未绑定,已启动/未启动)有什么作用?

What does it do to background/foreground services (bound/unbound, started/not-started), with/without partial/full wakelocks?

例如,为了创建一种在设备屏幕关闭时播放音频流的服务,您会怎么做?如果音频流不是来自本地文件,而是来自网络,该怎么办?

What would you do, for example, in order to create a service that plays an audio stream while the device's screen is turned off? What if the audio stream is not from a local file, but from the network?

看到Google开发人员提出了索赔:

Seeing that there was a claim by Google developer:

已在运行前台服务的应用程序(以及相关的 通知)不受打ze的限制.

Apps that have been running foreground services (with the associated notification) are not restricted by doze.

-在那之后进行了很多讨论,声称这并不完全正确,我认为知道特殊的后台操作应用程序应该做什么非常令人困惑.

-yet a lot of discussion after that, claiming this is not entirely true, I think it's quite confusing to know what special background-operations apps should do.

推荐答案

具有当前正在运行的前台服务的进程应该不受Doze的影响.绑定/未绑定,已启动/未启动以及唤醒锁不会影响此白名单过程.

Processes which have a current running foreground service are supposed to be unaffected by Doze. Bound/unbound, started/not-started, and wakelocks do not affect this whitelisting process.

但是,Android M设备上有问题当前台服务处于与最高活动相同的过程中并且不正确地打do睡时,前台服务没有被正确地列入白名单.

However, there is an issue on Android M devices where foreground services are not properly whitelisted when the foreground service is the in the same process as the top activity and improperly dozed.

此修复程序可在AOSP上 获得,并将包含在以下版本中AndroidN.由OEM将此补丁集成到他们生产的任何Android M版本中.

The fix is available on AOSP and will be included in builds of Android N. It would be up to OEMs to integrate that patch into any Android M builds they produce.

这篇关于在有/无部分/全部唤醒锁的情况下,打ze模式如何影响后台/前台服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆