|
@@ -47,6 +47,7 @@ import com.example.modifier.utils.genICCID
|
|
|
import com.example.modifier.utils.genIMEI
|
|
import com.example.modifier.utils.genIMEI
|
|
|
import com.example.modifier.utils.genIMSI
|
|
import com.example.modifier.utils.genIMSI
|
|
|
import com.example.modifier.utils.genMacAddress
|
|
import com.example.modifier.utils.genMacAddress
|
|
|
|
|
+import com.example.modifier.utils.genSerialNo
|
|
|
import com.example.modifier.utils.getContext
|
|
import com.example.modifier.utils.getContext
|
|
|
import com.example.modifier.utils.isOldVersion
|
|
import com.example.modifier.utils.isOldVersion
|
|
|
import com.example.modifier.utils.resetAll
|
|
import com.example.modifier.utils.resetAll
|
|
@@ -393,7 +394,7 @@ class TaskRunner(
|
|
|
Log.i(TAG, "waitForRcsState: $resetSuccess")
|
|
Log.i(TAG, "waitForRcsState: $resetSuccess")
|
|
|
appStateRepo.resetRequestedNum()
|
|
appStateRepo.resetRequestedNum()
|
|
|
if (resetSuccess) {
|
|
if (resetSuccess) {
|
|
|
- delay(1000)
|
|
|
|
|
|
|
+ delay(3000)
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -403,7 +404,7 @@ class TaskRunner(
|
|
|
// shellRun("rm /data/adb/pif.json")
|
|
// shellRun("rm /data/adb/pif.json")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private suspend fun requestNumberAtomic(store: Boolean? = false, reset: Boolean = false) {
|
|
|
|
|
|
|
+ private suspend fun requestNumberAtomic(store: Boolean? = false) {
|
|
|
appStateRepo.updateRuntimeFlags(reqState = ReqState.REQUEST)
|
|
appStateRepo.updateRuntimeFlags(reqState = ReqState.REQUEST)
|
|
|
gmsgStateRepo.updateRcsState(RcsConfigureState.NOT_CONFIGURED)
|
|
gmsgStateRepo.updateRcsState(RcsConfigureState.NOT_CONFIGURED)
|
|
|
val device = DeviceApi.getDevice(appPrefsRepo.appPrefs.value.id)
|
|
val device = DeviceApi.getDevice(appPrefsRepo.appPrefs.value.id)
|
|
@@ -441,12 +442,6 @@ class TaskRunner(
|
|
|
rootAid = genAndroidId(),
|
|
rootAid = genAndroidId(),
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
- shellRun(CMD_MESSAGING_APP)
|
|
|
|
|
-
|
|
|
|
|
- if (rcsNumber.expiryTime.isBefore(LocalDateTime.now())) {
|
|
|
|
|
- throw RequestNumberException(ErrorCode.CODE_NUMBER_EXPIRED)
|
|
|
|
|
- }
|
|
|
|
|
val tosAgreeJob = CoroutineScope(coroutineContext).launch {
|
|
val tosAgreeJob = CoroutineScope(coroutineContext).launch {
|
|
|
run tos@{
|
|
run tos@{
|
|
|
repeat(60 * 1000 / 200) {
|
|
repeat(60 * 1000 / 200) {
|
|
@@ -460,6 +455,10 @@ class TaskRunner(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ shellRun(CMD_MESSAGING_APP)
|
|
|
|
|
+ if (rcsNumber.expiryTime.isBefore(LocalDateTime.now())) {
|
|
|
|
|
+ throw RequestNumberException(ErrorCode.CODE_NUMBER_EXPIRED)
|
|
|
|
|
+ }
|
|
|
var sendOtpTimeout =
|
|
var sendOtpTimeout =
|
|
|
ChronoUnit.SECONDS.between(LocalDateTime.now(), rcsNumber.expiryTime).seconds
|
|
ChronoUnit.SECONDS.between(LocalDateTime.now(), rcsNumber.expiryTime).seconds
|
|
|
if (sendOtpTimeout < 5.seconds) {
|
|
if (sendOtpTimeout < 5.seconds) {
|
|
@@ -468,9 +467,6 @@ class TaskRunner(
|
|
|
if (sendOtpTimeout > 2.minutes) {
|
|
if (sendOtpTimeout > 2.minutes) {
|
|
|
sendOtpTimeout = 2.minutes
|
|
sendOtpTimeout = 2.minutes
|
|
|
}
|
|
}
|
|
|
- if (reset) {
|
|
|
|
|
- reset(mock = false)
|
|
|
|
|
- }
|
|
|
|
|
if (gmsgStateRepo.waitForRcsState(
|
|
if (gmsgStateRepo.waitForRcsState(
|
|
|
arrayOf(RcsConfigureState.WAITING_FOR_OTP),
|
|
arrayOf(RcsConfigureState.WAITING_FOR_OTP),
|
|
|
sendOtpTimeout
|
|
sendOtpTimeout
|
|
@@ -581,9 +577,12 @@ class TaskRunner(
|
|
|
needRest = needRest || appStateRepo.appState.value.requestedNum >= 5
|
|
needRest = needRest || appStateRepo.appState.value.requestedNum >= 5
|
|
|
|| spoofedInfoRepo.spoofedInfo.value.available
|
|
|| spoofedInfoRepo.spoofedInfo.value.available
|
|
|
needRest = needRest && !appPrefsRepo.appPrefs.value.preventReset
|
|
needRest = needRest && !appPrefsRepo.appPrefs.value.preventReset
|
|
|
|
|
+ if (needRest) {
|
|
|
|
|
+ reset()
|
|
|
|
|
+ needRest = false
|
|
|
|
|
+ }
|
|
|
appStateRepo.incrementRequestedNum()
|
|
appStateRepo.incrementRequestedNum()
|
|
|
- requestNumberAtomic(reset = needRest)
|
|
|
|
|
- needRest = false
|
|
|
|
|
|
|
+ requestNumberAtomic()
|
|
|
return@withTimeoutOrNull true
|
|
return@withTimeoutOrNull true
|
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
|
if (e is RequestNumberException) {
|
|
if (e is RequestNumberException) {
|