Merge "[Settings] Replace ImsManager#getImsServiceState()" into rvc-dev am: c073abaf2e am: a65de8cd51 am: 0013a04115 am: 7b196f6b84

Change-Id: Iac3dc794074338f1c4491dcb7b97964fb3f8df91
This commit is contained in:
Bonian Chen
2020-03-19 05:54:16 +00:00
committed by Automerger Merge Worker
5 changed files with 109 additions and 6 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.network.ims;
import android.content.Context;
import android.telephony.ims.ImsException;
import com.android.ims.ImsManager;
@@ -29,6 +30,7 @@ public class MockVtQueryImsState extends VtQueryImsState {
private Boolean mIsTtyOnVolteEnabled;
private Boolean mIsProvisionedOnDevice;
private Boolean mIsEnabledByUser;
private Boolean mIsServiceStateReady;
/**
* Constructor
@@ -68,6 +70,19 @@ public class MockVtQueryImsState extends VtQueryImsState {
return super.isProvisionedOnDevice(subId);
}
public void setServiceStateReady(boolean isReady) {
mIsServiceStateReady = isReady;
}
@Override
boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
IllegalArgumentException {
if (mIsServiceStateReady != null) {
return mIsServiceStateReady;
}
return super.isServiceStateReady(subId);
}
public void setIsEnabledByUser(boolean enabled) {
mIsEnabledByUser = enabled;
}

View File

@@ -27,7 +27,6 @@ import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.telephony.ims.ProvisioningManager;
import android.telephony.ims.feature.ImsFeature;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
@@ -98,7 +97,7 @@ public class VideoCallingPreferenceControllerTest {
doReturn(true).when(mImsManager).isVtEnabledByPlatform();
mQueryImsState.setIsProvisionedOnDevice(true);
doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState();
mQueryImsState.setServiceStateReady(true);
doReturn(true).when(mTelephonyManager).isDataEnabled();
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;