Skip to content

Commit

Permalink
Merge branch 'hotfix/5.200.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
CDRussell committed May 14, 2024
2 parents 886d06e + af5a4ce commit 7a862b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ import android.content.Context
import android.util.Log
import androidx.lifecycle.LifecycleOwner
import com.duckduckgo.app.browser.customtabs.CustomTabDetector
import com.duckduckgo.app.di.AppCoroutineScope
import com.duckduckgo.app.di.IsMainProcess
import com.duckduckgo.app.lifecycle.MainProcessLifecycleObserver
import com.duckduckgo.appbuildconfig.api.AppBuildConfig
import com.duckduckgo.appbuildconfig.api.isInternalBuild
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.library.loader.LibraryLoader
import com.squareup.anvil.annotations.ContributesMultibinding
import dagger.SingleInstanceIn
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import logcat.LogPriority.ERROR
import logcat.asLog
import logcat.logcat
Expand All @@ -44,6 +49,8 @@ class NativeCrashInit @Inject constructor(
private val customTabDetector: CustomTabDetector,
private val appBuildConfig: AppBuildConfig,
private val nativeCrashFeature: NativeCrashFeature,
private val dispatcherProvider: DispatcherProvider,
@AppCoroutineScope private val coroutineScope: CoroutineScope,
) : MainProcessLifecycleObserver {

private val isCustomTab: Boolean by lazy { customTabDetector.isCustomTab() }
Expand All @@ -61,15 +68,17 @@ class NativeCrashInit @Inject constructor(

override fun onCreate(owner: LifecycleOwner) {
if (isMainProcess) {
jniRegisterNativeSignalHandler()
coroutineScope.launch {
jniRegisterNativeSignalHandler()
}
} else {
logcat(ERROR) { "ndk-crash: onCreate wrongly called in a secondary process" }
}
}

private fun jniRegisterNativeSignalHandler() {
private suspend fun jniRegisterNativeSignalHandler() = withContext(dispatcherProvider.io()) {
runCatching {
if (!nativeCrashFeature.nativeCrashHandling().isEnabled()) return
if (!nativeCrashFeature.nativeCrashHandling().isEnabled()) return@withContext

val logLevel = if (appBuildConfig.isDebug || appBuildConfig.isInternalBuild()) {
Log.VERBOSE
Expand Down
2 changes: 1 addition & 1 deletion app/version/version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=5.200.0
VERSION=5.200.1

0 comments on commit 7a862b3

Please sign in to comment.