Disable up button for Voicemail > Setup.

Check the keys instead of the reference.

This happens because...

1) Closing the ringtone dialog causes the activity's onResume to
trigger.

2) This removes all the preferences, adds call_feature_settings
again and updates all the references in the call settings activity.
We do this to appropriately remove/add preferences, depending on
changes to configuration.

3) But, the OLD voicemail screen preference screen is showing. Any
clicks to it are still handled by the activity, but the reference
to the preferences clicked is no longer the same as the class
variables stored by activity.

4) Thus, comparison for equality is not evaluating to true.

Checking the keys instead ensures that the code to handle the
settings being clicked is executed. Conceptually this is still
correct, just more precise than checking references.  We can
revert back to references once we migrate the voicemail settings
to its own activity.

Bug: 18321866
Bug: 17019623
Change-Id: Ide2cb79ea7e9c5d41937f93eb9d3cd6c0a3ebfed
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index e67071a..f44528d 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -341,10 +341,13 @@
             // Update HAC Value in AudioManager
             mAudioManager.setParameter(HAC_KEY, hac != 0 ? HAC_VAL_ON : HAC_VAL_OFF);
             return true;
-        } else if (preference == mVoicemailSettings) {
+        } else if (preference.getKey().equals(mVoicemailSettings.getKey())) {
+            // Check key instead of comparing reference because closing the voicemail notification
+            // ringtone dialog invokes onResume(), but leaves the old preference screen up,
+            // TODO: Revert to checking reference after migrating voicemail to its own activity.
             if (DBG) log("onPreferenceTreeClick: Voicemail Settings Preference is clicked.");
 
-            final Dialog dialog = mVoicemailSettings.getDialog();
+            final Dialog dialog = ((PreferenceScreen) preference).getDialog();
             if (dialog != null) {
                 dialog.getActionBar().setDisplayHomeAsUpEnabled(false);
             }
@@ -419,6 +422,9 @@
                 saveVoiceMailAndForwardingNumber(newProviderKey, newProviderSettings);
             }
         } else if (preference.getKey().equals(mVoicemailNotificationVibrate.getKey())) {
+            // Check key instead of comparing reference because closing the voicemail notification
+            // ringtone dialog invokes onResume(), but leaves the old preference screen up,
+            // TODO: Revert to checking reference after migrating voicemail to its own activity.
             VoicemailNotificationSettingsUtil.setVibrationEnabled(
                     mPhone.getContext(), Boolean.TRUE.equals(objValue));
         } else if (preference == mEnableVideoCalling) {