MotoNrEnabler: fix null check of getSystemService after U QPR2
Change-Id: Iec4852986457495ca15c94d9f7e425c999f85a60
This commit is contained in:
parent
3dc348ff37
commit
946de82195
@ -13,7 +13,6 @@ import android.content.IntentFilter
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.telephony.CarrierConfigManager
|
import android.telephony.CarrierConfigManager
|
||||||
import android.telephony.SubscriptionInfo
|
|
||||||
import android.telephony.SubscriptionManager
|
import android.telephony.SubscriptionManager
|
||||||
import android.telephony.TelephonyManager
|
import android.telephony.TelephonyManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
@ -82,7 +81,8 @@ class NrEnablerService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun validatePhoneId(phoneId: Int): Boolean {
|
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
|
return phoneId in 0 until phoneCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user