Replace synchronous calls to shared prefs with async calls.
Also, make a copy of protected data to prevent accidental changes from outside callers. Bug: 130525551 Test: Manual. Change-Id: I7b6efa32bc6db88b79579effaa7ffe1466a80380
This commit is contained in:
@@ -42,12 +42,12 @@ public class PluginPrefs {
|
||||
}
|
||||
|
||||
public Set<String> getPluginList() {
|
||||
return mPluginActions;
|
||||
return new ArraySet<>(mPluginActions);
|
||||
}
|
||||
|
||||
public synchronized void addAction(String action) {
|
||||
if (mPluginActions.add(action)){
|
||||
mSharedPrefs.edit().putStringSet(PLUGIN_ACTIONS, mPluginActions).commit();
|
||||
mSharedPrefs.edit().putStringSet(PLUGIN_ACTIONS, mPluginActions).apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ public class PluginPrefs {
|
||||
}
|
||||
|
||||
public static void setHasPlugins(Context context) {
|
||||
context.getSharedPreferences(PREFS, 0).edit().putBoolean(HAS_PLUGINS, true).commit();
|
||||
context.getSharedPreferences(PREFS, 0).edit().putBoolean(HAS_PLUGINS, true).apply();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user