aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2019-02-05 14:09:46 -0800
committerBrad Ebinger <breadley@google.com>2019-02-05 16:45:02 -0800
commitd83bf77b806ca8dc246d8ffa64f5fc985202b594 (patch)
treea875cf764eecf9c5fbb16492460fd8b4560ace3d
parent757882f2c2ed7535b81bf4e4950ce278a808a6b7 (diff)
downloadims-d83bf77b806ca8dc246d8ffa64f5fc985202b594.tar.gz
Batch Compatibility changes when sub boots and fix VT bug
1) The MmTelFeature#changeEnabledCapabilities supports batching multiple capabilitiy requests in one command. Modify ImsManager to batch these changes into one command and send it to the modem. 2) Remove VT capability enablement in the compat layer for older devices that expect enabling VT+VoLTE = only enable VoLTE. 3) Correct old bug in ImsManager, where we were checking VoLTE instead of VT enabled. Test: atest FrameworksTelephonyTests and manual Bug: 110130897 Change-Id: Ie98e557edf5c223bc104c72f9d870b99d8d6fa38
-rw-r--r--src/java/com/android/ims/ImsManager.java119
1 files changed, 71 insertions, 48 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index b42f3b71..b73829aa 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -1401,16 +1401,19 @@ public class ImsManager {
// Note: currently the order of updates is set to produce different order of
// changeEnabledCapabilities() function calls from setAdvanced4GMode(). This is done
// to differentiate this code path from vendor code perspective.
- boolean isImsUsed = updateVolteFeatureValue();
- isImsUsed |= updateWfcFeatureAndProvisionedValues();
- isImsUsed |= updateVideoCallFeatureValue();
- isImsUsed |= updateRttConfigValue();
-
+ CapabilityChangeRequest request = new CapabilityChangeRequest();
+ updateVolteFeatureValue(request);
+ updateWfcFeatureAndProvisionedValues(request);
+ updateVideoCallFeatureValue(request);
+ boolean isImsNeededForRtt = updateRttConfigValue();
// Supplementary services over UT do not require IMS registration. Do not alter IMS
// registration based on UT.
- updateUtFeatureValue();
+ updateUtFeatureValue(request);
+
+ // Send the batched request to the modem.
+ changeMmTelCapability(request);
- if (isImsUsed || !isTurnOffImsAllowedByPlatform()) {
+ if (isImsNeededForRtt || !isTurnOffImsAllowedByPlatform() || isImsNeeded(request)) {
// Turn on IMS if it is used.
// Also, if turning off is not allowed for current carrier,
// we need to turn IMS on because it might be turned off before
@@ -1431,12 +1434,17 @@ public class ImsManager {
}
}
+ private boolean isImsNeeded(CapabilityChangeRequest r) {
+ // IMS is not needed for UT, so only enabled IMS if any other capability is enabled.
+ return r.getCapabilitiesToEnable().stream()
+ .anyMatch((c) ->
+ (c.getCapability() != MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_UT));
+ }
+
/**
* Update VoLTE config
- * @return whether feature is On
- * @throws ImsException
*/
- private boolean updateVolteFeatureValue() throws ImsException {
+ private void updateVolteFeatureValue(CapabilityChangeRequest request) {
boolean available = isVolteEnabledByPlatform();
boolean enabled = isEnhanced4gLteModeSettingEnabledByUser();
boolean isNonTty = isNonTtyOrTtyOnVolteEnabled();
@@ -1446,18 +1454,21 @@ public class ImsManager {
+ ", enabled = " + enabled
+ ", nonTTY = " + isNonTty);
- changeMmTelCapability(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
- ImsRegistrationImplBase.REGISTRATION_TECH_LTE, isFeatureOn);
-
- return isFeatureOn;
+ if (isFeatureOn) {
+ request.addCapabilitiesToEnableForTech(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ } else {
+ request.addCapabilitiesToDisableForTech(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ }
}
/**
* Update video call over LTE config
- * @return whether feature is On
- * @throws ImsException
*/
- private boolean updateVideoCallFeatureValue() throws ImsException {
+ private void updateVideoCallFeatureValue(CapabilityChangeRequest request) {
boolean available = isVtEnabledByPlatform();
boolean enabled = isVtEnabledByUser();
boolean isNonTty = isNonTtyOrTtyOnVolteEnabled();
@@ -1473,18 +1484,21 @@ public class ImsManager {
+ ", nonTTY = " + isNonTty
+ ", data enabled = " + isDataEnabled);
- changeMmTelCapability(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO,
- ImsRegistrationImplBase.REGISTRATION_TECH_LTE, isFeatureOn);
-
- return isFeatureOn;
+ if (isFeatureOn) {
+ request.addCapabilitiesToEnableForTech(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO,
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ } else {
+ request.addCapabilitiesToDisableForTech(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO,
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ }
}
/**
* Update WFC config
- * @return whether feature is On
- * @throws ImsException
*/
- private boolean updateWfcFeatureAndProvisionedValues() throws ImsException {
+ private void updateWfcFeatureAndProvisionedValues(CapabilityChangeRequest request) {
TelephonyManager tm = new TelephonyManager(mContext, getSubId());
boolean isNetworkRoaming = tm.isNetworkRoaming();
boolean available = isWfcEnabledByPlatform();
@@ -1498,8 +1512,15 @@ public class ImsManager {
+ ", mode = " + mode
+ ", roaming = " + roaming);
- changeMmTelCapability(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
- ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN, isFeatureOn);
+ if (isFeatureOn) {
+ request.addCapabilitiesToEnableForTech(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
+ ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);
+ } else {
+ request.addCapabilitiesToDisableForTech(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
+ ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);
+ }
if (!isFeatureOn) {
mode = ImsMmTelManager.WIFI_MODE_CELLULAR_PREFERRED;
@@ -1507,12 +1528,10 @@ public class ImsManager {
}
setWfcModeInternal(mode);
setWfcRoamingSettingInternal(roaming);
-
- return isFeatureOn;
}
- private boolean updateUtFeatureValue() throws ImsException {
+ private void updateUtFeatureValue(CapabilityChangeRequest request) {
boolean isCarrierSupported = isSuppServicesOverUtEnabledByPlatform();
boolean requiresProvisioning = getBooleanCarrierConfig(
CarrierConfigManager.KEY_CARRIER_UT_PROVISIONING_REQUIRED_BOOL);
@@ -1533,7 +1552,6 @@ public class ImsManager {
Log.e(TAG, "updateUtFeatureValue: couldn't reach telephony! returning provisioned");
}
}
- CapabilityChangeRequest request = new CapabilityChangeRequest();
boolean isFeatureOn = isCarrierSupported && isProvisioned;
log("updateUtFeatureValue: available = " + isCarrierSupported
@@ -1549,13 +1567,6 @@ public class ImsManager {
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_UT,
ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
}
- try {
- mMmTelFeatureConnection.changeEnabledCapabilities(request, null);
- } catch (RemoteException e) {
- throw new ImsException("updateUtFeatureValue()", e,
- ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
- }
- return isFeatureOn;
}
/**
@@ -2076,7 +2087,6 @@ public class ImsManager {
@MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
@ImsRegistrationImplBase.ImsRegistrationTech int radioTech,
boolean isEnabled) throws ImsException {
- checkAndThrowExceptionIfServiceUnavailable();
CapabilityChangeRequest request = new CapabilityChangeRequest();
if (isEnabled) {
@@ -2084,18 +2094,31 @@ public class ImsManager {
} else {
request.addCapabilitiesToDisableForTech(capability, radioTech);
}
+ changeMmTelCapability(request);
+ }
+
+ public void changeMmTelCapability(CapabilityChangeRequest r) throws ImsException {
+ checkAndThrowExceptionIfServiceUnavailable();
try {
- mMmTelFeatureConnection.changeEnabledCapabilities(request, null);
- if (mImsConfigListener != null) {
- mImsConfigListener.onSetFeatureResponse(capability,
- mMmTelFeatureConnection.getRegistrationTech(),
- isEnabled ? ProvisioningManager.PROVISIONING_VALUE_ENABLED
- : ProvisioningManager.PROVISIONING_VALUE_DISABLED, -1);
- }
Log.i(TAG, "changeMmTelCapability: changing capabilities for sub: " + getSubId()
- + ", request: " + request);
+ + ", request: " + r);
+ mMmTelFeatureConnection.changeEnabledCapabilities(r, null);
+ if (mImsConfigListener == null) {
+ return;
+ }
+ for (CapabilityChangeRequest.CapabilityPair enabledCaps : r.getCapabilitiesToEnable()) {
+ mImsConfigListener.onSetFeatureResponse(enabledCaps.getCapability(),
+ enabledCaps.getRadioTech(),
+ ProvisioningManager.PROVISIONING_VALUE_ENABLED, -1);
+ }
+ for (CapabilityChangeRequest.CapabilityPair disabledCaps :
+ r.getCapabilitiesToDisable()) {
+ mImsConfigListener.onSetFeatureResponse(disabledCaps.getCapability(),
+ disabledCaps.getRadioTech(),
+ ProvisioningManager.PROVISIONING_VALUE_DISABLED, -1);
+ }
} catch (RemoteException e) {
- throw new ImsException("changeMmTelCapability()", e,
+ throw new ImsException("changeMmTelCapability(CCR)", e,
ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
}
}
@@ -2408,7 +2431,7 @@ public class ImsManager {
ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
}
- if (isVolteEnabledByPlatform()) {
+ if (isVtEnabledByPlatform()) {
boolean ignoreDataEnabledChanged = getBooleanCarrierConfig(
CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS);
boolean enableViLte = turnOn && isVtEnabledByUser() &&