Skip unblocking for root process

This commit is contained in:
Mygod
2021-12-08 14:02:48 -05:00
parent 1c4a696982
commit b81633b1e7
2 changed files with 5 additions and 1 deletions

View File

@@ -1,11 +1,13 @@
package be.mygod.vpnhotspot.root
import android.annotation.SuppressLint
import android.os.Build
import android.os.Parcelable
import android.util.Log
import be.mygod.librootkotlinx.*
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.UnblockCentral
import kotlinx.parcelize.Parcelize
import timber.log.Timber
@@ -31,6 +33,7 @@ object RootManager : RootSession(), Logger {
})
Logger.me = RootManager
Services.init { systemContext }
if (Build.VERSION.SDK_INT >= 28) UnblockCentral.needInit = false
return null
}
}

View File

@@ -15,10 +15,11 @@ import be.mygod.vpnhotspot.App.Companion.app
@SuppressLint("BlockedPrivateApi", "DiscouragedPrivateApi")
@Suppress("FunctionName")
object UnblockCentral {
var needInit = true
/**
* Retrieve this property before doing dangerous shit.
*/
private val init by lazy { UnblockHelper(app.deviceStorage) }
private val init by lazy { if (needInit) UnblockHelper(app.deviceStorage) }
@RequiresApi(31)
fun setUserConfiguration(clazz: Class<*>) = init.let {