aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHall Liu <hallliu@google.com>2017-08-17 15:49:58 -0700
committerHall Liu <hallliu@google.com>2017-08-22 11:49:16 -0700
commite511a2031ecb8b5986b7db5548b58d0648b59209 (patch)
tree11c2c529ca7f637e23e4630576d93035e560f6c6
parentc3d1880ed7694c58693d89f5a52bf19281f02dcc (diff)
downloadims-e511a2031ecb8b5986b7db5548b58d0648b59209.tar.gz
Pin IMS on/off to actual TTY mode
Make changes to only toggle IMS on/off if the actual TTY option is on (i.e. UI preference is enabled and TTY accessory is plugged in) Test: manual Change-Id: Ieac0ca041a0bd026e8b2f07ebcadc9a6a1db75b9 Fixes: 63968802
-rw-r--r--src/java/com/android/ims/ImsManager.java40
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) {