From 9e5cf848fcaddf29e8a5a8e41cf5b06b785c5940 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Fri, 19 Mar 2021 11:07:01 -0700 Subject: [PATCH] Fix and re-enable BstatsCpuTimesValidationTest Thanks to jji@ for identifying the cause and the fix. Bug: 180015146 Test: atest FrameworksCoreTests:com.android.internal.os.BstatsCpuTimesValidationTest BYPASS_INCLUSIVE_LANGUAGE_REASON=Using a legacy command, cmd deviceidle whitelist Change-Id: I1dd2402719d5ae7752300b72a5afe3740ac7498a --- core/tests/coretests/BstatsTestApp/AndroidManifest.xml | 2 +- .../android/internal/os/BstatsCpuTimesValidationTest.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/tests/coretests/BstatsTestApp/AndroidManifest.xml b/core/tests/coretests/BstatsTestApp/AndroidManifest.xml index 1e6bdc6c29a02..fcb1e71cc3f56 100644 --- a/core/tests/coretests/BstatsTestApp/AndroidManifest.xml +++ b/core/tests/coretests/BstatsTestApp/AndroidManifest.xml @@ -19,7 +19,7 @@ - + desiredConstants = new ArrayMap<>(); desiredConstants.put(KEY_TRACK_CPU_TIMES_BY_PROC_STATE, Boolean.toString(true)); @@ -134,6 +135,7 @@ public class BstatsCpuTimesValidationTest { @AfterClass public static void tearDownOnce() throws Exception { + executeCmd("cmd deviceidle whitelist -" + TEST_PKG); if (sBatteryStatsConstsUpdated) { Settings.Global.putString(sContext.getContentResolver(), Settings.Global.BATTERY_STATS_CONSTANTS, sOriginalBatteryStatsConsts); @@ -382,7 +384,7 @@ public class BstatsCpuTimesValidationTest { } @Test - @SkipPresubmit("b/180015146 flakey") + @SkipPresubmit("b/183225190 flaky") public void testCpuFreqTimes_stateFgService() throws Exception { if (!sCpuFreqTimesAvailable || !sPerProcStateTimesAvailable) { Log.w(TAG, "Skipping " + testName.getMethodName() @@ -515,7 +517,6 @@ public class BstatsCpuTimesValidationTest { } @Test - @SkipPresubmit("b/180015146") public void testCpuFreqTimes_trackingDisabled() throws Exception { if (!sCpuFreqTimesAvailable || !sPerProcStateTimesAvailable) { Log.w(TAG, "Skipping " + testName.getMethodName() @@ -625,7 +626,7 @@ public class BstatsCpuTimesValidationTest { splitter.setString(settingsDump); String next; while (splitter.hasNext()) { - next = splitter.next(); + next = splitter.next().trim(); if (next.startsWith(key)) { return next.split("=")[1]; }