Skip to content
Snippets Groups Projects
Commit 0cb75c6d authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Fix NullPointerException when telephony does not return ModemActivityInfo

Bug: 342865877
Test: atest FrameworksServicesTests PowerStatsTests
Test: atest --host FrameworksServicesTestsRavenwood PowerStatsTestsRavenwood
Flag: com.android.server.power.optimization.streamlined_connectivity_battery_stats
Change-Id: Iaabbf99a672e2154d2927cc58aeb97b63d6d6488
parent 0800d12c
No related branches found
No related tags found
No related merge requests found
......@@ -195,6 +195,9 @@ public class MobileRadioPowerStatsCollector extends PowerStatsCollector {
return null;
}
Arrays.fill(mPowerStats.stats, 0);
mPowerStats.uidStats.clear();
collectModemActivityInfo();
collectNetworkStats();
......@@ -239,16 +242,16 @@ public class MobileRadioPowerStatsCollector extends PowerStatsCollector {
activityInfo = null;
}
if (activityInfo == null) {
return;
}
ModemActivityInfo deltaInfo = mLastModemActivityInfo == null
? (activityInfo == null ? null : activityInfo.getDelta(activityInfo))
? activityInfo.getDelta(activityInfo)
: mLastModemActivityInfo.getDelta(activityInfo);
mLastModemActivityInfo = activityInfo;
if (deltaInfo == null) {
return;
}
setTimestamp(deltaInfo.getTimestampMillis());
mLayout.setDeviceSleepTime(mDeviceStats, deltaInfo.getSleepTimeMillis());
mLayout.setDeviceIdleTime(mDeviceStats, deltaInfo.getIdleTimeMillis());
......@@ -293,8 +296,6 @@ public class MobileRadioPowerStatsCollector extends PowerStatsCollector {
}
private void collectNetworkStats() {
mPowerStats.uidStats.clear();
NetworkStats networkStats = mNetworkStatsSupplier.get();
if (networkStats == null) {
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment