diff options
author | Roman Birg <roman@cyngn.com> | 2016-05-06 09:21:00 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-05-11 14:45:14 -0700 |
commit | 256a7350cef055c58a95c902abdb25c2557097c9 (patch) | |
tree | b4050e8ba14641b1a8699fc88152245b7b1f2248 | |
parent | 8c8601b9f3993481d2197bd55ab482cb0dabca6a (diff) | |
download | vendor_cmsdk-256a7350cef055c58a95c902abdb25c2557097c9.zip vendor_cmsdk-256a7350cef055c58a95c902abdb25c2557097c9.tar.gz vendor_cmsdk-256a7350cef055c58a95c902abdb25c2557097c9.tar.bz2 |
CMSettings: don't trample user metrics setting on upgrade
During an upgrade, we try to migrate values which are
considered to be LEGACY settings to the new provider, however
because of a bad upgrade path, we need to check if the key exists in the
new database AND the old database, and then we can skip it in that case.
Ticket: CYNGNOS-2740
Change-Id: I5d6bc8399ccc328f4190ed7508c27bd9d5de1b9d
Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r-- | packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java index bd011b7..d730584 100644 --- a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java +++ b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java @@ -208,6 +208,14 @@ public class CMSettingsProvider extends ContentProvider { else if (tableName.equals(CMDatabaseHelper.CMTableNames.TABLE_SECURE)) { settingsValue = Settings.Secure.getStringForUser(contentResolver, settingsKey, userId); + if (settingsValue != null && settingsKey.equals(CMSettings.Secure.STATS_COLLECTION) + && CMSettings.Secure.getStringForUser(contentResolver, settingsKey, userId) + != null) { + // incorrect migration from YOG4P -> YOG7D failed to remove + // Settings.Secure.STATS_COLLECTION after migration; so it may exist in both + // providers; so if it exists in the new database, prefer it. + continue; + } // insert dnd, edit tiles for upgrade from 12.1 -> 13.0 if (CMSettings.Secure.QS_TILES.equals(settingsKey) && (settingsValue != null |