adb shell am get-standby-bucket returns 总是 5

adb shell am get-standby-bucket returns always 5

强制应用待机时

adb shell am set-standby-bucket <package> rare

然后使用

进入待机模式

adb shell am get-standby-bucket <package>

adb returns 始终 5 无论设置模式如何。

5 是什么意思以及如何使这项工作按预期进行? 5 是指定模式的 none:https://developer.android.com/reference/android/app/usage/UsageStatsManager.html#getAppStandbyBucket()

有时,在删除并重新安装应用程序后,它应该会在很短的时间内正常工作,但随后由于未知原因停止工作。

信息没有尽可能清楚地描述,但在您提供的 link 中,在 STANDBY_BUCKET_ACTIVE 下,它说:

Standby bucket values that are ≤ STANDBY_BUCKET_ACTIVE will not be throttled by the system while they are in this bucket. Buckets > STANDBY_BUCKET_ACTIVE will most likely be restricted in some way. For instance, jobs and alarms may be deferred.

即5表示不节流