diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java index e9ae5f99f..aa4621893 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java @@ -47,11 +47,18 @@ public class Preferences { public static synchronized Preferences getPreferences(Context context, boolean forceNew) { if (sPreferences == null || forceNew) { sPreferences = new Preferences(context); + } else { + // to make it safe for multiple processes, call getSharedPreferences everytime + sPreferences.updateSharedPreferences(context); } return sPreferences; } private Preferences(Context context) { + updateSharedPreferences(context); + } + + public void updateSharedPreferences(Context context) { // multi-process preferences if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mSharedPreferences = context.getSharedPreferences("APG.main", Context.MODE_MULTI_PROCESS);