Merge "[Settings] Replace ImsManager#getImsServiceState()" into rvc-dev

This commit is contained in:
Bonian Chen
2020-03-19 04:35:39 +00:00
committed by Android (Google) Code Review
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;