diff --git a/src/com/fsck/k9/preferences/StorageExporter.java b/src/com/fsck/k9/preferences/StorageExporter.java index cda3c5f42..5f5c490e9 100644 --- a/src/com/fsck/k9/preferences/StorageExporter.java +++ b/src/com/fsck/k9/preferences/StorageExporter.java @@ -63,6 +63,23 @@ public class StorageExporter { public static final String EMAIL_ELEMENT = "email"; public static final String DESCRIPTION_ELEMENT = "description"; + /** + * List of keys of global settings that don't need to or shouldn't be exported. + */ + private static final Set SKIP_GLOBAL_SETTINGS; + + static { + Set skip = new HashSet(); + + // No need to export the "accountUuids" field. It will be (re)created by the import code. + skip.add("accountUuids"); + + // "defaultAccountUuid" is also handled by the import code. + skip.add("defaultAccountUuid"); + + SKIP_GLOBAL_SETTINGS = skip; + } + public static String exportToFile(Context context, boolean includeGlobals, Set accountUuids, String encryptionKey) @@ -175,8 +192,8 @@ public class StorageExporter { for (Map.Entry entry : prefs.entrySet()) { String key = entry.getKey(); String value = entry.getValue().toString(); - if (key.indexOf('.') != -1) { - // Skip account entries + if (key.indexOf('.') != -1 || SKIP_GLOBAL_SETTINGS.contains(key)) { + // Skip account entries and keys we don't want/need to export continue; } writeKeyValue(serializer, key, value);