Force a battery tracker update on dumping proto request

There is an internal throttling but it shouldn't be applicable to
the dump request.

Bug: 203105544
Test: dumpsys activity app-restrictions --proto
Change-Id: Iff718224f08df1b63f7f90c210faf3e01bbee1e3
This commit is contained in:
Jing Ji
2022-05-19 14:18:46 -07:00
parent b6da699d30
commit 2eacc393f8

View File

@@ -839,6 +839,8 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy>
@Override
void dumpAsProto(ProtoOutputStream proto, int uid) {
// Force an update.
updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true);
synchronized (mLock) {
final SparseArray<ImmutableBatteryUsage> uidConsumers = mUidBatteryUsageInWindow;
if (uid != android.os.Process.INVALID_UID) {