移动设备是否将其从打瞌睡中唤醒

Does moving the device wake it up from DOZE

我正在寻找有关 Android 设备在打瞌睡模式(也称为空闲模式)期间的特定行为的信息。我的应用程序使用 setExactAndAllowIdle() 方法定期提供传感器信息。这当然不能完美地工作,但由于设备是(或应该是)静态的(屏幕关闭并从充电器上拔下)我不需要访问传感器。我的问题是:如果设备是静止的并且处于 DOZE 模式,移动设备是否会将它从 DOZE 唤醒?我用 adb 测试过,答案是否定的,但是当我用一个设备测试时,它给人的印象是移动设备实际上导致它离开 DOZE 模式。

我特别询问移动动作(不打开屏幕)是否将设备从 DOZE 唤醒。

另一个问题是:

有没有办法以编程方式判断是什么操作将设备从打瞌睡中唤醒?我知道 PowerManager.isDeviceIdle()

提前感谢您的回答。

As soon as the user wakes the device by moving it, turning on the screen, or connecting a charger, the system exits Doze and all apps return to normal activity
source

所以,是的,它确实可以通过移动唤醒。

Is there a way to programmatically tell what action woke the device from DOZE?

我不这么认为。

正如 CommonsWare 提到的他不确定,现在我有足够的信心简单地告诉你,不 :)