Merge "Use new SipDelegateConfiguration in telephony" am: 1d2bffe008 am: d3415cdb42 am: 500834da6f
Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/1682948
Change-Id: I0c686b832e8b2277f621af88e8606681f2bc691f
diff --git a/src/com/android/services/telephony/rcs/DelegateBinderStateManager.java b/src/com/android/services/telephony/rcs/DelegateBinderStateManager.java
index 9d2c5d6..1a016ee 100644
--- a/src/com/android/services/telephony/rcs/DelegateBinderStateManager.java
+++ b/src/com/android/services/telephony/rcs/DelegateBinderStateManager.java
@@ -19,6 +19,7 @@
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.DelegateRequest;
import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateConnection;
import android.telephony.ims.SipDelegateImsConfiguration;
import android.telephony.ims.SipDelegateManager;
@@ -52,6 +53,11 @@
* The SipDelegate has notified telephony that the IMS configuration has changed.
*/
void onImsConfigurationChanged(SipDelegateImsConfiguration config);
+
+ /**
+ * The SipDelegate has notified telephony that the IMS configuration has changed.
+ */
+ void onConfigurationChanged(SipDelegateConfiguration config);
}
/** Allow for mocks to be created for testing. */
diff --git a/src/com/android/services/telephony/rcs/DelegateStateTracker.java b/src/com/android/services/telephony/rcs/DelegateStateTracker.java
index 18ad98e..321c7ba 100644
--- a/src/com/android/services/telephony/rcs/DelegateStateTracker.java
+++ b/src/com/android/services/telephony/rcs/DelegateStateTracker.java
@@ -19,6 +19,7 @@
import android.os.RemoteException;
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateImsConfiguration;
import android.telephony.ims.aidl.ISipDelegate;
import android.telephony.ims.aidl.ISipDelegateConnectionStateCallback;
@@ -159,6 +160,20 @@
}
}
+ /**
+ * THe underlying SipDelegate has reported that the IMS configuration has changed.
+ * @param config The config to be sent to the IMS application.
+ */
+ @Override
+ public void onConfigurationChanged(SipDelegateConfiguration config) {
+ logi("onImsConfigurationChanged: Sending new IMS configuration.");
+ try {
+ mAppStateCallback.onConfigurationChanged(config);
+ } catch (RemoteException e) {
+ logw("onImsConfigurationChanged: IMS application is dead: " + e);
+ }
+ }
+
/** Write state about this tracker into the PrintWriter to be included in the dumpsys */
public void dump(PrintWriter printWriter) {
printWriter.println("Last reg state: " + mLastRegState);
diff --git a/src/com/android/services/telephony/rcs/MessageTransportStateTracker.java b/src/com/android/services/telephony/rcs/MessageTransportStateTracker.java
index daafeb2..b2dcfe8 100644
--- a/src/com/android/services/telephony/rcs/MessageTransportStateTracker.java
+++ b/src/com/android/services/telephony/rcs/MessageTransportStateTracker.java
@@ -21,6 +21,7 @@
import android.telephony.ims.DelegateMessageCallback;
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateImsConfiguration;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.SipMessage;
@@ -328,6 +329,11 @@
// Not needed for this Tracker
}
+ @Override
+ public void onConfigurationChanged(SipDelegateConfiguration config) {
+ // Not needed for this Tracker
+ }
+
/**
* Open the transport and allow SIP messages to be sent/received on the delegate specified.
* @param delegate The delegate connection to send SIP messages to on the ImsService.
diff --git a/src/com/android/services/telephony/rcs/SipDelegateBinderConnection.java b/src/com/android/services/telephony/rcs/SipDelegateBinderConnection.java
index 3f6f269..5eb0558 100644
--- a/src/com/android/services/telephony/rcs/SipDelegateBinderConnection.java
+++ b/src/com/android/services/telephony/rcs/SipDelegateBinderConnection.java
@@ -22,6 +22,7 @@
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.DelegateRequest;
import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateImsConfiguration;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.aidl.IImsRegistration;
@@ -108,6 +109,22 @@
}
@Override
+ public void onConfigurationChanged(
+ SipDelegateConfiguration registeredSipConfig) {
+ long token = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> {
+ logi("onConfigurationChanged");
+ for (StateCallback c : mStateCallbacks) {
+ c.onConfigurationChanged(registeredSipConfig);
+ }
+ });
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public void onDestroyed(int reason) {
long token = Binder.clearCallingIdentity();
try {
diff --git a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/DelegateActivity.java b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/DelegateActivity.java
index 7f751d6..1407671 100644
--- a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/DelegateActivity.java
+++ b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/DelegateActivity.java
@@ -26,8 +26,8 @@
import android.telephony.ims.FeatureTagState;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsManager;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateConnection;
-import android.telephony.ims.SipDelegateImsConfiguration;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.SipMessage;
import android.telephony.ims.stub.DelegateConnectionMessageCallback;
@@ -125,15 +125,16 @@
}
@Override
- public void onImsConfigurationChanged(
- SipDelegateImsConfiguration registeredSipConfig) {
- mCallbackResultStr += "onImsConfigurationChanged SipDelegateImsConfiguration:"
- + registeredSipConfig + "\r\n\r\n";
- Log.i(TAG, mCallbackResultStr);
+ public void onConfigurationChanged(
+ SipDelegateConfiguration registeredSipConfig) {
+ mCallbackResultStr += "onConfigurationChanged SipDelegateConfiguration:"
+ + "\r\n\r\n";
+ Log.i(TAG, "onConfigurationChanged: " + registeredSipConfig);
mHandler.sendMessage(mHandler.obtainMessage(MSG_RESULT));
dumpConfig(registeredSipConfig);
}
+
@Override
public void onFeatureTagStatusChanged(
@NonNull DelegateRegistrationState registrationState,
@@ -326,81 +327,33 @@
}
- private void dumpConfig(SipDelegateImsConfiguration config) {
- Log.i(TAG, "KEY_SIP_CONFIG_TRANSPORT_TYPE_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_TRANSPORT_TYPE_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_USER_ID_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_USER_ID_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PRIVATE_USER_ID_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PRIVATE_USER_ID_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_HOME_DOMAIN_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_HOME_DOMAIN_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_IMEI_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_IPTYPE_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IPTYPE_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_DEFAULT_IPADDRESS_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_DEFAULT_IPADDRESS_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_DEFAULT_IPADDRESS_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_DEFAULT_IPADDRESS_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_IPADDRESS_WITH_NAT_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_IPADDRESS_WITH_NAT_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_AUTHENTICATION_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_AUTHENTICATION_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_AUTHENTICATION_NONCE_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_AUTHENTICATION_NONCE_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVICE_ROUTE_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVICE_ROUTE_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_SECURITY_VERIFY_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SECURITY_VERIFY_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_PATH_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_PATH_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_URI_USER_PART_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_URI_USER_PART_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_P_ACCESS_NETWORK_INFO_HEADER_STRING:"
- + config.getString(SipDelegateImsConfiguration
- .KEY_SIP_CONFIG_P_ACCESS_NETWORK_INFO_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_P_LAST_ACCESS_NETWORK_INFO_HEADER_STRING:"
- + config.getString(SipDelegateImsConfiguration
- .KEY_SIP_CONFIG_P_LAST_ACCESS_NETWORK_INFO_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING:"
- + config.getString(SipDelegateImsConfiguration
- .KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_USER_AGENT_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_USER_AGENT_HEADER_STRING));
-
- Log.i(TAG, "KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_DEFAULT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_DEFAULT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_DEFAULT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_DEFAULT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_PORT_WITH_NAT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_PORT_WITH_NAT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_IPSEC_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_IPSEC_CLIENT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_IPSEC_SERVER_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_IPSEC_SERVER_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_IPSEC_OLD_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_IPSEC_OLD_CLIENT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_IPSEC_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_IPSEC_CLIENT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_IPSEC_SERVER_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_IPSEC_SERVER_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_IPSEC_OLD_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_IPSEC_OLD_CLIENT_PORT_INT, -99));
-
- Log.i(TAG, "KEY_SIP_CONFIG_IS_COMPACT_FORM_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_COMPACT_FORM_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_KEEPALIVE_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_KEEPALIVE_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_NAT_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_NAT_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL, false));
+ private void dumpConfig(SipDelegateConfiguration config) {
+ String result = "SipDelegateConfiguration{"
+ + "mVersion=" + config.getVersion()
+ + ", \n\tmTransportType=" + config.getTransportType()
+ + ", \n\tmLocalIpAddr=" + config.getLocalAddress()
+ + ", \n\tmSipServerAddr=" + config.getSipServerAddress()
+ + ", \n\tmIsSipCompactFormEnabled=" + config.isSipCompactFormEnabled()
+ + ", \n\tmIsSipKeepaliveEnabled=" + config.isSipKeepaliveEnabled()
+ + ", \n\tmMaxUdpPayloadSize=" + config.getMaxUdpPayloadSizeBytes()
+ + ", \n\tmPublicUserIdentifier=" + config.getPublicUserIdentifier()
+ + ", \n\tmPrivateUserIdentifier=" + config.getPrivateUserIdentifier()
+ + ", \n\tmHomeDomain=" + config.getHomeDomain()
+ + ", \n\tmImei=" + config.getImei()
+ + ", \n\tmGruu=" + config.getPublicGruuUri()
+ + ", \n\tmSipAuthHeader=" + config.getSipAuthenticationHeader()
+ + ", \n\tmSipAuthNonce=" + config.getSipAuthenticationNonce()
+ + ", \n\tmServiceRouteHeader=" + config.getSipServiceRouteHeader()
+ + ", \n\tmPathHeader=" + config.getSipPathHeader()
+ + ", \n\tmUserAgentHeader=" + config.getSipUserAgentHeader()
+ + ", \n\tmContactUserParam=" + config.getSipContactUserParameter()
+ + ", \n\tmPaniHeader=" + config.getSipPaniHeader()
+ + ", \n\tmPlaniHeader=" + config.getSipPlaniHeader()
+ + ", \n\tmCniHeader=" + config.getSipCniHeader()
+ + ", \n\tmAssociatedUriHeader=" + config.getSipAssociatedUriHeader()
+ + ", \n\tmIpSecConfiguration=" + config.getIpSecConfiguration()
+ + ", \n\tmNatConfiguration=" + config.getNatSocketAddress() + '}';
+ Log.i(TAG, result);
}
+
}
diff --git a/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/registration/RegistrationControllerImpl.java b/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/registration/RegistrationControllerImpl.java
index 9ababc3..6a70f3d 100644
--- a/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/registration/RegistrationControllerImpl.java
+++ b/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/registration/RegistrationControllerImpl.java
@@ -22,8 +22,8 @@
import android.telephony.ims.FeatureTagState;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsManager;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateConnection;
-import android.telephony.ims.SipDelegateImsConfiguration;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.SipMessage;
import android.telephony.ims.stub.DelegateConnectionMessageCallback;
@@ -109,7 +109,7 @@
private final SettableFuture<SipSession> sessionFuture = SettableFuture.create();
protected SipDelegateConnection sipDelegateConnection;
- private SipDelegateImsConfiguration configuration;
+ private SipDelegateConfiguration mConfiguration;
private final DelegateConnectionStateCallback connectionCallback =
new DelegateConnectionStateCallback() {
@@ -119,16 +119,15 @@
}
@Override
- public void onImsConfigurationChanged(
- SipDelegateImsConfiguration registeredSipConfig) {
+ public void onConfigurationChanged(
+ SipDelegateConfiguration registeredSipConfig) {
Log.d(
TAG,
"onSipConfigurationChanged: version="
- + registeredSipConfig.getVersion()
- + " bundle="
- + registeredSipConfig.copyBundle());
+ + registeredSipConfig.getVersion());
+ Log.i(TAG, "onSipConfigurationChanged: " + registeredSipConfig);
dumpConfig(registeredSipConfig);
- RegistrationContext.this.configuration = registeredSipConfig;
+ RegistrationContext.this.mConfiguration = registeredSipConfig;
}
@Override
@@ -233,84 +232,33 @@
Log.i(TAG, result);
}
- private void dumpConfig(SipDelegateImsConfiguration config) {
- Log.i(TAG, "KEY_SIP_CONFIG_TRANSPORT_TYPE_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_TRANSPORT_TYPE_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_USER_ID_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_USER_ID_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PRIVATE_USER_ID_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PRIVATE_USER_ID_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_HOME_DOMAIN_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_HOME_DOMAIN_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_IMEI_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_IPTYPE_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IPTYPE_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_DEFAULT_IPADDRESS_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_DEFAULT_IPADDRESS_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_DEFAULT_IPADDRESS_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_DEFAULT_IPADDRESS_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_IPADDRESS_WITH_NAT_STRING:" +
- config.getString(SipDelegateImsConfiguration.
- KEY_SIP_CONFIG_UE_PUBLIC_IPADDRESS_WITH_NAT_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_AUTHENTICATION_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_AUTHENTICATION_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_AUTHENTICATION_NONCE_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_AUTHENTICATION_NONCE_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVICE_ROUTE_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVICE_ROUTE_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_SECURITY_VERIFY_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SECURITY_VERIFY_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_PATH_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_PATH_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_URI_USER_PART_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_URI_USER_PART_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_P_ACCESS_NETWORK_INFO_HEADER_STRING:" +
- config.getString(SipDelegateImsConfiguration.
- KEY_SIP_CONFIG_P_ACCESS_NETWORK_INFO_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_P_LAST_ACCESS_NETWORK_INFO_HEADER_STRING:" +
- config.getString(SipDelegateImsConfiguration.
- KEY_SIP_CONFIG_P_LAST_ACCESS_NETWORK_INFO_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING));
- Log.i(TAG, "KEY_SIP_CONFIG_USER_AGENT_HEADER_STRING:" + config.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_USER_AGENT_HEADER_STRING));
-
- Log.i(TAG, "KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_DEFAULT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_DEFAULT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_DEFAULT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_DEFAULT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_PUBLIC_PORT_WITH_NAT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_PUBLIC_PORT_WITH_NAT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_IPSEC_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_IPSEC_CLIENT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_IPSEC_SERVER_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_IPSEC_SERVER_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_UE_IPSEC_OLD_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_IPSEC_OLD_CLIENT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_IPSEC_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_IPSEC_CLIENT_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_IPSEC_SERVER_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_IPSEC_SERVER_PORT_INT, -99));
- Log.i(TAG, "KEY_SIP_CONFIG_SERVER_IPSEC_OLD_CLIENT_PORT_INT:" + config.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_IPSEC_OLD_CLIENT_PORT_INT,
- -99));
-
- Log.i(TAG, "KEY_SIP_CONFIG_IS_COMPACT_FORM_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_COMPACT_FORM_ENABLED_BOOL,
- false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_KEEPALIVE_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_KEEPALIVE_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_NAT_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_NAT_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, false));
- Log.i(TAG, "KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL:" + config.getBoolean(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL, false));
+ private void dumpConfig(SipDelegateConfiguration config) {
+ String result = "SipDelegateConfiguration{"
+ + "mVersion=" + config.getVersion()
+ + ", \n\tmTransportType=" + config.getTransportType()
+ + ", \n\tmLocalAddr=" + config.getLocalAddress()
+ + ", \n\tmSipServerAddr=" + config.getSipServerAddress()
+ + ", \n\tmIsSipCompactFormEnabled=" + config.isSipCompactFormEnabled()
+ + ", \n\tmIsSipKeepaliveEnabled=" + config.isSipKeepaliveEnabled()
+ + ", \n\tmMaxUdpPayloadSize=" + config.getMaxUdpPayloadSizeBytes()
+ + ", \n\tmPublicUserIdentifier=" + config.getPublicUserIdentifier()
+ + ", \n\tmPrivateUserIdentifier=" + config.getPrivateUserIdentifier()
+ + ", \n\tmHomeDomain=" + config.getHomeDomain()
+ + ", \n\tmImei=" + config.getImei()
+ + ", \n\tmGruu=" + config.getPublicGruuUri()
+ + ", \n\tmSipAuthHeader=" + config.getSipAuthenticationHeader()
+ + ", \n\tmSipAuthNonce=" + config.getSipAuthenticationNonce()
+ + ", \n\tmServiceRouteHeader=" + config.getSipServiceRouteHeader()
+ + ", \n\tmPathHeader=" + config.getSipPathHeader()
+ + ", \n\tmUserAgentHeader=" + config.getSipUserAgentHeader()
+ + ", \n\tmContactUserParam=" + config.getSipContactUserParameter()
+ + ", \n\tmPaniHeader=" + config.getSipPaniHeader()
+ + ", \n\tmPlaniHeader=" + config.getSipPlaniHeader()
+ + ", \n\tmCniHeader=" + config.getSipCniHeader()
+ + ", \n\tmAssociatedUriHeader=" + config.getSipAssociatedUriHeader()
+ + ", \n\tmIpSecConfiguration=" + config.getIpSecConfiguration()
+ + ", \n\tmNatConfiguration=" + config.getNatSocketAddress() + '}';
+ Log.i(TAG, result);
}
@Override
@@ -330,54 +278,48 @@
@Override
public long getVersion() {
- return configuration.getVersion();
+ return mConfiguration.getVersion();
}
@Override
public String getOutboundProxyAddr() {
- return configuration.getString(SipDelegateImsConfiguration.
- KEY_SIP_CONFIG_SERVER_DEFAULT_IPADDRESS_STRING);
+ return mConfiguration.getSipServerAddress().getAddress().getHostAddress();
}
@Override
public int getOutboundProxyPort() {
- return configuration.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVER_DEFAULT_PORT_INT, -1);
+ return mConfiguration.getSipServerAddress().getPort();
}
@Override
public String getLocalIpAddress() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_DEFAULT_IPADDRESS_STRING);
+ return mConfiguration.getLocalAddress().getAddress().getHostAddress();
}
@Override
public int getLocalPort() {
- return configuration.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_UE_DEFAULT_PORT_INT, -1);
+ return mConfiguration.getLocalAddress().getPort();
}
@Override
public String getSipTransport() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_TRANSPORT_TYPE_STRING);
+ int sipTransport = mConfiguration.getTransportType();
+ return (sipTransport == SipDelegateConfiguration.SIP_TRANSPORT_TCP) ? "TCP" : "UDP";
}
@Override
public String getPublicUserIdentity() {
- return null;
+ return mConfiguration.getPublicUserIdentifier();
}
@Override
public String getDomain() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_HOME_DOMAIN_STRING);
+ return mConfiguration.getHomeDomain();
}
@Override
public List<String> getAssociatedUris() {
- String associatedUris = configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING);
+ String associatedUris = mConfiguration.getSipAssociatedUriHeader();
if (!TextUtils.isEmpty(associatedUris)) {
return Splitter.on(',').trimResults(CharMatcher.anyOf("<>")).splitToList(
associatedUris);
@@ -388,15 +330,17 @@
@Override
public String getSecurityVerifyHeader() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SECURITY_VERIFY_HEADER_STRING);
+ SipDelegateConfiguration.IpSecConfiguration c = mConfiguration.getIpSecConfiguration();
+ if (c == null) {
+ return null;
+ }
+ return c.getSipSecurityVerifyHeader();
}
@Override
public List<String> getServiceRouteHeaders() {
String serviceRoutes =
- configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_SERVICE_ROUTE_HEADER_STRING);
+ mConfiguration.getSipServiceRouteHeader();
if (TextUtils.isEmpty(serviceRoutes)) {
return Collections.emptyList();
}
@@ -405,38 +349,33 @@
@Override
public String getContactUser() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_URI_USER_PART_STRING);
+ return mConfiguration.getSipContactUserParameter();
}
@Override
public String getImei() {
- return configuration.getString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING);
+ return mConfiguration.getImei();
}
@Override
public String getPaniHeader() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_P_ACCESS_NETWORK_INFO_HEADER_STRING);
+ return mConfiguration.getSipPaniHeader();
}
@Override
public String getPlaniHeader() {
- return configuration.getString(
- SipDelegateImsConfiguration.
- KEY_SIP_CONFIG_P_LAST_ACCESS_NETWORK_INFO_HEADER_STRING);
+ return mConfiguration.getSipPlaniHeader();
}
@Override
public String getUserAgentHeader() {
- return configuration.getString(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_USER_AGENT_HEADER_STRING);
+ return mConfiguration.getSipUserAgentHeader();
}
@Override
public int getMaxPayloadSizeOnUdp() {
- return configuration.getInt(
- SipDelegateImsConfiguration.KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT, 1500);
+ return mConfiguration.getMaxUdpPayloadSizeBytes() > 0
+ ? mConfiguration.getMaxUdpPayloadSizeBytes() : 1500;
}
/**
diff --git a/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java b/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java
index 4d40702..8236f44 100644
--- a/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java
@@ -24,9 +24,10 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import android.net.InetAddresses;
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.FeatureTagState;
-import android.telephony.ims.SipDelegateImsConfiguration;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.aidl.ISipDelegate;
import android.telephony.ims.aidl.ISipDelegateConnectionStateCallback;
@@ -44,6 +45,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -85,13 +87,17 @@
DelegateRegistrationState regState = new DelegateRegistrationState.Builder()
.addRegisteredFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG)
.build();
- SipDelegateImsConfiguration config = new SipDelegateImsConfiguration.Builder(1/*version*/)
- .build();
+ InetSocketAddress localAddr = new InetSocketAddress(
+ InetAddresses.parseNumericAddress("1.1.1.1"), 80);
+ InetSocketAddress serverAddr = new InetSocketAddress(
+ InetAddresses.parseNumericAddress("2.2.2.2"), 81);
+ SipDelegateConfiguration c = new SipDelegateConfiguration.Builder(1,
+ SipDelegateConfiguration.SIP_TRANSPORT_TCP, localAddr, serverAddr).build();
stateTracker.onRegistrationStateChanged(regState);
- stateTracker.onImsConfigurationChanged(config);
+ stateTracker.onConfigurationChanged(c);
verify(mAppCallback).onFeatureTagStatusChanged(eq(regState),
eq(new ArrayList<>(deniedTags)));
- verify(mAppCallback).onImsConfigurationChanged(config);
+ verify(mAppCallback).onConfigurationChanged(c);
verify(mAppCallback, never()).onDestroyed(anyInt());
}
diff --git a/tests/src/com/android/services/telephony/rcs/SipDelegateBinderConnectionTest.java b/tests/src/com/android/services/telephony/rcs/SipDelegateBinderConnectionTest.java
index 360fa21..3d8e94b 100644
--- a/tests/src/com/android/services/telephony/rcs/SipDelegateBinderConnectionTest.java
+++ b/tests/src/com/android/services/telephony/rcs/SipDelegateBinderConnectionTest.java
@@ -25,12 +25,13 @@
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
+import android.net.InetAddresses;
import android.os.IBinder;
import android.os.RemoteException;
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.DelegateRequest;
import android.telephony.ims.FeatureTagState;
-import android.telephony.ims.SipDelegateImsConfiguration;
+import android.telephony.ims.SipDelegateConfiguration;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.aidl.ISipDelegate;
@@ -51,6 +52,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Set;
import java.util.function.BiConsumer;
@@ -194,9 +196,14 @@
cb.onCreated(mMockDelegate, new ArrayList<>(deniedTags));
verify(mMockCreatedCallback).accept(mMockDelegate, deniedTags);
- SipDelegateImsConfiguration config = new SipDelegateImsConfiguration.Builder(1).build();
- cb.onImsConfigurationChanged(config);
- verify(mMockStateCallback).onImsConfigurationChanged(config);
+ InetSocketAddress localAddr = new InetSocketAddress(
+ InetAddresses.parseNumericAddress("1.1.1.1"), 80);
+ InetSocketAddress serverAddr = new InetSocketAddress(
+ InetAddresses.parseNumericAddress("2.2.2.2"), 81);
+ SipDelegateConfiguration c = new SipDelegateConfiguration.Builder(1,
+ SipDelegateConfiguration.SIP_TRANSPORT_TCP, localAddr, serverAddr).build();
+ cb.onConfigurationChanged(c);
+ verify(mMockStateCallback).onConfigurationChanged(c);
DelegateRegistrationState regState = new DelegateRegistrationState.Builder()
.addRegisteredFeatureTags(request.getFeatureTags()).build();