commit | 4475ced02afd89fb6c994628444ea881bf1bde9e | [log] [tgz] |
---|---|---|
author | Rui Qiu <ruiqiu@google.com> | Tue Oct 05 17:59:32 2021 -0700 |
committer | Rui Qiu <ruiqiu@google.com> | Tue Oct 05 18:01:47 2021 -0700 |
tree | 859c7991f356ef75d86181ddc01cbd68c84234de | |
parent | 2ee27c8981bf6d84f8f949b57689c91d6579fcaf [diff] |
[RESTRICT AUTOMERGE] Fix stats publisher test caused by file not found Caused by a change in StatsPublisher logic in ag/15974402 Bug: 202219412 Test: atest CarServiceUnitTest:StatsPublisherTest Change-Id: I9ab095a3842c924959395e7cb0a392faa819ca7b
diff --git a/tests/carservice_unit_test/src/com/android/car/telemetry/publisher/StatsPublisherTest.java b/tests/carservice_unit_test/src/com/android/car/telemetry/publisher/StatsPublisherTest.java index 2ed12bd..8173c2f 100644 --- a/tests/carservice_unit_test/src/com/android/car/telemetry/publisher/StatsPublisherTest.java +++ b/tests/carservice_unit_test/src/com/android/car/telemetry/publisher/StatsPublisherTest.java
@@ -395,6 +395,9 @@ private PersistableBundle getSavedStatsConfigs() throws Exception { File savedConfigsFile = new File(mRootDirectory, StatsPublisher.SAVED_STATS_CONFIGS_FILE); + if (!savedConfigsFile.exists()) { + return new PersistableBundle(); + } try (FileInputStream fileInputStream = new FileInputStream(savedConfigsFile)) { return PersistableBundle.readFromStream(fileInputStream); }