From 6335c85467d4bd14c32507bd6b842c3988df4479 Mon Sep 17 00:00:00 2001 From: F0x1d Date: Thu, 12 Feb 2026 00:03:17 +0300 Subject: [PATCH] fix: java crashes being sometimes concatenated --- .../logfox/feature/crashes/impl/data/reader/ANRDataSource.kt | 4 +--- .../feature/crashes/impl/data/reader/JNICrashDataSource.kt | 4 +--- .../feature/crashes/impl/data/reader/JavaCrashDataSource.kt | 4 +--- .../crashes/impl/data/reader/base/BaseCrashDataSource.kt | 5 +---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/ANRDataSource.kt b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/ANRDataSource.kt index 9c5137d4..c60613fb 100644 --- a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/ANRDataSource.kt +++ b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/ANRDataSource.kt @@ -5,7 +5,6 @@ import com.f0x1d.logfox.feature.crashes.impl.data.AppInfoDataSource import com.f0x1d.logfox.feature.crashes.impl.data.CrashCollectorDataSource import com.f0x1d.logfox.feature.crashes.impl.data.reader.base.BaseCrashDataSource import com.f0x1d.logfox.feature.logging.api.model.LogLine -import com.f0x1d.logfox.feature.preferences.api.data.LogsSettingsRepository import javax.inject.Inject import javax.inject.Singleton @@ -13,8 +12,7 @@ import javax.inject.Singleton internal class ANRDataSource @Inject constructor( appInfoDataSource: AppInfoDataSource, crashCollectorDataSource: CrashCollectorDataSource, - logsSettingsRepository: LogsSettingsRepository, -) : BaseCrashDataSource(appInfoDataSource, crashCollectorDataSource, logsSettingsRepository) { +) : BaseCrashDataSource(appInfoDataSource, crashCollectorDataSource) { override val crashType = CrashType.ANR diff --git a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JNICrashDataSource.kt b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JNICrashDataSource.kt index 52c38dbc..c312b9a2 100644 --- a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JNICrashDataSource.kt +++ b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JNICrashDataSource.kt @@ -5,7 +5,6 @@ import com.f0x1d.logfox.feature.crashes.impl.data.AppInfoDataSource import com.f0x1d.logfox.feature.crashes.impl.data.CrashCollectorDataSource import com.f0x1d.logfox.feature.crashes.impl.data.reader.base.BaseCrashDataSource import com.f0x1d.logfox.feature.logging.api.model.LogLine -import com.f0x1d.logfox.feature.preferences.api.data.LogsSettingsRepository import javax.inject.Inject import javax.inject.Singleton @@ -13,8 +12,7 @@ import javax.inject.Singleton internal class JNICrashDataSource @Inject constructor( appInfoDataSource: AppInfoDataSource, crashCollectorDataSource: CrashCollectorDataSource, - logsSettingsRepository: LogsSettingsRepository, -) : BaseCrashDataSource(appInfoDataSource, crashCollectorDataSource, logsSettingsRepository) { +) : BaseCrashDataSource(appInfoDataSource, crashCollectorDataSource) { override val crashType = CrashType.JNI diff --git a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JavaCrashDataSource.kt b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JavaCrashDataSource.kt index 1791e2b1..7bb9e2f9 100644 --- a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JavaCrashDataSource.kt +++ b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/JavaCrashDataSource.kt @@ -5,7 +5,6 @@ import com.f0x1d.logfox.feature.crashes.impl.data.AppInfoDataSource import com.f0x1d.logfox.feature.crashes.impl.data.CrashCollectorDataSource import com.f0x1d.logfox.feature.crashes.impl.data.reader.base.BaseCrashDataSource import com.f0x1d.logfox.feature.logging.api.model.LogLine -import com.f0x1d.logfox.feature.preferences.api.data.LogsSettingsRepository import javax.inject.Inject import javax.inject.Singleton @@ -13,8 +12,7 @@ import javax.inject.Singleton internal class JavaCrashDataSource @Inject constructor( appInfoDataSource: AppInfoDataSource, crashCollectorDataSource: CrashCollectorDataSource, - logsSettingsRepository: LogsSettingsRepository, -) : BaseCrashDataSource(appInfoDataSource, crashCollectorDataSource, logsSettingsRepository) { +) : BaseCrashDataSource(appInfoDataSource, crashCollectorDataSource) { override val crashType = CrashType.JAVA diff --git a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/base/BaseCrashDataSource.kt b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/base/BaseCrashDataSource.kt index cdf08fa0..f73a0c09 100644 --- a/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/base/BaseCrashDataSource.kt +++ b/feature/crashes/impl/src/main/kotlin/com/f0x1d/logfox/feature/crashes/impl/data/reader/base/BaseCrashDataSource.kt @@ -6,12 +6,10 @@ import com.f0x1d.logfox.feature.crashes.impl.data.AppInfoDataSource import com.f0x1d.logfox.feature.crashes.impl.data.CrashCollectorDataSource import com.f0x1d.logfox.feature.crashes.impl.data.CrashDataSource import com.f0x1d.logfox.feature.logging.api.model.LogLine -import com.f0x1d.logfox.feature.preferences.api.data.LogsSettingsRepository internal abstract class BaseCrashDataSource( private val appInfoDataSource: AppInfoDataSource, private val crashCollectorDataSource: CrashCollectorDataSource, - private val logsSettingsRepository: LogsSettingsRepository, ) : CrashDataSource { protected abstract val crashType: CrashType @@ -30,8 +28,7 @@ internal abstract class BaseCrashDataSource( open fun shouldContinueCollecting(line: LogLine): Boolean { // Continue if within time window (crashes can have interleaved output) - val timeWindowMs = logsSettingsRepository.logsUpdateInterval().value + timeBufferMs - if (collectionStartTime + timeWindowMs > System.currentTimeMillis()) return true + if (collectionStartTime + timeBufferMs > System.currentTimeMillis()) return true // Fall back to PID checking val first = firstLine ?: return false