adb 获取 mUsageStatsManager.getAppStandbyBucket()
时间: 2024-02-20 18:01:04 浏览: 60
`mUsageStatsManager.getAppStandbyBucket()`是一个Java API,它用于获取指定应用程序的待机桶号。待机桶是Android系统中用于管理应用程序待机状态的一种机制,它将应用程序分成几个档次(0~5),每个档次都有不同的待机策略,例如限制网络访问、禁止后台更新等。使用ADB获取指定应用程序的待机桶号的命令如下:
```
adb shell dumpsys deviceidle | grep [package name]
```
其中 `[package name]` 是要获取待机桶号的应用程序的包名,命令会返回包含应用程序待机桶号的信息,例如:
```
Idle mode: active (change was from IDLE_MAINTENANCE)
mLastDeepIdleStartTime=-1
mLastIdleTime=-1
mInIdleMode=true
mLightState=ACTIVE
mDeepState=ACTIVE
mBucketActiveTimeout=+5m0s0ms
mBucketWorkingSetTimeout=+1m0s0ms
mBucketFrequentTimeout=+10s0ms
mBucketRareTimeout=+30s0ms
mBucketNeverTimeout=+1d0h0m0s0ms
mAppIdleParoleOn=false
mLastAppIdleParoledTime=-1
mScreenOn=false
mScreenLocked=true
mScreenOnTimer=0
mScreenOffTimer=2554
mNextIdlePendingDelay=+1m0s0ms (2404s from now)
mNextIdleDelay=-1 (unknown)
mNextAlarmTime=+2m2s394ms (1m43s from now)
mNextIdleDelay=-1 (unknown)
mAppIdling=false
mWhitelistAppIds=false
mPowerSaveWhitelistExceptIdleAppIds=false
mPowerSaveWhitelistAppIds=false
mPendingTempWhitelist={android,com.android.phone,com.android.systemui}
mTempWhitelistAppIdEndTimes=[]
mTempWhitelistAppIds=[]
mRecentWakeReasons=[wake:com.google.android.gms/.config.ConfigService,screen:off]
mIdleStartTime=-1 (unknown)
mIdleTimeStart=-1 (unknown)
mIdleHistory:
State ACTIVE: -1 (unknown) for 1m10s725ms
State IDLE_MAINTENANCE: -1 (unknown) for 2m18s238ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
State ACTIVE: -1 (unknown) for 0ms
State IDLE_MAINTENANCE: -1 (unknown) for 1m44s285ms
mLastIdleTimeStart=-1 (unknown)
mLastNetworkEvaluationTime=-1
mLastIdleLogTime=1633004061
mNumIdleDetections=1
mNumIdlesDelayed=0
mScreenOffIdleDelay=-1
mScreenOffTimeout=-1
mBucket=10
```
在这个例子中,待机桶号为10。
阅读全文