Loading services/usage/java/com/android/server/usage/UsageStatsDatabase.java +17 −12 Original line number Diff line number Diff line Loading @@ -378,9 +378,8 @@ class UsageStatsDatabase { } } try { IntervalStats stats = new IntervalStats(); ArrayList<T> results = new ArrayList<>(); final IntervalStats stats = new IntervalStats(); final ArrayList<T> results = new ArrayList<>(); for (int i = startIndex; i <= endIndex; i++) { final AtomicFile f = intervalStats.valueAt(i); Loading @@ -388,16 +387,18 @@ class UsageStatsDatabase { Slog.d(TAG, "Reading stat file " + f.getBaseFile().getAbsolutePath()); } try { UsageStatsXml.read(f, stats); if (beginTime < stats.endTime) { combiner.combine(stats, false, results); } } return results; } catch (IOException e) { Slog.e(TAG, "Failed to read usage stats file", e); return null; // We continue so that we return results that are not // corrupt. } } return results; } } Loading Loading @@ -450,6 +451,10 @@ class UsageStatsDatabase { mCal.addDays(-7); pruneFilesOlderThan(mIntervalDirs[UsageStatsManager.INTERVAL_DAILY], mCal.getTimeInMillis()); // We must re-index our file list or we will be trying to read // deleted files. indexFilesLocked(); } } Loading Loading
services/usage/java/com/android/server/usage/UsageStatsDatabase.java +17 −12 Original line number Diff line number Diff line Loading @@ -378,9 +378,8 @@ class UsageStatsDatabase { } } try { IntervalStats stats = new IntervalStats(); ArrayList<T> results = new ArrayList<>(); final IntervalStats stats = new IntervalStats(); final ArrayList<T> results = new ArrayList<>(); for (int i = startIndex; i <= endIndex; i++) { final AtomicFile f = intervalStats.valueAt(i); Loading @@ -388,16 +387,18 @@ class UsageStatsDatabase { Slog.d(TAG, "Reading stat file " + f.getBaseFile().getAbsolutePath()); } try { UsageStatsXml.read(f, stats); if (beginTime < stats.endTime) { combiner.combine(stats, false, results); } } return results; } catch (IOException e) { Slog.e(TAG, "Failed to read usage stats file", e); return null; // We continue so that we return results that are not // corrupt. } } return results; } } Loading Loading @@ -450,6 +451,10 @@ class UsageStatsDatabase { mCal.addDays(-7); pruneFilesOlderThan(mIntervalDirs[UsageStatsManager.INTERVAL_DAILY], mCal.getTimeInMillis()); // We must re-index our file list or we will be trying to read // deleted files. indexFilesLocked(); } } Loading