mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-05-03 15:26:27 +00:00
Added wake lock at startup
This commit is contained in:
parent
823b88b93e
commit
541d3d989c
1 changed files with 17 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ package org.linphone
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.PowerManager
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import coil.ImageLoaderFactory
|
import coil.ImageLoaderFactory
|
||||||
import coil.decode.GifDecoder
|
import coil.decode.GifDecoder
|
||||||
|
|
@ -47,6 +48,13 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val powerManager = context.getSystemService(POWER_SERVICE) as PowerManager
|
||||||
|
val wakeLock = powerManager.newWakeLock(
|
||||||
|
PowerManager.PARTIAL_WAKE_LOCK,
|
||||||
|
"Linphone:AppCreation"
|
||||||
|
)
|
||||||
|
wakeLock.acquire(20000L) // 20 seconds
|
||||||
|
|
||||||
Factory.instance().setLogCollectionPath(context.filesDir.absolutePath)
|
Factory.instance().setLogCollectionPath(context.filesDir.absolutePath)
|
||||||
Factory.instance().enableLogCollection(LogCollectionState.Enabled)
|
Factory.instance().enableLogCollection(LogCollectionState.Enabled)
|
||||||
|
|
||||||
|
|
@ -74,6 +82,7 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i("[Application] Core config & preferences created")
|
Log.i("[Application] Core config & preferences created")
|
||||||
|
wakeLock.release()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ensureCoreExists(
|
fun ensureCoreExists(
|
||||||
|
|
@ -88,6 +97,13 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val powerManager = context.getSystemService(POWER_SERVICE) as PowerManager
|
||||||
|
val wakeLock = powerManager.newWakeLock(
|
||||||
|
PowerManager.PARTIAL_WAKE_LOCK,
|
||||||
|
"Linphone:EnsureCoreExists"
|
||||||
|
)
|
||||||
|
wakeLock.acquire(20000L) // 20 seconds
|
||||||
|
|
||||||
Log.i(
|
Log.i(
|
||||||
"[Application] Core context is being created ${if (pushReceived) "from push" else ""}"
|
"[Application] Core context is being created ${if (pushReceived) "from push" else ""}"
|
||||||
)
|
)
|
||||||
|
|
@ -100,6 +116,7 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
||||||
if (!skipCoreStart) {
|
if (!skipCoreStart) {
|
||||||
coreContext.start()
|
coreContext.start()
|
||||||
}
|
}
|
||||||
|
wakeLock.release()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue