Reduce UsageStatsXmlV1 log messages.

When parsing newly added fields from Xml database, must catch
the IOException because the new fields do not exist in old Xml database.
This is not really an error. Change Log.e to Log.i, do not print the
full stack.

Change-Id: I5ba86790f7c8eadf4f5dd20d28f9348a23201f87
Fix: 121085733
Test: atest UsageStatsDatabaseTest.java
This commit is contained in:
Hui Yu
2018-12-17 10:13:17 -08:00
parent 89ebdecf75
commit 63c0ad4dbb

View File

@@ -98,14 +98,14 @@ final class UsageStatsXmlV1 {
stats.mLastTimeVisible = statsOut.beginTime + XmlUtils.readLongAttribute(
parser, LAST_TIME_VISIBLE_ATTR);
} catch (IOException e) {
Log.e(TAG, "Failed to parse mLastTimeVisible", e);
Log.i(TAG, "Failed to parse mLastTimeVisible");
}
try {
stats.mLastTimeForegroundServiceUsed = statsOut.beginTime + XmlUtils.readLongAttribute(
parser, LAST_TIME_SERVICE_USED_ATTR);
} catch (IOException e) {
Log.e(TAG, "Failed to parse mLastTimeForegroundServiceUsed", e);
Log.i(TAG, "Failed to parse mLastTimeForegroundServiceUsed");
}
stats.mTotalTimeInForeground = XmlUtils.readLongAttribute(parser, TOTAL_TIME_ACTIVE_ATTR);
@@ -113,14 +113,14 @@ final class UsageStatsXmlV1 {
try {
stats.mTotalTimeVisible = XmlUtils.readLongAttribute(parser, TOTAL_TIME_VISIBLE_ATTR);
} catch (IOException e) {
Log.e(TAG, "Failed to parse mTotalTimeVisible", e);
Log.i(TAG, "Failed to parse mTotalTimeVisible");
}
try {
stats.mTotalTimeForegroundServiceUsed = XmlUtils.readLongAttribute(parser,
TOTAL_TIME_SERVICE_USED_ATTR);
} catch (IOException e) {
Log.e(TAG, "Failed to parse mTotalTimeForegroundServiceUsed", e);
Log.i(TAG, "Failed to parse mTotalTimeForegroundServiceUsed");
}
stats.mLastEvent = XmlUtils.readIntAttribute(parser, LAST_EVENT_ATTR);