use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method testEabSetProvisionedValues.
@Test
public void testEabSetProvisionedValues() throws Exception {
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
assertEquals(true, imsManager.isEabProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED));
imsManager.getConfigInterface().setProvisionedValue(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED, ImsConfig.FeatureValueConstants.OFF);
assertEquals(0, (int) mProvisionedIntVals.get(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED));
assertEquals(false, imsManager.isEabProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).setConfig(eq(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED), eq(0));
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED));
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method getWfcMode_useWfcHomeModeConfigTrue_shouldUseWfcHomeMode.
/**
* Tests the operation of getWfcMode when the configuration to use the home network mode when
* roaming for WFC is true independent of whether or not the WFC roaming mode is editable.
*
* Preconditions:
* - CarrierConfigManager.KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL = true
*/
@Test
@SmallTest
public void getWfcMode_useWfcHomeModeConfigTrue_shouldUseWfcHomeMode() {
// Set some values that are different than the defaults for WFC mode.
doReturn(String.valueOf(ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY)).when(mSubscriptionController).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_MODE), anyString(), nullable(String.class));
doReturn(String.valueOf(ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED)).when(mSubscriptionController).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_MODE), anyString(), nullable(String.class));
// Set to use WFC home network mode in roaming network.
mBundle.putBoolean(CarrierConfigManager.KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL, WFC_USE_HOME_MODE_FOR_ROAMING_VAL);
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
// Check that use the WFC home network mode.
assertEquals(ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY, imsManager.getWfcMode(true));
verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_MODE), anyString(), nullable(String.class));
// Set WFC home network mode to not editable.
mBundle.putBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL, WFC_IMS_NOT_EDITABLE_VAL);
// Check that use the default WFC home network mode.
assertEquals(WFC_IMS_MODE_DEFAULT_VAL, imsManager.getWfcMode(true));
verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_MODE), anyString(), nullable(String.class));
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method testSetWfcMode_shouldSetWfcModeRoamingEnabledUserDisabled.
/**
* Tests that when user changed WFC mode while roaming, that setting is sent to the
* ImsService correctly when changing the roaming mode.
*
* Preconditions:
* - CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL = true
* - CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL = true
*/
@Test
@SmallTest
public void testSetWfcMode_shouldSetWfcModeRoamingEnabledUserDisabled() throws Exception {
// The user disabled "WFC while roaming" setting in the UI
doReturn(String.valueOf(0)).when(mSubscriptionController).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_ENABLED), anyString(), nullable(String.class));
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
// the device is currently roaming
doReturn(true).when(mTelephonyManager).isNetworkRoaming(eq(mSubId[0]));
// The carrier app has changed the WFC mode while roaming, so we must set the WFC mode
// to the new configuration.
imsManager.setWfcMode(ImsMmTelManager.WIFI_MODE_CELLULAR_PREFERRED, true);
verify(mImsConfigImplBaseMock).setConfig(eq(ProvisioningManager.KEY_VOICE_OVER_WIFI_MODE_OVERRIDE), eq(ImsMmTelManager.WIFI_MODE_CELLULAR_PREFERRED));
// WiFi Roaming enabled setting is not related to WFC mode
verify(mImsConfigImplBaseMock, never()).setConfig(eq(ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE), anyInt());
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method testGetProvisionedValues.
@Test
public void testGetProvisionedValues() throws Exception {
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
assertEquals(true, imsManager.isWfcProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED));
assertEquals(true, imsManager.isVtProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.LVC_SETTING_ENABLED));
assertEquals(true, imsManager.isVolteProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.VLT_SETTING_ENABLED));
// If we call get again, times should still be one because the value should be fetched
// from cache.
assertEquals(true, imsManager.isWfcProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED));
assertEquals(true, imsManager.isVtProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.LVC_SETTING_ENABLED));
assertEquals(true, imsManager.isVolteProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.VLT_SETTING_ENABLED));
assertEquals(true, imsManager.isEabProvisionedOnDevice());
verify(mImsConfigImplBaseMock, times(1)).getConfigInt(eq(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED));
}
use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.
the class ImsManagerTest method testSetWfcSetting_shouldSetWfcModeRoamingEnabledUserEnabled.
/**
* Tests that when user changed WFC setting while roaming, that the correct user setting
* is sent to the ImsService when changing the roaming mode.
*
* Preconditions:
* - CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL = true
* - CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL = true
*/
@Test
@SmallTest
public void testSetWfcSetting_shouldSetWfcModeRoamingEnabledUserEnabled() throws Exception {
// The user has previously enabled "WFC while roaming" setting in UI and then turned WFC
// off.
doReturn(String.valueOf(1)).when(mSubscriptionController).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_ENABLED), anyString(), nullable(String.class));
ImsManager imsManager = getImsManagerAndInitProvisionedValues();
// The device is currently roaming
doReturn(true).when(mTelephonyManager).isNetworkRoaming(eq(mSubId[0]));
// The user has enabled WFC in the UI while the device is roaming.
imsManager.setWfcSetting(true);
verify(mImsConfigImplBaseMock).setConfig(eq(ProvisioningManager.KEY_VOICE_OVER_WIFI_MODE_OVERRIDE), // Default for roaming is WFC_IMS_ROAMING_MODE_DEFAULT_VAL
eq(ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED));
verify(mImsConfigImplBaseMock).setConfig(eq(ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE), // Should be enabled because user enabled the setting in the UI previously.
eq(ProvisioningManager.PROVISIONING_VALUE_ENABLED));
}
Aggregations