Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ed862da authored by joonhunshin's avatar joonhunshin Committed by Joonhun Shin
Browse files

Add try/catch to handle UnsupportedOperationException

TelephonyManager#getCdmaEnhancedRoamingIndicatorDisplayNumber() throws UnsupportedOperationException when the device does not have the feature android.hardware.telephony.cdma

Flag: NONE
Bug: 297989574
Test: oriole with ATT SIM, boot completed
Change-Id: I7603bb6ba0970463fed508a4ff6a2310be5c5fea
parent c57b841e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -325,8 +325,13 @@ class MobileConnectionRepositoryImpl(
    override val cdmaRoaming: StateFlow<Boolean> =
        telephonyPollingEvent
            .mapLatest {
                try {
                    val cdmaEri = telephonyManager.cdmaEnhancedRoamingIndicatorDisplayNumber
                    cdmaEri == ERI_ON || cdmaEri == ERI_FLASH
                } catch (e: UnsupportedOperationException) {
                    // Handles the same as a function call failure
                    false
                }
            }
            .stateIn(scope, SharingStarted.WhileSubscribed(), false)