|
|
@@ -3,6 +3,7 @@ package com.example.modifier.repo
|
|
|
import android.Manifest
|
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
|
+import android.os.Build
|
|
|
import android.telephony.SubscriptionManager
|
|
|
import android.telephony.TelephonyManager
|
|
|
import android.util.Log
|
|
|
@@ -17,8 +18,6 @@ import com.example.modifier.constants.PACKAGE_GMS
|
|
|
import com.example.modifier.constants.PACKAGE_MESSAGING
|
|
|
import com.example.modifier.constants.SIMView
|
|
|
import com.example.modifier.extension.kill
|
|
|
-import com.example.modifier.extension.resume
|
|
|
-import com.example.modifier.extension.suspend
|
|
|
import com.example.modifier.model.SpoofedSimInfo
|
|
|
import com.example.modifier.utils.ApduChannel
|
|
|
import com.example.modifier.utils.ROOT_ACCESS
|
|
|
@@ -29,9 +28,7 @@ import com.example.modifier.utils.genIMSI
|
|
|
import com.example.modifier.utils.getContext
|
|
|
import com.example.modifier.utils.hasPermission
|
|
|
import com.example.modifier.utils.isOldVersion
|
|
|
-import com.example.modifier.utils.resumePackage
|
|
|
import com.example.modifier.utils.shellRun
|
|
|
-import com.example.modifier.utils.suspendPackage
|
|
|
import kotlinx.coroutines.CoroutineScope
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.delay
|
|
|
@@ -138,10 +135,8 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
shellRun(
|
|
|
*(when {
|
|
|
suspend == true -> arrayOf(
|
|
|
- PACKAGE_GMS.suspend(),
|
|
|
- "sleep 1",
|
|
|
- PACKAGE_MESSAGING.suspend(),
|
|
|
- "sleep 1"
|
|
|
+ PACKAGE_GMS.kill(),
|
|
|
+ PACKAGE_MESSAGING.kill(),
|
|
|
)
|
|
|
|
|
|
else -> emptyArray()
|
|
|
@@ -174,15 +169,16 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
}
|
|
|
}
|
|
|
if (suspend == true) {
|
|
|
- resumePackage(PACKAGE_GMS, PACKAGE_MESSAGING)
|
|
|
+ shellRun(
|
|
|
+ PACKAGE_GMS.kill(),
|
|
|
+ PACKAGE_MESSAGING.kill()
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
if (suspend == true) {
|
|
|
shellRun(
|
|
|
- PACKAGE_GMS.suspend(),
|
|
|
PACKAGE_GMS.kill(),
|
|
|
- PACKAGE_MESSAGING.suspend(),
|
|
|
PACKAGE_MESSAGING.kill()
|
|
|
)
|
|
|
}
|
|
|
@@ -248,19 +244,38 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
apduChannel1.writeMSISDN_USIM(spoofedSimInfo.number)
|
|
|
apduChannel.close()
|
|
|
|
|
|
- telephonyManager.rebootModem()
|
|
|
- delay(10000)
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
+ telephonyManager.rebootModem()
|
|
|
+ }
|
|
|
+
|
|
|
+ val subscriptionManager =
|
|
|
+ context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE) as SubscriptionManager
|
|
|
+
|
|
|
+ run rebootModem@{
|
|
|
+ repeat(20) {
|
|
|
+ runCatching {
|
|
|
+ val activeSubscriptionInfoList =
|
|
|
+ subscriptionManager.activeSubscriptionInfoList
|
|
|
+ activeSubscriptionInfoList?.forEach {
|
|
|
+ Log.i(TAG, "iccid:${it.iccId} target:${spoofedSimInfo.iccid}")
|
|
|
+ if (it.iccId == spoofedSimInfo.iccid) {
|
|
|
+ Log.i(TAG, "rebootModem: success")
|
|
|
+ return@rebootModem
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.onFailure {
|
|
|
+ Log.e(TAG, "Error reading ICCID: ${it.message}", it)
|
|
|
+ }
|
|
|
+ delay(2000)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (suspend == true) {
|
|
|
shellRun(
|
|
|
PACKAGE_GMS.kill(),
|
|
|
+ "sleep 3",
|
|
|
PACKAGE_MESSAGING.kill(),
|
|
|
- PACKAGE_GMS.resume(),
|
|
|
- "sleep 1",
|
|
|
- PACKAGE_MESSAGING.resume(),
|
|
|
- "sleep 1",
|
|
|
- PACKAGE_MESSAGING.resume(),
|
|
|
- "sleep 1"
|
|
|
+ "sleep 3"
|
|
|
)
|
|
|
}
|
|
|
}
|