mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Implement session-based account registration API.
This commit is contained in:
committed by
Greyson Parrelli
parent
3de17fa2d0
commit
a47e3900c1
@@ -0,0 +1,28 @@
|
||||
package org.thoughtcrime.securesms.util.dualsim
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS
|
||||
import android.telephony.TelephonyManager
|
||||
import androidx.core.content.ContextCompat
|
||||
|
||||
/**
|
||||
* The mobile country code consists of three decimal digits and the mobile network code consists of two or three decimal digits.
|
||||
*/
|
||||
class MccMncProducer(context: Context) {
|
||||
var mcc: String? = null
|
||||
private set
|
||||
var mnc: String? = null
|
||||
private set
|
||||
|
||||
init {
|
||||
if (context.packageManager.hasSystemFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) {
|
||||
val tel = ContextCompat.getSystemService(context, TelephonyManager::class.java)
|
||||
val networkOperator = tel?.networkOperator
|
||||
|
||||
if (networkOperator?.isNotBlank() == true && networkOperator.length >= 5) {
|
||||
mcc = networkOperator.substring(0, 3)
|
||||
mnc = networkOperator.substring(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user