diff options
2 files changed, 9 insertions, 13 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 2efc0579f333..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 @@ -192,20 +192,16 @@ constructor( override val isDeviceEmergencyCallCapable: StateFlow<Boolean> = serviceStateChangedEvent .mapLatest { - val modems = telephonyManager.activeModemCount - - // Assume false for automotive devices which don't have the calling feature. - // TODO: b/398045526 to revisit the below. - val isAutomotive: Boolean = - context.packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) - val hasFeatureCalling: Boolean = + // TODO(b/400460777): check for hasSystemFeature only once + val hasRadioAccess: Boolean = context.packageManager.hasSystemFeature( - PackageManager.FEATURE_TELEPHONY_CALLING + PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS ) - if (isAutomotive && !hasFeatureCalling) { + 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 (0..<modems) |