diff options
author | 2025-03-03 21:29:39 -0800 | |
---|---|---|
committer | 2025-03-03 21:29:39 -0800 | |
commit | bb8c4aed7c73f8afd17cc9514964c37b5c4fe6c8 (patch) | |
tree | 3f1f5a704a4b67a95cea958b3d390753b443031a | |
parent | ffb1312e0ba59be37a5c95fee4456442b4883ee0 (diff) | |
parent | d0cc705196b4fb02570f0489ec9cbe85d0cd1fd1 (diff) |
Merge changes Ia402e0f5,I3b5ef470 into main
* changes:
Check for telephony features before using their APIs
Revert "Return false for emergency calls for automotive"
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) |