Merge " [DS] TTY should be enabled." into lmp-mr1-dev
diff --git a/src/com/android/services/telephony/TelephonyGlobals.java b/src/com/android/services/telephony/TelephonyGlobals.java
index 11c3c64..02ef639 100644
--- a/src/com/android/services/telephony/TelephonyGlobals.java
+++ b/src/com/android/services/telephony/TelephonyGlobals.java
@@ -21,6 +21,9 @@
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Singleton entry point for the telephony-services app. Initializes ongoing systems relating to
* PSTN calls. This is started when the device starts and will be restarted automatically
@@ -36,7 +39,8 @@
/** The application context. */
private final Context mContext;
- private TtyManager mTtyManager;
+ // For supporting MSIM phone, change Phone and TtyManager as 1 to 1
+ private List<TtyManager> mTtyManagers = new ArrayList<>();
/**
* Persists the specified parameters.
@@ -55,10 +59,10 @@
}
public void onCreate() {
- // TODO: Make this work with Multi-SIM devices
- Phone phone = PhoneFactory.getDefaultPhone();
- if (phone != null) {
- mTtyManager = new TtyManager(mContext, phone);
+ // Make this work with Multi-SIM devices
+ Phone[] phones = PhoneFactory.getPhones();
+ for (Phone phone : phones) {
+ mTtyManagers.add(new TtyManager(mContext, phone));
}
TelecomAccountRegistry.getInstance(mContext).setupOnBoot();
diff --git a/src/com/android/services/telephony/TtyManager.java b/src/com/android/services/telephony/TtyManager.java
index 6c8a495..a3aeeb2 100644
--- a/src/com/android/services/telephony/TtyManager.java
+++ b/src/com/android/services/telephony/TtyManager.java
@@ -122,13 +122,12 @@
private static int telecomModeToPhoneMode(int telecomMode) {
switch (telecomMode) {
+ // AT command only has 0 and 1, so mapping VCO
+ // and HCO to FULL
case TelecomManager.TTY_MODE_FULL:
- return Phone.TTY_MODE_FULL;
case TelecomManager.TTY_MODE_VCO:
- return Phone.TTY_MODE_VCO;
case TelecomManager.TTY_MODE_HCO:
- return Phone.TTY_MODE_HCO;
- case TelecomManager.TTY_MODE_OFF:
+ return Phone.TTY_MODE_FULL;
default:
return Phone.TTY_MODE_OFF;
}