mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Do not start keep alive service as foreground yet, wait for it to be started
This commit is contained in:
parent
5689557487
commit
87f4ebbd4c
4 changed files with 2 additions and 31 deletions
|
|
@ -23,8 +23,6 @@ import android.app.Activity
|
|||
import android.app.Notification
|
||||
import android.app.PictureInPictureParams
|
||||
import android.app.Service
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.provider.MediaStore
|
||||
import org.linphone.core.tools.Log
|
||||
|
|
@ -45,10 +43,6 @@ class Api28Compatibility {
|
|||
}
|
||||
}
|
||||
|
||||
fun startForegroundService(context: Context, intent: Intent) {
|
||||
context.startForegroundService(intent)
|
||||
}
|
||||
|
||||
fun enterPipMode(activity: Activity): Boolean {
|
||||
val params = PictureInPictureParams.Builder()
|
||||
.setAspectRatio(AppUtils.getPipRatio(activity))
|
||||
|
|
|
|||
|
|
@ -20,11 +20,9 @@
|
|||
package org.linphone.compatibility
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ForegroundServiceStartNotAllowedException
|
||||
import android.app.PictureInPictureParams
|
||||
import android.app.UiModeManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.RenderEffect
|
||||
import android.graphics.Shader
|
||||
import android.os.Build
|
||||
|
|
@ -82,18 +80,6 @@ class Api31Compatibility {
|
|||
uiManager?.setApplicationNightMode(UiModeManager.MODE_NIGHT_AUTO)
|
||||
}
|
||||
|
||||
fun startForegroundService(context: Context, intent: Intent) {
|
||||
try {
|
||||
context.startForegroundService(intent)
|
||||
} catch (fssnae: ForegroundServiceStartNotAllowedException) {
|
||||
Log.e("$TAG Can't start service as foreground! $fssnae")
|
||||
} catch (se: SecurityException) {
|
||||
Log.e("$TAG Can't start service as foreground! $se")
|
||||
} catch (e: Exception) {
|
||||
Log.e("$TAG Can't start service as foreground! $e")
|
||||
}
|
||||
}
|
||||
|
||||
fun getRecordingsDirectory(): String {
|
||||
return Environment.DIRECTORY_RECORDINGS
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,14 +62,6 @@ class Compatibility {
|
|||
}
|
||||
}
|
||||
|
||||
fun startForegroundService(context: Context, intent: Intent) {
|
||||
if (Version.sdkAboveOrEqual(Version.API31_ANDROID_12)) {
|
||||
Api31Compatibility.startForegroundService(context, intent)
|
||||
} else {
|
||||
Api28Compatibility.startForegroundService(context, intent)
|
||||
}
|
||||
}
|
||||
|
||||
fun setBlurRenderEffect(view: View) {
|
||||
if (Version.sdkAboveOrEqual(Version.API31_ANDROID_12)) {
|
||||
Api31Compatibility.setBlurRenderEffect(view)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import androidx.lifecycle.MutableLiveData
|
|||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import org.linphone.BuildConfig
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.compatibility.Compatibility
|
||||
import org.linphone.contacts.ContactsManager
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.notifications.NotificationsManager
|
||||
|
|
@ -741,8 +740,8 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
context,
|
||||
CoreKeepAliveThirdPartyAccountsService::class.java
|
||||
)
|
||||
Log.i("$TAG Starting Keep alive for third party accounts Service (as foreground)")
|
||||
Compatibility.startForegroundService(context, serviceIntent)
|
||||
Log.i("$TAG Starting Keep alive for third party accounts Service")
|
||||
context.startService(serviceIntent)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue