Loading src/java/com/android/ims/ImsManager.java +71 −48 Original line number Diff line number Diff line Loading @@ -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); if (isImsUsed || !isTurnOffImsAllowedByPlatform()) { // Send the batched request to the modem. changeMmTelCapability(request); 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 Loading @@ -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(); Loading @@ -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(); Loading @@ -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(); Loading @@ -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; Loading @@ -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); Loading @@ -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 Loading @@ -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; } /** Loading Loading @@ -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) { Loading @@ -2084,18 +2094,31 @@ public class ImsManager { } else { request.addCapabilitiesToDisableForTech(capability, radioTech); } try { mMmTelFeatureConnection.changeEnabledCapabilities(request, null); if (mImsConfigListener != null) { mImsConfigListener.onSetFeatureResponse(capability, mMmTelFeatureConnection.getRegistrationTech(), isEnabled ? ProvisioningManager.PROVISIONING_VALUE_ENABLED : ProvisioningManager.PROVISIONING_VALUE_DISABLED, -1); changeMmTelCapability(request); } public void changeMmTelCapability(CapabilityChangeRequest r) throws ImsException { checkAndThrowExceptionIfServiceUnavailable(); try { 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); } } Loading Loading @@ -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() && Loading Loading
src/java/com/android/ims/ImsManager.java +71 −48 Original line number Diff line number Diff line Loading @@ -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); if (isImsUsed || !isTurnOffImsAllowedByPlatform()) { // Send the batched request to the modem. changeMmTelCapability(request); 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 Loading @@ -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(); Loading @@ -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(); Loading @@ -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(); Loading @@ -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; Loading @@ -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); Loading @@ -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 Loading @@ -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; } /** Loading Loading @@ -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) { Loading @@ -2084,18 +2094,31 @@ public class ImsManager { } else { request.addCapabilitiesToDisableForTech(capability, radioTech); } try { mMmTelFeatureConnection.changeEnabledCapabilities(request, null); if (mImsConfigListener != null) { mImsConfigListener.onSetFeatureResponse(capability, mMmTelFeatureConnection.getRegistrationTech(), isEnabled ? ProvisioningManager.PROVISIONING_VALUE_ENABLED : ProvisioningManager.PROVISIONING_VALUE_DISABLED, -1); changeMmTelCapability(request); } public void changeMmTelCapability(CapabilityChangeRequest r) throws ImsException { checkAndThrowExceptionIfServiceUnavailable(); try { 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); } } Loading Loading @@ -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() && Loading