Change SharedPreferences.Editor.commit() to apply()
Calling SharedPreferences.Editor.commit() from
the main thread results in a synchronous write
to the file system, giving a risk for ANR.
Replace it with asyncronous apply(), which is
safe since the result of commit() was never checked
in the first place.
Bug: 28689077
Test: run with StrictMode on
Change-Id: I63342775f78ba552db8a6a03d8172b43f82be2a9
diff --git a/src/com/android/phone/settings/VoicemailProviderSettingsUtil.java b/src/com/android/phone/settings/VoicemailProviderSettingsUtil.java
index 8187664..3ccd4a3 100644
--- a/src/com/android/phone/settings/VoicemailProviderSettingsUtil.java
+++ b/src/com/android/phone/settings/VoicemailProviderSettingsUtil.java
@@ -137,7 +137,7 @@
prefs.edit()
.putString(key + VM_NUMBER_TAG, null)
.putInt(key + FWD_SETTINGS_TAG + FWD_SETTINGS_LENGTH_TAG, 0)
- .commit();
+ .apply();
}
private static SharedPreferences getPrefs(Context context) {