diff options
2 files changed, 14 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java index dcbacec5b630..c880f057f44a 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java @@ -203,7 +203,9 @@ public class CarrierTextManager { CarrierTextManagerLogger logger) { mContext = context; - mIsEmergencyCallCapable = telephonyManager.isVoiceCapable(); + boolean hasTelephony = mContext.getPackageManager() + .hasSystemFeature(PackageManager.FEATURE_TELEPHONY); + mIsEmergencyCallCapable = telephonyManager.isVoiceCapable() && hasTelephony; mShowAirplaneMode = showAirplaneMode; mShowMissingSim = showMissingSim; @@ -221,9 +223,7 @@ public class CarrierTextManager { mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLogger = logger; mBgExecutor.execute(() -> { - boolean supported = mContext.getPackageManager() - .hasSystemFeature(PackageManager.FEATURE_TELEPHONY); - if (supported && mNetworkSupported.compareAndSet(false, supported)) { + if (hasTelephony && mNetworkSupported.compareAndSet(false, hasTelephony)) { // This will set/remove the listeners appropriately. Note that it will never double // add the listeners. handleSetListening(mCarrierTextCallback); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt index d3369033942e..d6105c2bd93f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt @@ -20,6 +20,7 @@ import android.annotation.SuppressLint import android.content.Context import android.content.Intent import android.content.IntentFilter +import android.content.pm.PackageManager import android.telephony.CarrierConfigManager import android.telephony.SubscriptionInfo import android.telephony.SubscriptionManager @@ -191,6 +192,15 @@ constructor( override val isDeviceEmergencyCallCapable: StateFlow<Boolean> = serviceStateChangedEvent .mapLatest { + // TODO(b/400460777): check for hasSystemFeature only once + val hasRadioAccess: Boolean = + context.packageManager.hasSystemFeature( + PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS + ) + if (!hasRadioAccess) { + return@mapLatest false + } + val modems = telephonyManager.activeModemCount // Check the service state for every modem. If any state reports emergency calling // capable, then consider the device to have emergency call capabilities |