CMSettingsProvider: Don't trample default values on migrate.

Since the migration is invoked even on a clean flash, with
  no means of knowing what scenario we're coming from. Assume
  that all null values are to be dropped and default values are
  to be given precedence.

Change-Id: I10eb2f4650c379422268423dbc011b49f77ed910
TICKET: CYNGNOS-1721
This commit is contained in:
Adnan Begovic 2016-01-26 11:08:31 -08:00 committed by Gerrit Code Review
parent 3629a574b2
commit ad6f85c69e

View File

@ -213,6 +213,14 @@ public class CMSettingsProvider extends ContentProvider {
if (LOCAL_LOGV) Log.d(TAG, "Table: " + tableName + ", Key: " + settingsKey + ", Value: "
+ settingsValue);
// Don't trample defaults with null values. This is the only scenario where defaults
// take precedence over migration values.
if (settingsValue == null) {
if (LOCAL_LOGV) Log.d(TAG, "Skipping migrating " + settingsKey
+ " because of null value");
continue;
}
ContentValues contentValue = new ContentValues();
contentValue.put(Settings.NameValueTable.NAME, settingsKey);
contentValue.put(Settings.NameValueTable.VALUE, settingsValue);