Catch exceptions when reading SyncStatusInfo.
The system server can potentially crash if there is corrupted sync
status info on disk. It's safe to ignore this corrupted data since it's
only informative.
Fixes: 133247002
Test: system builds and boots
Change-Id: Ibaec3a8280e36c14d7e0da4cdd852ec98a2ef733
diff --git a/services/core/java/com/android/server/content/SyncStorageEngine.java b/services/core/java/com/android/server/content/SyncStorageEngine.java
index e09c661..ebaa5a1 100644
--- a/services/core/java/com/android/server/content/SyncStorageEngine.java
+++ b/services/core/java/com/android/server/content/SyncStorageEngine.java
@@ -2032,13 +2032,17 @@
int token;
while ((token=in.readInt()) != STATUS_FILE_END) {
if (token == STATUS_FILE_ITEM) {
- SyncStatusInfo status = new SyncStatusInfo(in);
- if (mAuthorities.indexOfKey(status.authorityId) >= 0) {
- status.pending = false;
- if (Log.isLoggable(TAG_FILE, Log.VERBOSE)) {
- Slog.v(TAG_FILE, "Adding status for id " + status.authorityId);
+ try {
+ SyncStatusInfo status = new SyncStatusInfo(in);
+ if (mAuthorities.indexOfKey(status.authorityId) >= 0) {
+ status.pending = false;
+ if (Log.isLoggable(TAG_FILE, Log.VERBOSE)) {
+ Slog.v(TAG_FILE, "Adding status for id " + status.authorityId);
+ }
+ mSyncStatus.put(status.authorityId, status);
}
- mSyncStatus.put(status.authorityId, status);
+ } catch (Exception e) {
+ Slog.e(TAG, "Unable to parse some sync status.", e);
}
} else {
// Ooops.