use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method testSetProvisionedValues.
@Test
public void testSetProvisionedValues() throws Exception {
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
assertEquals(true, imsManager.isWfcProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED));
imsManager.getConfigInterface().setProvisionedValue(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED, ImsConfig.FeatureValueConstants.OFF);
assertEquals(0, (int) mProvisionedIntVals.get(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED));
assertEquals(false, imsManager.isWfcProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).setConfig(eq(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED), eq(0));
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED));
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method setWfcRoamingSettingTest.
/**
* Tests the operation of setWfcRoamingSetting and ensures that the user setting for WFC roaming
* and the ImsConfig setting are both called properly.
*/
@Test
@SmallTest
public void setWfcRoamingSettingTest() {
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
imsManager.setWfcRoamingSetting(true);
verify(mSubscriptionController, times(1)).setSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_ENABLED), eq("1"));
verify(mImsConfigImplBaseMock).setConfig(eq(ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE), eq(ProvisioningManager.PROVISIONING_VALUE_ENABLED));
imsManager.setWfcRoamingSetting(false);
verify(mSubscriptionController, times(1)).setSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_ENABLED), eq("0"));
verify(mImsConfigImplBaseMock).setConfig(eq(ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE), eq(ProvisioningManager.PROVISIONING_VALUE_DISABLED));
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class Phone method checkWfcWifiOnlyModeBeforeDial.
public static void checkWfcWifiOnlyModeBeforeDial(Phone imsPhone, int phoneId, Context context) throws CallStateException {
if (imsPhone == null || !imsPhone.isWifiCallingEnabled()) {
ImsManager imsManager = ImsManager.getInstance(context, phoneId);
boolean wfcWiFiOnly = (imsManager.isWfcEnabledByPlatform() && imsManager.isWfcEnabledByUser() && (imsManager.getWfcMode() == ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY));
if (wfcWiFiOnly) {
throw new CallStateException(CallStateException.ERROR_OUT_OF_SERVICE, "WFC Wi-Fi Only Mode: IMS not registered");
}
}
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class Phone method isImsUseEnabled.
/**
* Determines if IMS is enabled for call.
*
* @return {@code true} if IMS calling is enabled.
*/
public boolean isImsUseEnabled() {
ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
boolean imsUseEnabled = ((imsManager.isVolteEnabledByPlatform() && imsManager.isEnhanced4gLteModeSettingEnabledByUser()) || (imsManager.isWfcEnabledByPlatform() && imsManager.isWfcEnabledByUser()) && imsManager.isNonTtyOrTtyOnVolteEnabled());
return imsUseEnabled;
}
use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiCallingSliceHelper method handleWifiCallingPreferenceChanged.
/**
* Handles wifi calling preference Setting change from wifi calling preference Slice and posts
* notification for the change. Should be called when intent action is one of the below
* ACTION_WIFI_CALLING_PREFERENCE_WIFI_ONLY
* ACTION_WIFI_CALLING_PREFERENCE_WIFI_PREFERRED
* ACTION_WIFI_CALLING_PREFERENCE_CELLULAR_PREFERRED
*
* @param intent intent
*/
public void handleWifiCallingPreferenceChanged(Intent intent) {
final int subId = getDefaultVoiceSubId();
final int errorValue = -1;
if (subId > SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
final boolean isWifiCallingPrefEditable = isCarrierConfigManagerKeyEnabled(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL, subId, false);
final boolean isWifiOnlySupported = isCarrierConfigManagerKeyEnabled(CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, subId, true);
ImsManager imsManager = getImsManager(subId);
if (isWifiCallingPrefEditable && imsManager.isWfcEnabledByPlatform() && imsManager.isWfcProvisionedOnDevice() && imsManager.isWfcEnabledByUser() && imsManager.isNonTtyOrTtyOnVolteEnabled()) {
// Change the preference only when wifi calling is enabled
// And when wifi calling preference is editable for the current carrier
final int currentValue = imsManager.getWfcMode(false);
int newValue = errorValue;
switch(intent.getAction()) {
case ACTION_WIFI_CALLING_PREFERENCE_WIFI_ONLY:
if (isWifiOnlySupported) {
// change to wifi_only when wifi_only is enabled.
newValue = ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY;
}
break;
case ACTION_WIFI_CALLING_PREFERENCE_WIFI_PREFERRED:
newValue = ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED;
break;
case ACTION_WIFI_CALLING_PREFERENCE_CELLULAR_PREFERRED:
newValue = ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED;
break;
}
if (newValue != errorValue && newValue != currentValue) {
// Update the setting only when there is a valid update
imsManager.setWfcMode(newValue, false);
}
}
}
// notify change in slice in any case to get re-queried. This would result in displaying
// appropriate message.
mContext.getContentResolver().notifyChange(WIFI_CALLING_PREFERENCE_URI, null);
}
Aggregations