Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import android.net.Network
import android.net.NetworkCapabilities
import android.net.wifi.WifiManager
import android.os.Build
import android.telephony.SubscriptionManager
import android.telephony.TelephonyManager
import androidx.core.content.ContextCompat
import com.windscribe.vpn.wsnet.WSNetWrapper
Expand Down Expand Up @@ -362,7 +363,18 @@ class DeviceStateManager
try {
val telephonyManager =
context.getSystemService(Context.TELEPHONY_SERVICE) as? TelephonyManager
val operatorName = telephonyManager?.networkOperatorName

val dataSubId =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
SubscriptionManager.getActiveDataSubscriptionId()
} else {
@Suppress("DEPRECATION")
SubscriptionManager.getDefaultDataSubscriptionId()
}

val dataSimTelephonyManager =
telephonyManager?.createForSubscriptionId(dataSubId)
val operatorName = dataSimTelephonyManager?.networkOperatorName
Comment on lines +367 to +377

when {
operatorName.isNullOrBlank() || operatorName == "Unknown" -> {
Expand Down