Skip unblocking for root process
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
package be.mygod.vpnhotspot.root
|
package be.mygod.vpnhotspot.root
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Build
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import be.mygod.librootkotlinx.*
|
import be.mygod.librootkotlinx.*
|
||||||
import be.mygod.vpnhotspot.App.Companion.app
|
import be.mygod.vpnhotspot.App.Companion.app
|
||||||
import be.mygod.vpnhotspot.util.Services
|
import be.mygod.vpnhotspot.util.Services
|
||||||
|
import be.mygod.vpnhotspot.util.UnblockCentral
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ object RootManager : RootSession(), Logger {
|
|||||||
})
|
})
|
||||||
Logger.me = RootManager
|
Logger.me = RootManager
|
||||||
Services.init { systemContext }
|
Services.init { systemContext }
|
||||||
|
if (Build.VERSION.SDK_INT >= 28) UnblockCentral.needInit = false
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ import be.mygod.vpnhotspot.App.Companion.app
|
|||||||
@SuppressLint("BlockedPrivateApi", "DiscouragedPrivateApi")
|
@SuppressLint("BlockedPrivateApi", "DiscouragedPrivateApi")
|
||||||
@Suppress("FunctionName")
|
@Suppress("FunctionName")
|
||||||
object UnblockCentral {
|
object UnblockCentral {
|
||||||
|
var needInit = true
|
||||||
/**
|
/**
|
||||||
* Retrieve this property before doing dangerous shit.
|
* 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)
|
@RequiresApi(31)
|
||||||
fun setUserConfiguration(clazz: Class<*>) = init.let {
|
fun setUserConfiguration(clazz: Class<*>) = init.let {
|
||||||
|
|||||||
Reference in New Issue
Block a user