MotoNrEnabler: fix null check of getSystemService after U QPR2

Change-Id: Iec4852986457495ca15c94d9f7e425c999f85a60
This commit is contained in:
dianlujitao 2024-03-21 20:05:49 +08:00
parent 3dc348ff37
commit 946de82195

View File

@ -13,7 +13,6 @@ import android.content.IntentFilter
import android.os.Handler
import android.os.IBinder
import android.telephony.CarrierConfigManager
import android.telephony.SubscriptionInfo
import android.telephony.SubscriptionManager
import android.telephony.TelephonyManager
import android.util.Log
@ -82,7 +81,8 @@ class NrEnablerService : Service() {
}
private fun validatePhoneId(phoneId: Int): Boolean {
val phoneCount = getSystemService(TelephonyManager::class.java).activeModemCount
val phoneCount =
getSystemService(TelephonyManager::class.java)?.activeModemCount ?: return false
return phoneId in 0 until phoneCount
}