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-18 16:29:39 +0000
commit1a252db65342689248230b6dac6aa3cb0052d123 (patch)
tree79fabd0ddce1af92c58a395f605298e87ac4d37c
parent88f6ce488201377fff61e0de9f3384614305187f (diff)
downloadims-1a252db65342689248230b6dac6aa3cb0052d123.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 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) {