Merge "[Settings] Should not show WFC UI in the SIM page if the SIM does not support WFC" into udc-dev am: 7a492b4098

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22135681

Change-Id: I39c3301843e4c8c264ef8bda471f916424b7d04f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Zoey Chen
2023-03-20 11:04:21 +00:00
committed by Automerger Merge Worker
4 changed files with 10 additions and 22 deletions

View File

@@ -949,7 +949,12 @@ public class MobileNetworkUtils {
boolean isWifiCallingEnabled; boolean isWifiCallingEnabled;
if (phoneAccountHandle != null) { if (phoneAccountHandle != null) {
final Intent intent = buildPhoneAccountConfigureIntent(context, phoneAccountHandle); final Intent intent = buildPhoneAccountConfigureIntent(context, phoneAccountHandle);
isWifiCallingEnabled = intent != null; if (intent == null) {
Log.d(TAG, "Can not get phoneAccount configure intent.");
isWifiCallingEnabled = false;
} else {
isWifiCallingEnabled = true;
}
} else { } else {
if (queryImsState == null) { if (queryImsState == null) {
queryImsState = new WifiCallingQueryImsState(context, subId); queryImsState = new WifiCallingQueryImsState(context, subId);
@@ -959,7 +964,6 @@ public class MobileNetworkUtils {
return isWifiCallingEnabled; return isWifiCallingEnabled;
} }
/** /**
* Returns preferred status of Calls & SMS separately when Provider Model is enabled. * Returns preferred status of Calls & SMS separately when Provider Model is enabled.
*/ */

View File

@@ -314,29 +314,13 @@ public class NetworkProviderWifiCallingGroup extends
@VisibleForTesting @VisibleForTesting
protected boolean shouldShowWifiCallingForSub(int subId) { protected boolean shouldShowWifiCallingForSub(int subId) {
if (SubscriptionManager.isValidSubscriptionId(subId) if (SubscriptionManager.isValidSubscriptionId(subId)
&& MobileNetworkUtils.isWifiCallingEnabled( && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, queryImsState(subId),
mContext, subId, queryImsState(subId), null)) {
getPhoneAccountHandleForSubscriptionId(subId))
&& isWifiCallingAvailableForCarrier(subId)) {
return true; return true;
} }
return false; return false;
} }
private boolean isWifiCallingAvailableForCarrier(int subId) {
boolean isWifiCallingAvailableForCarrier = false;
if (mCarrierConfigManager != null) {
final PersistableBundle carrierConfig =
mCarrierConfigManager.getConfigForSubId(subId);
if (carrierConfig != null) {
isWifiCallingAvailableForCarrier = carrierConfig.getBoolean(
CarrierConfigManager.KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL);
}
}
Log.d(TAG, "isWifiCallingAvailableForCarrier:" + isWifiCallingAvailableForCarrier);
return isWifiCallingAvailableForCarrier;
}
@Override @Override
public String getPreferenceKey() { public String getPreferenceKey() {
return KEY_PREFERENCE_WIFICALLING_GROUP; return KEY_PREFERENCE_WIFICALLING_GROUP;

View File

@@ -25,7 +25,6 @@ import android.provider.Settings;
import android.telecom.PhoneAccountHandle; import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager; import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager; import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback; import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;

View File

@@ -257,7 +257,8 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
for (SubscriptionInfo subInfo : subInfoList) { for (SubscriptionInfo subInfo : subInfoList) {
int subId = subInfo.getSubscriptionId(); int subId = subInfo.getSubscriptionId();
try { try {
if (queryImsState(subId).isWifiCallingProvisioned()) { if (MobileNetworkUtils.isWifiCallingEnabled(getContext(), subId,
queryImsState(subId), null)) {
selectedList.add(subInfo); selectedList.add(subInfo);
} }
} catch (Exception exception) {} } catch (Exception exception) {}