From 36ad639457b5ebef67d8a35bd4047723c112e906 Mon Sep 17 00:00:00 2001 From: Varun Shah Date: Fri, 20 Dec 2019 11:49:49 -0800 Subject: [PATCH] Update SyncStorageEngine#DELETE_LEGACY_PARCEL_FILES. Delete the parcel files on a successful upgrade to proto. This was kept as true such that a revert to the parcel files would be possible if needed. Bug: 143656271 Test: manual: files are deleted on upgrade. Change-Id: I98019e2aef3e4413a67c714691ebdc0973a8a665 --- .../java/com/android/server/content/SyncStorageEngine.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/content/SyncStorageEngine.java b/services/core/java/com/android/server/content/SyncStorageEngine.java index 8c510b735ccd0..e9c4b510039d1 100644 --- a/services/core/java/com/android/server/content/SyncStorageEngine.java +++ b/services/core/java/com/android/server/content/SyncStorageEngine.java @@ -472,8 +472,7 @@ public class SyncStorageEngine { private int mSyncRandomOffset; - // STOPSHIP: b/143656271 this should be true on launch - private static final boolean DELETE_LEGACY_PARCEL_FILES = false; + private static final boolean DELETE_LEGACY_PARCEL_FILES = true; private static final String LEGACY_STATUS_FILE_NAME = "status.bin"; private static final String LEGACY_STATISTICS_FILE_NAME = "stats.bin"; @@ -2076,7 +2075,7 @@ public class SyncStorageEngine { } // if upgrade to proto was successful, delete parcel file - if (DELETE_LEGACY_PARCEL_FILES && mStatusFile.exists()) { + if (DELETE_LEGACY_PARCEL_FILES && parcelStatus.exists() && mStatusFile.exists()) { parcelStatus.delete(); } } @@ -2475,7 +2474,7 @@ public class SyncStorageEngine { } // if upgrade to proto was successful, delete parcel file - if (DELETE_LEGACY_PARCEL_FILES && mStatisticsFile.exists()) { + if (DELETE_LEGACY_PARCEL_FILES && parcelStats.exists() && mStatisticsFile.exists()) { parcelStats.delete(); } }