Add some extra UTD logging

Change-Id: Ie694b2317cb457d314b7cec36bf07a377c2af2d2
This commit is contained in:
SpiritCroc 2022-10-22 10:45:09 +02:00
parent 3ce5b3b10b
commit d880bdb798
6 changed files with 23 additions and 3 deletions

View File

@ -763,6 +763,7 @@ internal class MXOlmDevice @Inject constructor(
Timber.tag(loggerTag.value)
.w("## importInboundGroupSession() : Can't check session null index $existingFirstKnown/$candidateFirstKnownIndex")
} else {
Timber.tag(loggerTag.value).e("## importInboundGroupSession() : compare first known index, existing: $existingFirstKnown, candidate: $candidateFirstKnownIndex")
if (existingFirstKnown <= candidateFirstKnownIndex) {
// Ignore this, keep existing
candidateOlmInboundGroupSession.releaseSession()

View File

@ -262,7 +262,7 @@ internal class MXOlmDecryption(
return null
}
Timber.tag(loggerTag.value).v("## decryptMessage() : Created new inbound Olm session get id ${res["session_id"]} with $theirDeviceIdentityKey")
Timber.tag(loggerTag.value).d("## decryptMessage() : Created new inbound Olm session get id ${res["session_id"]} with $theirDeviceIdentityKey")
return res["payload"]
}

View File

@ -85,7 +85,8 @@ internal class TimelineEventDecryptor @Inject constructor(
synchronized(unknownSessionsFailure) {
for (requests in unknownSessionsFailure.values) {
if (request in requests) {
Timber.d("Skip Decryption request for event ${request.event.eventId}, unknown session")
// Could be other MXCryptoError, UNKNOWN_INBOUND_SESSION_ID check is commented out
Timber.d("Skip Decryption request for event ${request.event.eventId}, unknown session (or other MXCryptoError)")
return
}
}

View File

@ -17,6 +17,8 @@
package im.vector.app.features.home.room.detail.timeline.factory
import im.vector.app.R
import im.vector.app.core.date.DateFormatKind
import im.vector.app.core.date.VectorDateFormatter
import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.resources.ColorProvider
import im.vector.app.core.resources.DrawableProvider
@ -35,6 +37,7 @@ import org.matrix.android.sdk.api.session.crypto.MXCryptoError
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventContent
import org.matrix.android.sdk.api.session.events.model.toModel
import timber.log.Timber
import javax.inject.Inject
// This class handles timeline events who haven't been successfully decrypted
@ -44,8 +47,9 @@ class EncryptedItemFactory @Inject constructor(
private val stringProvider: StringProvider,
private val avatarSizeProvider: AvatarSizeProvider,
private val drawableProvider: DrawableProvider,
private val dateFormatter: VectorDateFormatter,
private val attributesFactory: MessageItemAttributesFactory,
private val vectorPreferences: VectorPreferences
private val vectorPreferences: VectorPreferences,
) {
fun create(params: TimelineItemFactoryParams): VectorEpoxyModel<*>? {
@ -56,6 +60,10 @@ class EncryptedItemFactory @Inject constructor(
EventType.ENCRYPTED == event.root.getClearType() -> {
val cryptoError = event.root.mCryptoError
// Include timestamp as rendered on screenshots to make it easier to identify
val timestamp = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_DETAIL)
Timber.i("Render UTD: $cryptoError, ${event.root.mCryptoErrorReason}, event: ${event.root.eventId}, room: ${event.root.roomId}, timestamp: $timestamp, sender: ${event.senderInfo.userId}, sessionId: ${event.root.content?.get("session_id")}")
val spannableStr = if (vectorPreferences.developerMode()) {
val errorDescription =
if (cryptoError == MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID) {

View File

@ -19,6 +19,8 @@ package im.vector.app.features.home.room.detail.timeline.format
import dagger.Lazy
import im.vector.app.EmojiSpanify
import im.vector.app.R
import im.vector.app.core.date.DateFormatKind
import im.vector.app.core.date.VectorDateFormatter
import im.vector.app.core.resources.ColorProvider
import im.vector.app.core.resources.StringProvider
import im.vector.app.features.html.EventHtmlRenderer
@ -36,11 +38,13 @@ import org.matrix.android.sdk.api.session.room.model.relation.ReactionContent
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
import org.matrix.android.sdk.api.session.room.timeline.getTextDisplayableContent
import timber.log.Timber
import javax.inject.Inject
class DisplayableEventFormatter @Inject constructor(
private val stringProvider: StringProvider,
private val colorProvider: ColorProvider,
private val dateFormatter: VectorDateFormatter,
private val emojiSpanify: EmojiSpanify,
private val noticeEventFormatter: NoticeEventFormatter,
private val htmlRenderer: Lazy<EventHtmlRenderer>
@ -53,6 +57,11 @@ class DisplayableEventFormatter @Inject constructor(
if (timelineEvent.root.isEncrypted() &&
timelineEvent.root.mxDecryptionResult == null) {
// Include timestamp as rendered on screenshots to make it easier to identify
val cryptoError = timelineEvent.root.mCryptoError
val timestamp = dateFormatter.format(timelineEvent.root.originServerTs, DateFormatKind.MESSAGE_DETAIL)
Timber.i("Render UTD preview: $cryptoError, ${timelineEvent.root.mCryptoErrorReason}, event: ${timelineEvent.root.eventId}, room: ${timelineEvent.root.roomId}, timestamp: $timestamp, sender: ${timelineEvent.senderInfo.userId}, sessionId: ${timelineEvent.root.content?.get("session_id")}")
return stringProvider.getString(R.string.encrypted_message)
}

View File

@ -33,6 +33,7 @@ class GossipingEventsSerializer {
val info = trail.info
append("[${getFormattedDate(trail.ageLocalTs)}] ${type.name} ")
append("sessionId: ${info.sessionId} ")
append("roomId: ${info.roomId} ")
when (type) {
TrailType.IncomingKeyRequest -> {
append("from:${info.userId}|${info.deviceId} - ")