@@ -11,8 +11,6 @@ import android.os.Looper
1111import android.provider.ContactsContract
1212import android.telecom.Call
1313import android.telecom.TelecomManager
14- import android.telephony.SubscriptionManager
15- import android.telephony.TelephonyManager
1614import android.widget.Toast
1715import androidx.annotation.RequiresPermission
1816import androidx.core.app.ActivityCompat
@@ -27,12 +25,6 @@ import kotlinx.coroutines.launch
2725import kotlinx.coroutines.runBlocking
2826import kotlinx.coroutines.selects.onTimeout
2927import kotlinx.coroutines.selects.select
30- import kotlinx.coroutines.withContext
31- import okhttp3.OkHttpClient
32- import okhttp3.Request
33- import org.jsoup.Jsoup
34- import java.io.IOException
35- import java.util.Locale
3628import java.util.concurrent.atomic.AtomicInteger
3729import java.util.logging.Logger
3830
@@ -61,7 +53,10 @@ class SpamUtils {
6153 details.intentExtras != null -> {
6254 val uri =
6355 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
64- details.intentExtras.getParcelable(TelecomManager .EXTRA_INCOMING_CALL_ADDRESS , Uri ::class .java)
56+ details.intentExtras.getParcelable(
57+ TelecomManager .EXTRA_INCOMING_CALL_ADDRESS ,
58+ Uri ::class .java
59+ )
6560 } else {
6661 @Suppress(" DEPRECATION" )
6762 details.intentExtras.getParcelable(TelecomManager .EXTRA_INCOMING_CALL_ADDRESS )
@@ -300,7 +295,7 @@ class SpamUtils {
300295 val start = System .currentTimeMillis()
301296 val result = runCatching { checker(number) }.getOrDefault(false )
302297 val elapsed = System .currentTimeMillis() - start
303-
298+
304299 Logger .getLogger(" SpamUtils" ).info(
305300 " Spam checker for $number completed in ${elapsed} ms, result: $result "
306301 )
@@ -363,12 +358,12 @@ class SpamUtils {
363358
364359 return try {
365360 val parsedNumber = phoneNumberUtil.parse(phoneNumber, null ) // Safe parsing
366-
361+
367362 val simCountry = CountryLanguageUtils .getSimCountry(context).uppercase()
368-
363+
369364 val countryCode = phoneNumberUtil.getCountryCodeForRegion(simCountry)
370365 parsedNumber.countryCode != countryCode // True if international
371-
366+
372367 } catch (e: Exception ) {
373368 e.printStackTrace()
374369 false
@@ -384,7 +379,7 @@ class SpamUtils {
384379 private fun normalizePhoneNumber (number : String ): String {
385380 return number.replace(" \\ D" .toRegex(), " " )
386381 }
387-
382+
388383 /* *
389384 * Checks if a phone number exists in the device's contact agenda.
390385 *
@@ -408,7 +403,7 @@ class SpamUtils {
408403 ContactsContract .PhoneLookup .CONTENT_FILTER_URI ,
409404 Uri .encode(phoneNumber)
410405 )
411-
406+
412407 var cursor: Cursor ? = null
413408 try {
414409 cursor = context.contentResolver.query(
0 commit comments