Log only a summary 'Found stale backup journal' message. am: 4b4e781943
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12240609 Change-Id: I4bc39c3b2d5fb4487811f0d37dff832c286fce0b
This commit is contained in:
@@ -155,6 +155,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -1109,24 +1110,32 @@ public class UserBackupManagerService {
|
||||
|
||||
private void parseLeftoverJournals() {
|
||||
ArrayList<DataChangedJournal> journals = DataChangedJournal.listJournals(mJournalDir);
|
||||
// TODO(b/162022005): Fix DataChangedJournal implementing equals() but not hashCode().
|
||||
journals.removeAll(Collections.singletonList(mJournal));
|
||||
if (!journals.isEmpty()) {
|
||||
Slog.i(TAG, addUserIdToLogMessage(mUserId,
|
||||
"Found " + journals.size() + " stale backup journal(s), scheduling."));
|
||||
}
|
||||
Set<String> packageNames = new LinkedHashSet<>();
|
||||
for (DataChangedJournal journal : journals) {
|
||||
if (!journal.equals(mJournal)) {
|
||||
try {
|
||||
journal.forEach(packageName -> {
|
||||
Slog.i(
|
||||
TAG,
|
||||
addUserIdToLogMessage(
|
||||
mUserId, "Found stale backup journal, scheduling"));
|
||||
if (MORE_DEBUG) {
|
||||
Slog.i(TAG, addUserIdToLogMessage(mUserId, " " + packageName));
|
||||
}
|
||||
try {
|
||||
journal.forEach(packageName -> {
|
||||
if (packageNames.add(packageName)) {
|
||||
dataChangedImpl(packageName);
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, addUserIdToLogMessage(mUserId, "Can't read " + journal), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, addUserIdToLogMessage(mUserId, "Can't read " + journal), e);
|
||||
}
|
||||
}
|
||||
if (!packageNames.isEmpty()) {
|
||||
String msg = "Stale backup journals: Scheduled " + packageNames.size()
|
||||
+ " package(s) total";
|
||||
if (MORE_DEBUG) {
|
||||
msg += ": " + packageNames;
|
||||
}
|
||||
Slog.i(TAG, addUserIdToLogMessage(mUserId, msg));
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getExcludedRestoreKeys(String packageName) {
|
||||
|
||||
Reference in New Issue
Block a user