diff options
author | Etan Cohen <etancohen@google.com> | 2014-11-13 17:14:33 -0800 |
---|---|---|
committer | Etan Cohen <etancohen@google.com> | 2014-11-14 09:14:19 -0800 |
commit | 24c7ea60ce73408f7e491be9c78950fe7db8f960 (patch) | |
tree | 6f0a3b151af98cc82d94f5ea645fe825cde86a53 /src | |
parent | e3c2f8ff055bda4932d10b96c82a494ae67e6424 (diff) | |
download | android_packages_services_Telephony-24c7ea60ce73408f7e491be9c78950fe7db8f960.tar.gz android_packages_services_Telephony-24c7ea60ce73408f7e491be9c78950fe7db8f960.tar.bz2 android_packages_services_Telephony-24c7ea60ce73408f7e491be9c78950fe7db8f960.zip |
Disable 'Enhanced 4G LTE Mode' setting entry when in a call.
Bug: 17408247
Change-Id: I31eca14df7f431c7946b592a8b65e00eda602db3
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/phone/MobileNetworkSettings.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java index ee3808039..5a6452800 100644 --- a/src/com/android/phone/MobileNetworkSettings.java +++ b/src/com/android/phone/MobileNetworkSettings.java @@ -48,6 +48,7 @@ import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.preference.SwitchPreference; +import android.telephony.PhoneStateListener; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; @@ -129,6 +130,22 @@ public class MobileNetworkSettings extends PreferenceActivity private boolean mIsGlobalCdma; private boolean mUnavailable; + private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() { + /* + * Enable/disable the 'Enhanced 4G LTE Mode' when in/out of a call. + * @see android.telephony.PhoneStateListener#onCallStateChanged(int, + * java.lang.String) + */ + @Override + public void onCallStateChanged(int state, String incomingNumber) { + if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state); + Preference pref = getPreferenceScreen().findPreference(BUTTON_4G_LTE_KEY); + if (pref != null) { + pref.setEnabled(state == TelephonyManager.CALL_STATE_IDLE); + } + } + }; + //This is a method implemented for DialogInterface.OnClickListener. // Used to dismiss the dialogs when they come up. public void onClick(DialogInterface dialog, int which) { @@ -353,6 +370,11 @@ public class MobileNetworkSettings extends PreferenceActivity mPhone.getPreferredNetworkType(mHandler.obtainMessage( MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE)); } + + if (ImsManager.isVolteEnabledByPlatform(this)) { + TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); + } } private void updateBody() { @@ -495,6 +517,11 @@ public class MobileNetworkSettings extends PreferenceActivity @Override protected void onPause() { super.onPause(); + + if (ImsManager.isVolteEnabledByPlatform(this)) { + TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); + } } /** |