Change VmProviderSettingsUtil methods to static.
I plan to create a VoicemailProviderListPreference, and move the
initVoicemailProviders code into the preference. In context of this,
the current instance-based implementation of the settings util
seems to be less flexible; a context can simply be passed in to
obtain the SharedPreferences object as necessary.
Bug: 18232725
Change-Id: Ie9a46925a2e5fbb1bf89dcc58ca5bf2e18496513
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 7207fa2..e67071a 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -179,7 +179,6 @@
private Phone mPhone;
private AudioManager mAudioManager;
- private VoicemailProviderSettingsUtil mVmProviderSettingsUtil;
private SubscriptionInfoHelper mSubscriptionInfoHelper;
@@ -403,7 +402,7 @@
updateVMPreferenceWidgets(newProviderKey);
final VoicemailProviderSettings newProviderSettings =
- mVmProviderSettingsUtil.load(newProviderKey);
+ VoicemailProviderSettingsUtil.load(this, newProviderKey);
// If the user switches to a voice mail provider and we have numbers stored for it we
// will automatically change the phone's voice mail and forwarding number to the stored
@@ -503,7 +502,7 @@
if (mVMChangeCompletedSuccessfully || mFwdChangesRequireRollback) {
showDialogIfForeground(VoicemailDialogUtil.VM_REVERTING_DIALOG);
final VoicemailProviderSettings prevSettings =
- mVmProviderSettingsUtil.load(mPreviousVMProviderKey);
+ VoicemailProviderSettingsUtil.load(this, mPreviousVMProviderKey);
if (prevSettings == null) {
Log.e(LOG_TAG, "VoicemailProviderSettings for the key \""
+ mPreviousVMProviderKey + "\" is null but should be loaded.");
@@ -716,7 +715,7 @@
return;
}
- mVmProviderSettingsUtil.save(key, newSettings);
+ VoicemailProviderSettingsUtil.save(this, key, newSettings);
mVMChangeCompletedSuccessfully = false;
mFwdChangesRequireRollback = false;
mVMOrFwdSetError = 0;
@@ -796,7 +795,7 @@
dismissDialogSafely(VoicemailDialogUtil.VM_FWD_READING_DIALOG);
if (mReadingSettingsForDefaultProvider) {
- mVmProviderSettingsUtil.save(DEFAULT_VM_PROVIDER_KEY,
+ VoicemailProviderSettingsUtil.save(this, DEFAULT_VM_PROVIDER_KEY,
new VoicemailProviderSettings(this.mOldVmNumber, mForwardingReadResults));
mReadingSettingsForDefaultProvider = false;
}
@@ -1123,7 +1122,6 @@
}
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- mVmProviderSettingsUtil = new VoicemailProviderSettingsUtil(getApplicationContext());
// Show the voicemail preference in onResume if the calling intent specifies the
// ACTION_ADD_VOICEMAIL action.
@@ -1410,7 +1408,7 @@
// Remove this provider from the list.
if (!TextUtils.isEmpty(providerToIgnore)) {
if (DBG) log("Found ACTION_ADD_VOICEMAIL. providerToIgnore= " + providerToIgnore);
- mVmProviderSettingsUtil.delete(providerToIgnore);
+ VoicemailProviderSettingsUtil.delete(this, providerToIgnore);
}
}