Merge "Modifies IMS capability APIs to better support MSIM"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0bf0ef2..3665284 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -79,10 +79,10 @@
<protected-broadcast android:name= "com.android.phone.vvm.ACTION_VISUAL_VOICEMAIL_SERVICE_EVENT" />
<protected-broadcast android:name= "com.android.internal.telephony.CARRIER_VVM_PACKAGE_INSTALLED" />
<protected-broadcast android:name= "com.android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO" />
- <protected-broadcast android:name= "android.intent.action.CURRENT_CARRIER_IDENTITY_CHANGED" />
<protected-broadcast android:name= "android.telephony.action.SIM_CARD_STATE_CHANGED" />
<protected-broadcast android:name= "android.telephony.action.SIM_APPLICATION_STATE_CHANGED" />
<protected-broadcast android:name= "android.telephony.action.SIM_SLOT_STATUS_CHANGED" />
+ <protected-broadcast android:name= "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.CALL_PHONE" />
@@ -153,9 +153,9 @@
<uses-permission android:name="android.permission.BIND_CARRIER_SERVICES" />
<!-- BIND_CARRIER_MESSAGING_SERVICE has been deprecated in favor of BIND_CARRIER_SERVICES. -->
<uses-permission android:name="android.permission.BIND_CARRIER_MESSAGING_SERVICE" />
- <uses-permission android:name="com.android.permission.BIND_EUICC_SERVICE" />
+ <uses-permission android:name="android.permission.BIND_EUICC_SERVICE" />
<uses-permission android:name="com.android.permission.BIND_TELEPHONY_NETWORK_SERVICE" />
- <uses-permission android:name="com.android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" />
+ <uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8c450a0..72be3b2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1165,6 +1165,11 @@
<string name="hac_mode_title">Hearing aids</string>
<string name="hac_mode_summary">Turn on hearing aid compatibility</string>
+ <!-- RTT settings: used to turn on/off Real-Time Text, an accessibility feature similar to
+ TTY that allows users to send text over a phone call. -->
+ <string name="rtt_mode_title">RTT</string>
+ <string name="rtt_mode_summary">Turn RTT on or off</string>
+
<!-- Service option entries. -->
<string-array name="tty_mode_entries">
<item>TTY Off</item>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 2c007f6..e674e74 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -32,4 +32,10 @@
android:persistent="true"
android:summary="@string/hac_mode_summary"/>
+ <SwitchPreference
+ android:key="button_rtt_key"
+ android:title="@string/rtt_mode_title"
+ android:persistent="true"
+ android:summary="@string/rtt_mode_summary"/>
+
</PreferenceScreen>
diff --git a/sip/src/com/android/services/telephony/sip/SipConnectionService.java b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
index a5f48d3..27be9b4 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnectionService.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
@@ -37,6 +37,7 @@
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.PhoneInternalInterface;
import com.android.internal.telephony.sip.SipPhone;
import com.android.services.telephony.DisconnectCauseUtil;
@@ -258,7 +259,9 @@
try {
com.android.internal.telephony.Connection originalConnection =
- phone.dial(number, request.getVideoState());
+ phone.dial(number, new PhoneInternalInterface.DialArgs.Builder<>()
+ .setVideoState(request.getVideoState())
+ .build());
return originalConnection;
} catch (CallStateException e) {
log("startCallWithPhone, exception: " + e);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 58e2ad6..8ed8a7c 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -3266,6 +3266,14 @@
return mPhone.getContext().getResources().getBoolean(R.bool.hac_enabled);
}
+ public boolean isRttSupported() {
+ boolean isCarrierSupported =
+ mApp.getCarrierConfig().getBoolean(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
+ boolean isDeviceSupported =
+ mPhone.getContext().getResources().getBoolean(R.bool.config_support_rtt);
+ return isCarrierSupported && isDeviceSupported;
+ }
+
/**
* Returns the unique device ID of phone, for example, the IMEI for
* GSM and the MEID for CDMA phones. Return null if device ID is not available.
@@ -4053,7 +4061,8 @@
}
- infos[i] = new UiccSlotInfo(slot.isActive(), slot.isEuicc(), cardId, cardState);
+ infos[i] = new UiccSlotInfo(
+ slot.isActive(), slot.isEuicc(), cardId, cardState, slot.getPhoneId());
}
return infos;
}
diff --git a/src/com/android/phone/settings/AccessibilitySettingsFragment.java b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
index af7d4bf..7ede23a 100644
--- a/src/com/android/phone/settings/AccessibilitySettingsFragment.java
+++ b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
@@ -24,8 +24,10 @@
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -41,6 +43,7 @@
private static final String BUTTON_TTY_KEY = "button_tty_mode_key";
private static final String BUTTON_HAC_KEY = "button_hac_key";
+ private static final String BUTTON_RTT_KEY = "button_rtt_key";
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
/**
@@ -67,6 +70,7 @@
private TtyModeListPreference mButtonTty;
private SwitchPreference mButtonHac;
+ private SwitchPreference mButtonRtt;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -80,6 +84,7 @@
mButtonTty = (TtyModeListPreference) findPreference(
getResources().getString(R.string.tty_mode_key));
mButtonHac = (SwitchPreference) findPreference(BUTTON_HAC_KEY);
+ mButtonRtt = (SwitchPreference) findPreference(BUTTON_RTT_KEY);
if (PhoneGlobals.getInstance().phoneMgr.isTtyModeSupported()) {
mButtonTty.init();
@@ -96,6 +101,19 @@
getPreferenceScreen().removePreference(mButtonHac);
mButtonHac = null;
}
+
+ if (PhoneGlobals.getInstance().phoneMgr.isRttSupported()) {
+ // TODO: this is going to be a on/off switch for now. Ask UX about how to integrate
+ // this settings with TTY
+ boolean rttOn = Settings.System.getInt(
+ mContext.getContentResolver(), Settings.System.RTT_CALLING_MODE,
+ TelecomManager.TTY_MODE_OFF)
+ != TelecomManager.TTY_MODE_OFF;
+ mButtonRtt.setChecked(rttOn);
+ } else {
+ getPreferenceScreen().removePreference(mButtonRtt);
+ mButtonRtt = null;
+ }
}
@Override
@@ -129,7 +147,19 @@
hac == SettingsConstants.HAC_ENABLED
? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF);
return true;
+ } else if (preference == mButtonRtt) {
+ Log.i(LOG_TAG, "RTT setting changed -- now " + mButtonRtt.isChecked());
+ int rttMode = mButtonRtt.isChecked()
+ ? TelecomManager.TTY_MODE_FULL : TelecomManager.TTY_MODE_OFF;
+ Settings.System.putInt(mContext.getContentResolver(), Settings.System.RTT_CALLING_MODE,
+ rttMode);
+ // Update RTT config with IMS Manager
+ ImsManager imsManager = ImsManager.getInstance(getContext(),
+ SubscriptionManager.getDefaultVoicePhoneId());
+ imsManager.setRttEnabled(mButtonRtt.isChecked());
+ return true;
}
+
return false;
}
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 8f0c44a..3cf420a 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -271,10 +271,10 @@
long connectTime = conferenceHost.getOriginalConnection().getConnectTime();
long connectElapsedTime = conferenceHost.getOriginalConnection().getConnectTimeReal();
setConnectionTime(connectTime);
- setConnectionElapsedTime(connectElapsedTime);
+ setConnectionStartElapsedRealTime(connectElapsedTime);
// Set the connectTime in the connection as well.
conferenceHost.setConnectTimeMillis(connectTime);
- conferenceHost.setConnectElapsedTimeMillis(connectElapsedTime);
+ conferenceHost.setConnectionStartElapsedRealTime(connectElapsedTime);
mTelephonyConnectionService = telephonyConnectionService;
setConferenceHost(conferenceHost);
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 17c6049..3fb8d32 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -234,9 +234,7 @@
extras.putBoolean(PhoneAccount.EXTRA_PLAY_CALL_RECORDING_TONE, true);
}
- boolean isDeviceRttSupported = mContext.getResources().getBoolean(
- R.bool.config_support_rtt);
- if (isDeviceRttSupported && isCarrierRttSupported()) {
+ if (PhoneGlobals.getInstance().phoneMgr.isRttSupported()) {
capabilities |= PhoneAccount.CAPABILITY_RTT;
}
@@ -405,12 +403,6 @@
b.getBoolean(CarrierConfigManager.KEY_SUPPORT_VIDEO_CONFERENCE_CALL_BOOL);
}
- private boolean isCarrierRttSupported() {
- PersistableBundle b =
- PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
- return b != null && b.getBoolean(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
- }
-
/**
* Determines from carrier config whether merging of wifi calls is allowed when VoWIFI is
* turned off.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 67e9739..b27baed 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -559,6 +559,16 @@
DisconnectCause.toString(cause));
mHandler.obtainMessage(MSG_DISCONNECT).sendToTarget();
}
+
+ @Override
+ public void onRttInitiated() {
+ sendRttInitiationSuccess();
+ }
+
+ @Override
+ public void onRttTerminated() {
+ sendRttSessionRemotelyTerminated();
+ }
};
protected com.android.internal.telephony.Connection mOriginalConnection;
@@ -567,6 +577,7 @@
private boolean mIsStateOverridden = false;
private Call.State mOriginalConnectionState = Call.State.IDLE;
private Call.State mConnectionOverriddenState = Call.State.IDLE;
+ private RttTextStream mRttTextStream = null;
private boolean mWasImsConnection;
@@ -992,6 +1003,8 @@
mIsCdmaVoicePrivacyEnabled);
newProperties = changeBitmask(newProperties, PROPERTY_ASSISTED_DIALING_USED,
mIsUsingAssistedDialing);
+ newProperties = changeBitmask(newProperties, PROPERTY_IS_RTT,
+ (getConnectionProperties() & PROPERTY_IS_RTT) != 0);
if (getConnectionProperties() != newProperties) {
setConnectionProperties(newProperties);
@@ -1811,6 +1824,14 @@
return false;
}
+ public void setRttTextStream(RttTextStream s) {
+ mRttTextStream = s;
+ }
+
+ public RttTextStream getRttTextStream() {
+ return mRttTextStream;
+ }
+
/**
* For video calls, sets whether this connection supports pausing the outgoing video for the
* call using the {@link android.telecom.VideoProfile#STATE_PAUSED} VideoState.
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 8584d42..2022733 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -650,6 +650,7 @@
connection.setAddress(handle, PhoneConstants.PRESENTATION_ALLOWED);
connection.setInitializing();
connection.setVideoState(request.getVideoState());
+ connection.setRttTextStream(request.getRttTextStream());
return connection;
}
@@ -988,7 +989,11 @@
com.android.internal.telephony.Connection originalConnection = null;
try {
if (phone != null) {
- originalConnection = phone.dial(number, null, videoState, extras);
+ originalConnection = phone.dial(number, new ImsPhone.ImsDialArgs.Builder()
+ .setVideoState(videoState)
+ .setIntentExtras(extras)
+ .setRttTextStream(connection.getRttTextStream())
+ .build());
}
} catch (CallStateException e) {
Log.e(this, e, "placeOutgoingConnection, phone.dial exception: " + e);
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index b4c93ee..3bd2716 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -539,7 +539,7 @@
// was redialed on the same slot
assertEquals(0, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot0Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot0Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -571,7 +571,7 @@
// was never redialed
assertEquals(0, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot0Phone, never()).dial(anyString(), any(), anyInt(), any());
+ verify(slot0Phone, never()).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -611,7 +611,7 @@
// redialed on another slot
assertEquals(1, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot1Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -649,7 +649,7 @@
// redialed on another slot
assertEquals(1, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot1Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -700,8 +700,8 @@
// redialed on another slot
assertEquals(2, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot0Phone).dial(anyString(), any(), anyInt(), any());
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
+ verify(slot0Phone).dial(anyString(), any());
+ verify(slot1Phone).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -750,8 +750,8 @@
// redialed on another slot
assertEquals(1, c.getNotifyPhoneAccountChangedCount());
try {
- verify(slot1Phone).dial(anyString(), any(), anyInt(), any());
- verify(slot0Phone, never()).dial(anyString(), any(), anyInt(), any());
+ verify(slot1Phone).dial(anyString(), any());
+ verify(slot0Phone, never()).dial(anyString(), any());
} catch (CallStateException e) {
// This shouldn't happen
fail();
@@ -850,7 +850,7 @@
private void setPhonesDialConnection(Phone phone, Connection c) {
try {
- when(phone.dial(anyString(), anyInt())).thenReturn(c);
+ when(phone.dial(anyString(), any())).thenReturn(c);
} catch (CallStateException e) {
// this shouldn't happen
fail();