diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt index 8c9890a65..41b2d349b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt @@ -34,7 +34,11 @@ class SafetynetViewModel( .subscribeK { resolveResponse(it.responseCode) } .add() - attest() + if (safetyNetResult >= 0) { + resolveResponse(safetyNetResult) + } else { + attest() + } } override fun notifyStateChanged() { @@ -56,6 +60,7 @@ class SafetynetViewModel( val hasCtsPassed = response and SafetyNetHelper.CTS_PASS != 0 val hasBasicIntegrityPassed = response and SafetyNetHelper.BASIC_PASS != 0 val result = hasCtsPassed && hasBasicIntegrityPassed + safetyNetResult = response ctsState.value = hasCtsPassed basicIntegrityState.value = hasBasicIntegrityPassed currentState = if (result) PASS else FAILED @@ -80,4 +85,8 @@ class SafetynetViewModel( } } + companion object { + private var safetyNetResult = -1 + } + } \ No newline at end of file