From 69eaf2695e8c48eb78fec1c1defe54e6d41dfa24 Mon Sep 17 00:00:00 2001 From: Valere Date: Thu, 2 Jul 2020 14:08:09 +0200 Subject: [PATCH 1/2] FIx / inbound session bad migration --- .../internal/crypto/store/db/RealmCryptoStoreMigration.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/store/db/RealmCryptoStoreMigration.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/store/db/RealmCryptoStoreMigration.kt index eb2fc9ebad..47af558b90 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/store/db/RealmCryptoStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/store/db/RealmCryptoStoreMigration.kt @@ -182,7 +182,8 @@ internal class RealmCryptoStoreMigration @Inject constructor(private val crossSi try { val oldSerializedData = obj.getString("olmInboundGroupSessionData") deserializeFromRealm(oldSerializedData)?.let { mxOlmInboundGroupSession2 -> - val newOlmInboundGroupSessionWrapper2 = OlmInboundGroupSessionWrapper2() + val sessionKey = mxOlmInboundGroupSession2.mSession.sessionIdentifier() + val newOlmInboundGroupSessionWrapper = OlmInboundGroupSessionWrapper(sessionKey, false) .apply { olmInboundGroupSession = mxOlmInboundGroupSession2.mSession roomId = mxOlmInboundGroupSession2.mRoomId @@ -191,7 +192,7 @@ internal class RealmCryptoStoreMigration @Inject constructor(private val crossSi forwardingCurve25519KeyChain = mxOlmInboundGroupSession2.mForwardingCurve25519KeyChain } - obj.setString("olmInboundGroupSessionData", serializeForRealm(newOlmInboundGroupSessionWrapper2)) + obj.setString("olmInboundGroupSessionData", serializeForRealm(newOlmInboundGroupSessionWrapper)) } } catch (e: Exception) { Timber.e(e, "Error") From 596fcf94bac88f461cb6ef487f893fe710a6d613 Mon Sep 17 00:00:00 2001 From: Valere Date: Thu, 2 Jul 2020 19:26:05 +0200 Subject: [PATCH 2/2] Fix / Serialization issues Fixes keybackup import failing and UTD of incoming messages --- matrix-sdk-android/proguard-rules.pro | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/matrix-sdk-android/proguard-rules.pro b/matrix-sdk-android/proguard-rules.pro index 08a20cbf0a..fa860d8049 100644 --- a/matrix-sdk-android/proguard-rules.pro +++ b/matrix-sdk-android/proguard-rules.pro @@ -64,3 +64,19 @@ ### Webrtc -keep class org.webrtc.** { *; } + +### Serializable persisted classes +# https://www.guardsquare.com/en/products/proguard/manual/examples#serializable +-keepnames class * implements java.io.Serializable + +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + !static !transient ; + !private ; + !private ; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} \ No newline at end of file