Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63c0ad4d authored by Hui Yu's avatar Hui Yu
Browse files

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
parent 89ebdecf
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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);