From 736450e6c566fcba5dcae95db1b0d4529bdc14ae Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 7 Jul 2023 23:49:07 +0000 Subject: [PATCH] Fix logspam from AppIdleHistory on first boot Before /data/system/users/0/app_idle_stats.xml has been created, it is expected that it doesn't exist. Log a simple debug message instead of an error message with stacktrace. Bug: 290410617 Test: booted Cuttlefish and checked logcat Change-Id: I19a72e3bd74038e7447a2d47529022a68a13b1e9 Merged-In: I19a72e3bd74038e7447a2d47529022a68a13b1e9 (cherry picked from commit 4aa768b46baff4ddbb9aa3342676300ee4c31008) Signed-off-by: Anushek Prasal --- .../service/java/com/android/server/usage/AppIdleHistory.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java index fb342b9ba9b3..913a76a65026 100644 --- a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java +++ b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java @@ -61,6 +61,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; @@ -802,6 +803,9 @@ private void readAppIdleTimes(int userId, ArrayMap user } } } + } catch (FileNotFoundException e) { + // Expected on first boot + Slog.d(TAG, "App idle file for user " + userId + " does not exist"); } catch (IOException | XmlPullParserException e) { Slog.e(TAG, "Unable to read app idle file for user " + userId, e); } finally {