Search in sources :

Example 1 with MockVolteQueryImsState

use of com.android.settings.network.ims.MockVolteQueryImsState in project android_packages_apps_Settings by omnirom.

the class VideoCallingPreferenceControllerTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    doReturn(mTelephonyManager).when(mContext).getSystemService(TelephonyManager.class);
    doReturn(mCarrierConfigManager).when(mContext).getSystemService(CarrierConfigManager.class);
    doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SUB_ID);
    mCarrierConfig = new PersistableBundle();
    mCarrierConfig.putBoolean(CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS, true);
    doReturn(mCarrierConfig).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
    mQueryImsState = new MockVtQueryImsState(mContext, SUB_ID);
    mQueryImsState.setIsEnabledByUser(true);
    mQueryVoLteState = new MockVolteQueryImsState(mContext, SUB_ID);
    mQueryVoLteState.setIsEnabledByUser(true);
    mPreference = new SwitchPreference(mContext);
    mController = spy(new VideoCallingPreferenceController(mContext, "wifi_calling"));
    mController.init(SUB_ID);
    doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
    doReturn(mQueryVoLteState).when(mController).queryVoLteState(anyInt());
    mPreference.setKey(mController.getPreferenceKey());
    mQueryImsState.setIsEnabledByPlatform(true);
    mQueryImsState.setIsProvisionedOnDevice(true);
    mQueryImsState.setServiceStateReady(true);
    doReturn(true).when(mTelephonyManager).isDataEnabled();
    mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
}
Also used : PersistableBundle(android.os.PersistableBundle) SwitchPreference(androidx.preference.SwitchPreference) MockVolteQueryImsState(com.android.settings.network.ims.MockVolteQueryImsState) MockVtQueryImsState(com.android.settings.network.ims.MockVtQueryImsState) Before(org.junit.Before)

Example 2 with MockVolteQueryImsState

use of com.android.settings.network.ims.MockVolteQueryImsState in project android_packages_apps_Settings by omnirom.

the class Enhanced4gLteSliceHelperTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(ApplicationProvider.getApplicationContext());
    mFeatureFactory = FakeFeatureFactory.setupForTest();
    mSlicesFeatureProvider = mFeatureFactory.getSlicesFeatureProvider();
    // setup for SettingsSliceProvider tests
    mProvider = new SettingsSliceProvider();
    mProvider.attachInfo(mContext, null);
    mProvider.onCreateSliceProvider();
    // setup for SliceBroadcastReceiver test
    mReceiver = spy(new SliceBroadcastReceiver());
    mQueryImsState = spy(new MockVolteQueryImsState(mContext, SUB_ID));
    mQueryImsState.setEnabledByPlatform(true);
    mQueryImsState.setIsProvisionedOnDevice(true);
    mQueryImsState.setIsTtyOnVolteEnabled(true);
    mQueryImsState.setServiceStateReady(true);
    mQueryImsState.setIsEnabledByUser(true);
    mEnhanced4gLteSliceHelper = spy(new FakeEnhanced4gLteSliceHelper(mContext));
    // Set-up specs for SliceMetadata.
    SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
}
Also used : SettingsSliceProvider(com.android.settings.slices.SettingsSliceProvider) MockVolteQueryImsState(com.android.settings.network.ims.MockVolteQueryImsState) SliceBroadcastReceiver(com.android.settings.slices.SliceBroadcastReceiver) Before(org.junit.Before)

Example 3 with MockVolteQueryImsState

use of com.android.settings.network.ims.MockVolteQueryImsState in project android_packages_apps_Settings by omnirom.

the class Enhanced4gBasePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(ApplicationProvider.getApplicationContext());
    when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
    when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
    when(mContext.getSystemService(CarrierConfigManager.class)).thenReturn(mCarrierConfigManager);
    doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SUB_ID);
    doReturn(mInvalidTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
    mCarrierConfig = new PersistableBundle();
    doReturn(mCarrierConfig).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
    mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL, false);
    mCarrierConfig.putBoolean(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL, true);
    mCarrierConfig.putInt(CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT, 1);
    mQueryImsState = spy(new MockVolteQueryImsState(mContext, SUB_ID));
    mQueryImsState.setEnabledByPlatform(true);
    mQueryImsState.setIsProvisionedOnDevice(true);
    mQueryImsState.setIsTtyOnVolteEnabled(true);
    mQueryImsState.setServiceStateReady(true);
    mQueryImsState.setIsEnabledByUser(true);
    mPreference = new RestrictedSwitchPreference(mContext);
    mController = spy(new Enhanced4gLtePreferenceController(mContext, "VoLTE"));
    mController.init(SUB_ID);
    doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
    doReturn(true).when(mController).isCallStateIdle();
    doReturn(1).when(mController).getMode();
    mPreference.setKey(mController.getPreferenceKey());
}
Also used : PersistableBundle(android.os.PersistableBundle) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) MockVolteQueryImsState(com.android.settings.network.ims.MockVolteQueryImsState) Before(org.junit.Before)

Aggregations

MockVolteQueryImsState (com.android.settings.network.ims.MockVolteQueryImsState)3 Before (org.junit.Before)3 PersistableBundle (android.os.PersistableBundle)2 SwitchPreference (androidx.preference.SwitchPreference)1 MockVtQueryImsState (com.android.settings.network.ims.MockVtQueryImsState)1 SettingsSliceProvider (com.android.settings.slices.SettingsSliceProvider)1 SliceBroadcastReceiver (com.android.settings.slices.SliceBroadcastReceiver)1 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)1