diff options
author | Hall Liu <hallliu@google.com> | 2017-08-18 20:00:09 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-08-18 20:00:09 +0000 |
commit | 3d1570adda41b26fdb28ddd58edf0e6cca8e7913 (patch) | |
tree | 79fabd0ddce1af92c58a395f605298e87ac4d37c | |
parent | 6a2b5df728b3ba18d5abacb1fcc76cdf4d8660e1 (diff) | |
parent | b7fa40ccdea1f748ec25f41a9f8bc51d90608767 (diff) | |
download | ims-3d1570adda41b26fdb28ddd58edf0e6cca8e7913.tar.gz |
Pin IMS on/off to actual TTY mode am: 1a252db653
am: b7fa40ccde
Change-Id: Id78bbde4158902d7ec95b638c872a355cf3ef992
-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 97aa61c5..ccb602bb 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; @@ -358,9 +359,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; } /** @@ -373,9 +377,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; } /** @@ -1856,6 +1863,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 { @@ -1867,12 +1889,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) { |