[Settings] Replace ImsManager#isWfcEnabledByPlatform() am: c134ef08d4 am: 9c4d1190d9

Change-Id: Icf336c69791952c542c4c31d02a1da901e4db70e
This commit is contained in:
Bonian Chen
2020-03-30 18:28:46 +00:00
committed by Automerger Merge Worker
4 changed files with 42 additions and 13 deletions

View File

@@ -20,8 +20,10 @@ import android.content.Context;
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.SubscriptionManager;
import android.telephony.ims.ImsException;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -34,6 +36,8 @@ import com.android.settings.network.telephony.MobileNetworkUtils;
*/
public class WifiCallingQueryImsState extends ImsQueryController {
private static final String LOG_TAG = "WifiCallingQueryImsState";
private Context mContext;
private int mSubId;
@@ -68,22 +72,30 @@ public class WifiCallingQueryImsState extends ImsQueryController {
SubscriptionUtil.getPhoneId(mContext, subId));
}
/**
* Check whether Wifi Calling is a supported feature on this subscription
*
* @return true when Wifi Calling is a supported feature, otherwise false
*/
public boolean isWifiCallingSupported() {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
try {
return isEnabledByPlatform(mSubId);
} catch (InterruptedException | IllegalArgumentException | ImsException exception) {
Log.w(LOG_TAG, "fail to get WFC supporting status. subId=" + mSubId, exception);
}
return false;
}
/**
* Check whether Wifi Calling has been provisioned or not on this subscription
*
* @return true when Wifi Calling has been enabled, otherwise false
*/
public boolean isWifiCallingProvisioned() {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
final ImsManager imsManager = getImsManager(mSubId);
if (imsManager == null) {
return false;
}
return imsManager.isWfcEnabledByPlatform()
&& isProvisionedOnDevice(mSubId);
return isWifiCallingSupported() && isProvisionedOnDevice(mSubId);
}
/**

View File

@@ -419,7 +419,7 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
updateBody();
if (mImsManager.isWfcEnabledByPlatform()) {
if (queryImsState(mSubId).isWifiCallingSupported()) {
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
mSwitchBar.addOnSwitchChangeListener(this);