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:
@@ -48,7 +48,7 @@ class App : Application() {
|
|||||||
deviceStorage.moveSharedPreferencesFrom(this, PreferenceManager(this).sharedPreferencesName)
|
deviceStorage.moveSharedPreferencesFrom(this, PreferenceManager(this).sharedPreferencesName)
|
||||||
deviceStorage.moveDatabaseFrom(this, AppDatabase.DB_NAME)
|
deviceStorage.moveDatabaseFrom(this, AppDatabase.DB_NAME)
|
||||||
} else deviceStorage = this
|
} else deviceStorage = this
|
||||||
Services.init(this)
|
Services.init { this }
|
||||||
|
|
||||||
// overhead of debug mode is minimal: https://github.com/Kotlin/kotlinx.coroutines/blob/f528898/docs/debugging.md#debug-mode
|
// overhead of debug mode is minimal: https://github.com/Kotlin/kotlinx.coroutines/blob/f528898/docs/debugging.md#debug-mode
|
||||||
System.setProperty(DEBUG_PROPERTY_NAME, DEBUG_PROPERTY_VALUE_ON)
|
System.setProperty(DEBUG_PROPERTY_NAME, DEBUG_PROPERTY_VALUE_ON)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ object RootManager : RootSession() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Services.init(systemContext)
|
Services.init { systemContext }
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ import timber.log.Timber
|
|||||||
|
|
||||||
@SuppressLint("LogNotTimber")
|
@SuppressLint("LogNotTimber")
|
||||||
object Services {
|
object Services {
|
||||||
lateinit var context: Context
|
private lateinit var contextInit: () -> Context
|
||||||
fun init(context: Context) {
|
val context by lazy { contextInit() }
|
||||||
this.context = context
|
fun init(context: () -> Context) {
|
||||||
|
contextInit = context
|
||||||
}
|
}
|
||||||
|
|
||||||
val connectivity by lazy { context.getSystemService<ConnectivityManager>()!! }
|
val connectivity by lazy { context.getSystemService<ConnectivityManager>()!! }
|
||||||
|
|||||||
Reference in New Issue
Block a user