diff options
author | Hall Liu <hallliu@google.com> | 2017-08-22 21:02:46 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-08-22 21:02:46 +0000 |
commit | b3d249ba992bfc9a7bdca7a3fa91f006c7ed3439 (patch) | |
tree | 11c2c529ca7f637e23e4630576d93035e560f6c6 | |
parent | fb38165516ccfe1f7b43ee5f947ef8564310d9d8 (diff) | |
parent | 4801a7a0a90988a187d627bb42532c1e2c600f20 (diff) | |
download | ims-b3d249ba992bfc9a7bdca7a3fa91f006c7ed3439.tar.gz |
Pin IMS on/off to actual TTY mode am: e511a2031e
am: 4801a7a0a9
Change-Id: Id290b10c204301bd0eeabda53759f8148e144db0
-rw-r--r-- | src/java/com/android/ims/ImsManager.java | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java index 82f2c68f..0442f39b 100644 --- a/src/java/com/android/ims/ImsManager.java +++ b/src/java/com/android/ims/ImsManager.java @@ -38,6 +38,7 @@ import android.telephony.TelephonyManager; import android.telephony.ims.ImsServiceProxy; import android.telephony.ims.ImsServiceProxyCompat; import android.telephony.ims.feature.ImsFeature; +import android.util.Log; import com.android.ims.internal.IImsCallSession; import com.android.ims.internal.IImsConfig; @@ -350,9 +351,12 @@ public class ImsManager { return true; } - return Settings.Secure.getInt(context.getContentResolver(), - Settings.Secure.PREFERRED_TTY_MODE, TelecomManager.TTY_MODE_OFF) - == TelecomManager.TTY_MODE_OFF; + TelecomManager tm = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); + if (tm == null) { + Log.w(TAG, "isNonTtyOrTtyOnVolteEnabled: telecom not available"); + return true; + } + return tm.getCurrentTtyMode() == TelecomManager.TTY_MODE_OFF; } /** @@ -365,9 +369,12 @@ public class ImsManager { return true; } - return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.PREFERRED_TTY_MODE, TelecomManager.TTY_MODE_OFF) - == TelecomManager.TTY_MODE_OFF; + TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE); + if (tm == null) { + Log.w(TAG, "isNonTtyOrTtyOnVolteEnabledForSlot: telecom not available"); + return true; + } + return tm.getCurrentTtyMode() == TelecomManager.TTY_MODE_OFF; } /** @@ -1830,6 +1837,21 @@ public class ImsManager { return mConfig; } + /** + * Set the TTY mode. This is the actual tty mode (varies depending on peripheral status) + */ + public void setTtyMode(int ttyMode) throws ImsException { + if (!getBooleanCarrierConfigForSlot( + CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL)) { + setAdvanced4GMode((ttyMode == TelecomManager.TTY_MODE_OFF) && + isEnhanced4gLteModeSettingEnabledByUserForSlot()); + } + } + + /** + * Sets the UI TTY mode. This is the preferred TTY mode that the user sets in the call + * settings screen. + */ public void setUiTTYMode(Context context, int uiTtyMode, Message onComplete) throws ImsException { @@ -1841,12 +1863,6 @@ public class ImsManager { throw new ImsException("setTTYMode()", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); } - - if (!getBooleanCarrierConfigForSlot( - CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL)) { - setAdvanced4GMode((uiTtyMode == TelecomManager.TTY_MODE_OFF) && - isEnhanced4gLteModeSettingEnabledByUserForSlot()); - } } private ImsReasonInfo makeACopy(ImsReasonInfo imsReasonInfo) { |