Merge "Refine optimize page log pattern" into udc-dev am: d865ccc2ed am: 48002a9d03 am: 961a19c1f8 am: ca3dd86485

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23129577

Change-Id: Ica08043dff2238a9330a30e78305049d9433a040
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-10 19:40:36 +00:00
committed by Automerger Merge Worker
4 changed files with 13 additions and 7 deletions

View File

@@ -57,17 +57,18 @@ public final class BatteryHistoricalLogUtilTest {
BatteryHistoricalLogUtil.writeLog(mContext, Action.APPLY, "pkg1", "logs");
BatteryHistoricalLogUtil.printBatteryOptimizeHistoricalLog(mContext, mTestPrintWriter);
assertThat(mTestStringWriter.toString()).contains("pkg1\tAction:APPLY\tEvent:logs");
assertThat(mTestStringWriter.toString()).contains(
"pkg1\tAction:APPLY\tEvent:logs\tTimestamp:");
}
@Test
public void writeLog_multipleLogs_withCorrectCounts() {
for (int i = 0; i < BatteryHistoricalLogUtil.MAX_ENTRIES; i++) {
BatteryHistoricalLogUtil.writeLog(mContext, Action.MANUAL, "pkg" + i, "logs");
BatteryHistoricalLogUtil.writeLog(mContext, Action.LEAVE, "pkg" + i, "logs");
}
BatteryHistoricalLogUtil.printBatteryOptimizeHistoricalLog(mContext, mTestPrintWriter);
assertThat(mTestStringWriter.toString().split("MANUAL").length).isEqualTo(41);
assertThat(mTestStringWriter.toString().split("LEAVE").length).isEqualTo(41);
}
@Test