Merge "Fix settings crashes on missing Telephony features" into main

This commit is contained in:
Tomasz Wasilczyk
2025-02-10 09:20:25 -08:00
committed by Android (Google) Code Review
4 changed files with 27 additions and 5 deletions

View File

@@ -450,8 +450,16 @@ public class SimStatusDialogController implements DefaultLifecycleObserver {
String dataNetworkTypeName = null;
String voiceNetworkTypeName = null;
final int subId = mSubscriptionInfo.getSubscriptionId();
final int actualDataNetworkType = getTelephonyManager().getDataNetworkType();
final int actualVoiceNetworkType = getTelephonyManager().getVoiceNetworkType();
int actualDataNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
int actualVoiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
PackageManager pm = mContext.getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS)) {
actualDataNetworkType = getTelephonyManager().getDataNetworkType();
}
if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CALLING)) {
actualVoiceNetworkType = getTelephonyManager().getVoiceNetworkType();
}
final int overrideNetworkType = mTelephonyDisplayInfo == null
? TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE
: mTelephonyDisplayInfo.getOverrideNetworkType();

View File

@@ -47,6 +47,8 @@ public class ImsQueryEnhanced4gLteModeUserSetting implements ImsQuery {
return imsMmTelManager.isAdvancedCallingSettingEnabled();
} catch (IllegalArgumentException exception) {
Log.w(LOG_TAG, "fail to get VoLte settings. subId=" + mSubId, exception);
} catch (UnsupportedOperationException ex) {
// expected on devices without IMS
}
return false;
}

View File

@@ -112,8 +112,12 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
return CONDITIONALLY_UNAVAILABLE;
}
if (!queryState.isReadyToVoLte()) {
return CONDITIONALLY_UNAVAILABLE;
try {
if (!queryState.isReadyToVoLte()) {
return CONDITIONALLY_UNAVAILABLE;
}
} catch (UnsupportedOperationException ex) {
return UNSUPPORTED_ON_DEVICE;
}
return (isUserControlAllowed(carrierConfig) && queryState.isAllowUserControl())
? AVAILABLE : AVAILABLE_UNSEARCHABLE;