java: Append space character to device model name

This bypasses Google's new device-based hardware attestation enforcement
as of September 2, 2021.
This commit is contained in:
Danny Lin 2021-09-06 03:43:04 -07:00
parent 35d705eb8a
commit 2f56b7320c
No known key found for this signature in database
GPG Key ID: 1988FAA1797EE5AC
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,13 @@
package dev.kdrag0n.safetynetriru
import android.os.Build
internal object BuildHooks {
fun init() {
// Append a space to the device model name
Build::class.java.getDeclaredField("MODEL").let { field ->
field.isAccessible = true
field.set(null, Build.MODEL + " ")
}
}
}

View File

@ -5,8 +5,9 @@ object EntryPoint {
@JvmStatic
fun init() {
runCatching {
logDebug("Entry point: Initializing SafetyNet patch")
logDebug("Entry point: Initializing SafetyNet patches")
SecurityBridge.init()
BuildHooks.init()
}.recoverCatching { e ->
// Throwing an exception would require the JNI code to handle exceptions, so just catch
// everything here.