From 09ebb7e63b24cead95d8074b8e1b6ca7dedf483b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 28 Jul 2020 11:22:47 +0200 Subject: [PATCH] Improved some logs --- app/src/main/java/org/linphone/LinphoneApplication.kt | 5 +++-- .../main/java/org/linphone/contact/NativeContactEditor.kt | 2 +- app/src/main/java/org/linphone/core/CorePushReceiver.kt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/linphone/LinphoneApplication.kt b/app/src/main/java/org/linphone/LinphoneApplication.kt index 306355be5..8a59d4d96 100644 --- a/app/src/main/java/org/linphone/LinphoneApplication.kt +++ b/app/src/main/java/org/linphone/LinphoneApplication.kt @@ -32,8 +32,9 @@ class LinphoneApplication : Application() { lateinit var corePreferences: CorePreferences lateinit var coreContext: CoreContext - fun ensureCoreExists(context: Context) { + fun ensureCoreExists(context: Context, pushReceived: Boolean = false) { if (::coreContext.isInitialized && !coreContext.stopped) { + Log.d("[Application] Skipping Core creation (push received? $pushReceived)") return } @@ -49,7 +50,7 @@ class LinphoneApplication : Application() { val appName = context.getString(R.string.app_name) Factory.instance().setDebugMode(corePreferences.debugLogs, appName) - Log.i("[Application] Core context created") + Log.i("[Application] Core context created ${if (pushReceived) "from push" else ""}") coreContext = CoreContext(context, config) coreContext.start() } diff --git a/app/src/main/java/org/linphone/contact/NativeContactEditor.kt b/app/src/main/java/org/linphone/contact/NativeContactEditor.kt index 8d5d3d922..3da2d7b91 100644 --- a/app/src/main/java/org/linphone/contact/NativeContactEditor.kt +++ b/app/src/main/java/org/linphone/contact/NativeContactEditor.kt @@ -66,7 +66,7 @@ class NativeContactEditor( private var pictureByteArray: ByteArray? = null init { - Log.i("[Native Contact Editor] Using sync account $syncAccountName with type $syncAccountType") + Log.d("[Native Contact Editor] Using sync account $syncAccountName with type $syncAccountType") val contentResolver = coreContext.context.contentResolver val cursor = contentResolver.query( RawContacts.CONTENT_URI, diff --git a/app/src/main/java/org/linphone/core/CorePushReceiver.kt b/app/src/main/java/org/linphone/core/CorePushReceiver.kt index a4d76af39..96f82aff6 100644 --- a/app/src/main/java/org/linphone/core/CorePushReceiver.kt +++ b/app/src/main/java/org/linphone/core/CorePushReceiver.kt @@ -27,7 +27,7 @@ import org.linphone.core.tools.Log class CorePushReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { - ensureCoreExists(context.applicationContext) + ensureCoreExists(context.applicationContext, true) Log.i("[Push Receiver] Push notification received") } }