Fix root server crash on certain LG Android 8.1 devices

See also: https://github.com/Chainfire/librootjava/issues/20
This commit is contained in:
Mygod
2020-07-29 03:49:58 +08:00
parent 63060a17d7
commit b8ba293ee0
3 changed files with 6 additions and 5 deletions

View File

@@ -11,9 +11,10 @@ import timber.log.Timber
@SuppressLint("LogNotTimber")
object Services {
lateinit var context: Context
fun init(context: Context) {
this.context = context
private lateinit var contextInit: () -> Context
val context by lazy { contextInit() }
fun init(context: () -> Context) {
contextInit = context
}
val connectivity by lazy { context.getSystemService<ConnectivityManager>()!! }