mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Allow dalvik runtime to load snet
This commit is contained in:
parent
ff8460b361
commit
06dc6df270
@ -9,7 +9,6 @@ import com.topjohnwu.magisk.base.BaseActivity
|
||||
import com.topjohnwu.magisk.base.BaseFragment
|
||||
import com.topjohnwu.magisk.data.repository.MagiskRepository
|
||||
import com.topjohnwu.magisk.databinding.FragmentMagiskBinding
|
||||
import com.topjohnwu.magisk.extensions.inject
|
||||
import com.topjohnwu.magisk.extensions.openUrl
|
||||
import com.topjohnwu.magisk.extensions.subscribeK
|
||||
import com.topjohnwu.magisk.extensions.writeTo
|
||||
@ -21,6 +20,7 @@ import com.topjohnwu.magisk.view.dialogs.*
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import dalvik.system.DexFile
|
||||
import io.reactivex.Completable
|
||||
import org.koin.android.ext.android.inject
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import java.io.File
|
||||
import java.lang.reflect.InvocationHandler
|
||||
@ -33,6 +33,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentMagiskBinding>(),
|
||||
|
||||
private val magiskRepo: MagiskRepository by inject()
|
||||
private val EXT_APK by lazy { File("${activity.filesDir.parent}/snet", "snet.jar") }
|
||||
private val EXT_DEX by lazy { File(EXT_APK.parent, "snet.dex") }
|
||||
|
||||
override fun onResponse(responseCode: Int) = viewModel.finishSafetyNetCheck(responseCode)
|
||||
|
||||
@ -94,7 +95,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentMagiskBinding>(),
|
||||
private fun updateSafetyNet(dieOnError: Boolean) {
|
||||
Completable.fromAction {
|
||||
val loader = DynamicClassLoader(EXT_APK)
|
||||
val dex = DexFile.loadDex(EXT_APK.path, EXT_APK.parent, 0)
|
||||
val dex = DexFile.loadDex(EXT_APK.path, EXT_DEX.path, 0)
|
||||
|
||||
// Scan through the dex and find our helper class
|
||||
var helperClass: Class<*>? = null
|
||||
|
Loading…
Reference in New Issue
Block a user