Android M(预览)打盹模式和AlarmManager

Fra*_*eli 6 android emulation android-6.0-marshmallow

当操作系统进入打盹模式时,我正试图测试我们的Android应用程序的行为.我正在使用运行Android API 23(修订版1)的模拟器.应用程序使用类型为ELAPSED_REALTIME_WAKEUP的方法setInexactRepeating通过AlarmManager启动服务.我将警报设置为大约每三分钟启动一次(仅用于测试目的).经过多次尝试(官方指南非常不清楚),我通过锁定模拟器的屏幕并运行dumpsys建议的命令,成功地将模拟器置于IDLE状态.当设备处于空闲状态时,我仍然可以看到警报正在启动服务.这不应该是预期的行为.我期待警报停止.这是一个错误吗?或者我错过了什么?

Vic*_*mes 1

对于测试使用下面的代码。

adb shell dumpsys deviceidle enable 
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
adb shell dumpsys deviceidle force-idle
Run Code Online (Sandbox Code Playgroud)

用于setAndAllowWhileIdle强制智能手机唤醒。

就我而言,我使用这个:

adb shell dumpsys deviceidle enable 
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
adb shell dumpsys deviceidle force-idle
Run Code Online (Sandbox Code Playgroud)

我相信预期的是警报会停止。