Skip to content

Commit

Permalink
Restore code from Element to fix the crash on Android 5 and 6 (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle authored Jul 31, 2024
1 parent 986f817 commit 9133854
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/1088.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Correction du crash au lancement de l'application sur Android 5 et 6.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DecryptionFailureTracker @Inject constructor(
fun stop() {
Timber.v("Stop DecryptionFailureTracker")
post {
decryptionFailurePersistence.persist()
decryptionFailurePersistence.persist()
}
activeSessionSourceDisposable.cancel(CancellationException("Closing DecryptionFailureTracker"))

Expand Down Expand Up @@ -136,8 +136,9 @@ class DecryptionFailureTracker @Inject constructor(
}
}
}

private fun observeActiveSession() {
activeSessionSourceDisposable = sessionDataSource.stream()
activeSessionSourceDisposable = sessionDataSource.stream()
.distinctUntilChanged()
.onEach {
Timber.v("Active session changed ${it.getOrNull()?.myUserId}")
Expand Down Expand Up @@ -213,7 +214,7 @@ class DecryptionFailureTracker @Inject constructor(
}
val isOwnIdentityTrusted = session.cryptoService().crossSigningService().isCrossSigningVerified()
val userHS = MatrixPatterns.extractServerNameFromId(session.myUserId)
val messageSenderHs = event.senderId?.let { MatrixPatterns.extractServerNameFromId(it) }
val messageSenderHs = event.senderId?.let { MatrixPatterns.extractServerNameFromId(it) }
Timber.v("senderHs: $messageSenderHs, userHS: $userHS, isOwnIdentityTrusted: $isOwnIdentityTrusted")

val deviceCreationTs = session.cryptoService().getMyCryptoDevice().firstTimeSeenLocalTs
Expand Down Expand Up @@ -264,7 +265,7 @@ class DecryptionFailureTracker @Inject constructor(
}
}

fun utdDisplayedInTimeline(event: TimelineEvent) {
fun utdDisplayedInTimeline(event: TimelineEvent) {
post {
// should be tracked (unless already reported)
val eventId = event.root.eventId ?: return@post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package im.vector.app.features.analytics

import android.content.Context
import android.util.LruCache
import com.google.common.hash.BloomFilter
import com.google.common.hash.Funnels
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.checkerframework.com.google.common.hash.BloomFilter
import org.checkerframework.com.google.common.hash.Funnels
import timber.log.Timber
import java.io.File
import java.io.FileOutputStream
Expand Down

0 comments on commit 9133854

Please sign in to comment.