Merge "maybePruneOldTraces: bail if modification times change." am: 9144eaf12f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1712554 Change-Id: I9b2e87531f9167aa7b83fd2b30bc75722dee9257
This commit is contained in:
@@ -4060,6 +4060,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
|
|
||||||
final int max = SystemProperties.getInt("tombstoned.max_anr_count", 64);
|
final int max = SystemProperties.getInt("tombstoned.max_anr_count", 64);
|
||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
|
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
|
||||||
for (int i = 0; i < files.length; ++i) {
|
for (int i = 0; i < files.length; ++i) {
|
||||||
if (i > max || (now - files[i].lastModified()) > DAY_IN_MILLIS) {
|
if (i > max || (now - files[i].lastModified()) > DAY_IN_MILLIS) {
|
||||||
@@ -4068,6 +4069,11 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// The modification times changed while we were sorting. Bail...
|
||||||
|
// https://issuetracker.google.com/169836837
|
||||||
|
Slog.w(TAG, "tombstone modification times changed while sorting; not pruning", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user