mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added wake lock at startup
This commit is contained in:
parent
d5d3cc0bc2
commit
e562f1505d
1 changed files with 9 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ package org.linphone
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import android.os.PowerManager
|
||||||
import androidx.annotation.MainThread
|
import androidx.annotation.MainThread
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import coil.ImageLoaderFactory
|
import coil.ImageLoaderFactory
|
||||||
|
|
@ -57,6 +58,13 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
val context = applicationContext
|
val context = applicationContext
|
||||||
|
|
||||||
|
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)
|
||||||
// For VFS
|
// For VFS
|
||||||
|
|
@ -87,6 +95,7 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
||||||
coreContext.start()
|
coreContext.start()
|
||||||
|
|
||||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||||
|
wakeLock.release()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTrimMemory(level: Int) {
|
override fun onTrimMemory(level: Int) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue