diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt index faadf339e9..94b7034431 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt @@ -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() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt index 219cadac46..c9f1b387e5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt @@ -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"] } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDecryptor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDecryptor.kt index de79661de0..14ee05989d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDecryptor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDecryptor.kt @@ -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 } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt index 1e7af24ca9..f3027b8e21 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt @@ -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) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt index ec12930a7f..af0ae558ed 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt @@ -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 @@ -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) } diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt index b31c841868..be706e0ff0 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt @@ -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} - ")