Refactor Power Usage Time Page.

- Show use time category

Screenshot:
[Screen time with hint] https://screenshot.googleplex.com/3cRLrwevzw4iytb
[Background time with hint] https://screenshot.googleplex.com/zEf8PcWopCVCRZR
[without hint] https://screenshot.googleplex.com/9bao9sVd8s7VRwM
[enter from app info (without category)] https://screenshot.googleplex.com/8sozxMrq8ojadiF

Bug: 302063050
Test: Manual
Change-Id: Ic967d05a173afa76c2a958e1332dedd9f83cd687
This commit is contained in:
mxyyiyi
2023-09-25 18:57:33 +08:00
parent d11b9d1647
commit 1b9eb170dd
14 changed files with 407 additions and 79 deletions

View File

@@ -102,6 +102,8 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
String mAnomalyEntryKey;
@VisibleForTesting
String mAnomalyHintString;
@VisibleForTesting
String mAnomalyHintPrefKey;
public BatteryUsageBreakdownController(
Context context, Lifecycle lifecycle, SettingsActivity activity,
@@ -174,8 +176,13 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
(int) Math.round(diffEntry.getPercentage()));
Log.d(TAG, String.format("handleClick() label=%s key=%s package=%s",
diffEntry.getAppLabel(), diffEntry.getKey(), diffEntry.getPackageName()));
AdvancedPowerUsageDetail.startBatteryDetailPage(
mActivity, mFragment, diffEntry, powerPref.getPercentage(), mSlotTimestamp);
final String anomalyHintPrefKey = isAnomalyBatteryDiffEntry(diffEntry)
? mAnomalyHintPrefKey : null;
final String anomalyHintText = isAnomalyBatteryDiffEntry(diffEntry)
? mAnomalyHintString : null;
AdvancedPowerUsageDetail.startBatteryDetailPage(mActivity, mFragment.getMetricsCategory(),
diffEntry, powerPref.getPercentage(), mSlotTimestamp,
/*showTimeInformation=*/ true, anomalyHintPrefKey, anomalyHintText);
return true;
}
@@ -246,6 +253,8 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
? anomalyEventWrapper.getAnomalyEntryKey() : null;
mAnomalyHintString = anomalyEventWrapper != null
? anomalyEventWrapper.getAnomalyHintString() : null;
mAnomalyHintPrefKey = anomalyEventWrapper != null
? anomalyEventWrapper.getAnomalyHintPrefKey() : null;
}
showCategoryTitle(slotTimestamp);