[Settings] Apply WifiCallingQueryImsState
Apply design of WifiCallingQueryImsState to source code which accessing WifiCalling. Bug: 140542283 Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingSettingsForSubTest Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingPreferenceControllerTest Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingSettingsTest Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingSliceHelperTest Change-Id: I0db966742d63cfe9a1ef4e1b06f6b5c81f681927
This commit is contained in:
@@ -27,10 +27,6 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.ims.ImsManager;
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||
|
||||
/**
|
||||
* Controller class for querying Wifi calling status
|
||||
*/
|
||||
@@ -66,12 +62,6 @@ public class WifiCallingQueryImsState extends ImsQueryController {
|
||||
return (new ImsQueryWfcUserSetting(subId)).query();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
ImsManager getImsManager(int subId) {
|
||||
return ImsManager.getInstance(mContext,
|
||||
SubscriptionUtil.getPhoneId(mContext, subId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether Wifi Calling is a supported feature on this subscription
|
||||
*
|
||||
@@ -107,8 +97,15 @@ public class WifiCallingQueryImsState extends ImsQueryController {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||
return false;
|
||||
}
|
||||
return isWifiCallingProvisioned()
|
||||
&& MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId));
|
||||
if (!isWifiCallingProvisioned()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return isServiceStateReady(mSubId);
|
||||
} catch (InterruptedException | IllegalArgumentException | ImsException exception) {
|
||||
Log.w(LOG_TAG, "fail to get WFC service status. subId=" + mSubId, exception);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user