Fix screen time not updated issues.

When slotUsageData is null, the UI should update screen time to 0
instead of skipping update.

Bug: 304432148
Bug: 299801782
Bug: 301943900
Fix: 304432148
Fix: 299801782
Fix: 301943900
Test: manual
Change-Id: I25da1abf8ea79305ebf5468977b2a57ce917609f
This commit is contained in:
Zaiyue Xue
2023-10-10 15:38:32 +08:00
parent 1735474987
commit 8e6a5db9a2

View File

@@ -236,10 +236,8 @@ public class PowerUsageAdvanced extends PowerUsageBase {
final int hourlyIndex = mBatteryChartPreferenceController.getHourlyChartIndex(); final int hourlyIndex = mBatteryChartPreferenceController.getHourlyChartIndex();
final String slotInformation = mBatteryChartPreferenceController.getSlotInformation(); final String slotInformation = mBatteryChartPreferenceController.getSlotInformation();
final BatteryDiffData slotUsageData = mBatteryUsageMap.get(dailyIndex).get(hourlyIndex); final BatteryDiffData slotUsageData = mBatteryUsageMap.get(dailyIndex).get(hourlyIndex);
if (slotUsageData != null) { mScreenOnTimeController.handleSceenOnTimeUpdated(
mScreenOnTimeController.handleSceenOnTimeUpdated( slotUsageData != null ? slotUsageData.getScreenOnTime() : 0L, slotInformation);
slotUsageData.getScreenOnTime(), slotInformation);
}
// Hide card tips if the related highlight slot was clicked. // Hide card tips if the related highlight slot was clicked.
if (isAppsAnomalyEventFocused()) { if (isAppsAnomalyEventFocused()) {
mBatteryTipsController.acceptTipsCard(); mBatteryTipsController.acceptTipsCard();