Improve: Lazy load xorg libraries
This commit is contained in:
parent
4516d9ee2a
commit
5015f9dcba
@ -65,18 +65,21 @@ class SessionComponent : NeoComponent {
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
override fun onServiceInit() {
|
||||
if (!IS_LIBRARIES_LOADED) {
|
||||
synchronized(SessionComponent::class.java) {
|
||||
if (!IS_LIBRARIES_LOADED) {
|
||||
IS_LIBRARIES_LOADED = loadLibraries()
|
||||
private fun checkLibrariesLoaded() {
|
||||
if (!IS_LIBRARIES_LOADED) {
|
||||
synchronized(SessionComponent::class.java) {
|
||||
if (!IS_LIBRARIES_LOADED) {
|
||||
IS_LIBRARIES_LOADED = loadLibraries()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onServiceInit() {
|
||||
}
|
||||
|
||||
override fun onServiceDestroy() {
|
||||
}
|
||||
|
||||
@ -85,6 +88,7 @@ class SessionComponent : NeoComponent {
|
||||
|
||||
fun createSession(context: Context, parameter: XParameter): XSession {
|
||||
if (context is Activity) {
|
||||
checkLibrariesLoaded()
|
||||
return XSession(context, XSessionData())
|
||||
}
|
||||
throw RuntimeException("Creating X sessions requires Activity, but got Context")
|
||||
|
Loading…
Reference in New Issue
Block a user