Merge "Format Numbers correctly for the Network"
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 37a0618..831b537 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -278,6 +278,9 @@
obtainMessage(EVENT_BIND_DEFAULT_TIMEOUT, phoneId, -1),
BIND_TIMEOUT_MILLIS);
} else {
+ // Put a stub bundle in place so that the rest of the logic continues
+ // smoothly.
+ mConfigFromDefaultApp[phoneId] = new PersistableBundle();
// Send broadcast if bind fails.
notifySubscriptionInfoUpdater(phoneId);
// TODO: We *must* call unbindService even if bindService returns false.
@@ -359,6 +362,8 @@
unbindIfBound(mContext, mServiceConnection[phoneId], phoneId);
broadcastConfigChangedIntent(phoneId);
}
+ // Put a stub bundle in place so that the rest of the logic continues smoothly.
+ mConfigFromDefaultApp[phoneId] = new PersistableBundle();
notifySubscriptionInfoUpdater(phoneId);
break;
}
@@ -402,6 +407,9 @@
obtainMessage(EVENT_BIND_CARRIER_TIMEOUT, phoneId, -1),
BIND_TIMEOUT_MILLIS);
} else {
+ // Put a stub bundle in place so that the rest of the logic continues
+ // smoothly.
+ mConfigFromCarrierApp[phoneId] = new PersistableBundle();
// Send broadcast if bind fails.
broadcastConfigChangedIntent(phoneId);
loge("Bind to carrier app: " + carrierPackageName + " fails");
@@ -471,7 +479,8 @@
case EVENT_BIND_CARRIER_TIMEOUT:
case EVENT_FETCH_CARRIER_TIMEOUT: {
- loge("Bind/fetch from carrier app timeout");
+ loge("Bind/fetch from carrier app timeout, package="
+ + getCarrierPackageForPhoneId(phoneId));
removeMessages(EVENT_FETCH_CARRIER_TIMEOUT);
// If we attempted to bind to the app, but the service connection is null due to
// the race condition that clear config event happens before bind/fetch complete
@@ -482,6 +491,8 @@
unbindIfBound(mContext, mServiceConnection[phoneId], phoneId);
broadcastConfigChangedIntent(phoneId);
}
+ // Put a stub bundle in place so that the rest of the logic continues smoothly.
+ mConfigFromCarrierApp[phoneId] = new PersistableBundle();
notifySubscriptionInfoUpdater(phoneId);
break;
}
@@ -848,6 +859,7 @@
}
/** Returns the package name of a priveleged carrier app, or null if there is none. */
+ @Nullable
private String getCarrierPackageForPhoneId(int phoneId) {
List<String> carrierPackageNames = TelephonyManager.from(mContext)
.getCarrierPackageNamesForIntentAndPhone(
@@ -1167,25 +1179,27 @@
PersistableBundle config = mConfigFromDefaultApp[phoneId];
if (config != null) {
retConfig.putAll(config);
- if (getCarrierPackageForPhoneId(phoneId) == null) {
- retConfig.putBoolean(
- CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
- }
}
config = mConfigFromCarrierApp[phoneId];
if (config != null) {
retConfig.putAll(config);
- retConfig.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
}
config = mPersistentOverrideConfigs[phoneId];
if (config != null) {
retConfig.putAll(config);
- retConfig.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
}
config = mOverrideConfigs[phoneId];
if (config != null) {
retConfig.putAll(config);
}
+ // Ignore the theoretical case of the default app not being present since that won't
+ // work in CarrierConfigLoader today.
+ final boolean allConfigsApplied =
+ (mConfigFromCarrierApp[phoneId] != null
+ || getCarrierPackageForPhoneId(phoneId) == null)
+ && mConfigFromDefaultApp[phoneId] != null;
+ retConfig.putBoolean(
+ CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, allConfigsApplied);
} else {
if (mNoSimConfig != null) {
retConfig.putAll(mNoSimConfig);
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 59466b0..97c2773 100755
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -18,6 +18,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Icon;
@@ -65,8 +66,11 @@
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.d2d.Communicator;
+import com.android.internal.telephony.d2d.DtmfAdapter;
+import com.android.internal.telephony.d2d.DtmfTransport;
import com.android.internal.telephony.d2d.RtpAdapter;
import com.android.internal.telephony.d2d.RtpTransport;
+import com.android.internal.telephony.d2d.Timeouts;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
@@ -87,6 +91,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
/**
* Base class for CDMA and GSM connections.
@@ -844,6 +849,8 @@
private RtpTransport mRtpTransport;
+ private DtmfTransport mDtmfTransport;
+
/**
* Facilitates device to device communication.
*/
@@ -3219,7 +3226,20 @@
}
};
mRtpTransport = new RtpTransport(rtpAdapter, null /* TODO: not needed yet */, mHandler);
- mCommunicator = new Communicator(List.of(mRtpTransport), this);
+
+ DtmfAdapter dtmfAdapter = digit -> {
+ if (!isImsConnection()) {
+ Log.w(TelephonyConnection.this, "sendDtmf: not an ims conn.");
+ }
+ Log.d(TelephonyConnection.this, "sendDtmf: send digit %c", digit);
+ ImsPhoneConnection originalConnection =
+ (ImsPhoneConnection) mOriginalConnection;
+ originalConnection.getImsCall().sendDtmf(digit, null /* result msg not needed */);
+ };
+ ContentResolver cr = getPhone().getContext().getContentResolver();
+ mDtmfTransport = new DtmfTransport(dtmfAdapter, new Timeouts.Adapter(cr),
+ Executors.newSingleThreadScheduledExecutor());
+ mCommunicator = new Communicator(List.of(mRtpTransport, mDtmfTransport), this);
mD2DCallStateAdapter = new D2DCallStateAdapter(mCommunicator);
addTelephonyConnectionListener(mD2DCallStateAdapter);
}
diff --git a/tests/src/com/android/services/telephony/rcs/RcsFeatureControllerTest.java b/tests/src/com/android/services/telephony/rcs/RcsFeatureControllerTest.java
index a79d058..eecbd2e 100644
--- a/tests/src/com/android/services/telephony/rcs/RcsFeatureControllerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/RcsFeatureControllerTest.java
@@ -31,6 +31,7 @@
import android.telephony.AccessNetworkConstants;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsReasonInfo;
+import android.telephony.ims.ImsRegistrationAttributes;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IImsRegistrationCallback;
@@ -175,7 +176,9 @@
});
verify(mRegistrationCallback).handleImsUnregistered(REASON_DISCONNECTED);
- captor.getValue().onRegistering(ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder(
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build();
+ captor.getValue().onRegistering(attr);
controller.getRegistrationState(result -> {
assertNotNull(result);
assertEquals(RegistrationManager.REGISTRATION_STATE_REGISTERING, result.intValue());
@@ -183,7 +186,7 @@
verify(mRegistrationCallback).handleImsRegistering(
AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
- captor.getValue().onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ captor.getValue().onRegistered(attr);
controller.getRegistrationState(result -> {
assertNotNull(result);
assertEquals(RegistrationManager.REGISTRATION_STATE_REGISTERED, result.intValue());