Search in sources :

Example 6 with Event

use of org.matrix.androidsdk.rest.model.Event in project matrix-android-sdk by matrix-org.

the class CryptoTest method test20_testAliceAndBlockedBob.

@Test
public void test20_testAliceAndBlockedBob() throws Exception {
    Log.e(LOG_TAG, "test20_testAliceAndBlockedBob");
    final HashMap<String, String> results = new HashMap<>();
    doE2ETestWithAliceAndBobInARoom(true);
    mBobSession.getCrypto().setWarnOnUnknownDevices(false);
    mAliceSession.getCrypto().setWarnOnUnknownDevices(false);
    final Room roomFromBobPOV = mBobSession.getDataHandler().getRoom(mRoomId);
    final Room roomFromAlicePOV = mAliceSession.getDataHandler().getRoom(mRoomId);
    assertTrue(roomFromBobPOV.isEncrypted());
    assertTrue(roomFromAlicePOV.isEncrypted());
    final CountDownLatch lock1 = new CountDownLatch(1);
    final ArrayList<Event> receivedEvents = new ArrayList<>();
    EventTimeline.EventTimelineListener eventTimelineListener = new EventTimeline.EventTimelineListener() {

        public void onEvent(Event event, EventTimeline.Direction direction, RoomState roomState) {
            if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE)) {
                receivedEvents.add(event);
                lock1.countDown();
            }
        }
    };
    roomFromBobPOV.getLiveTimeLine().addEventTimelineListener(eventTimelineListener);
    String aliceMessage1 = "Hello I'm Alice!";
    roomFromAlicePOV.sendEvent(buildTextEvent(aliceMessage1, mAliceSession), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
        }

        @Override
        public void onNetworkError(Exception e) {
        }

        @Override
        public void onMatrixError(MatrixError e) {
        }

        @Override
        public void onUnexpectedError(Exception e) {
        }
    });
    lock1.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(1 == receivedEvents.size());
    Event event = receivedEvents.get(0);
    assertTrue(checkEncryptedEvent(event, mRoomId, aliceMessage1, mAliceSession));
    // block the bob's device
    final CountDownLatch lock1b = new CountDownLatch(1);
    mAliceSession.getCrypto().setDeviceVerification(MXDeviceInfo.DEVICE_VERIFICATION_BLOCKED, mBobSession.getCredentials().deviceId, mBobSession.getMyUserId(), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
            results.put("setDeviceVerification20", "setDeviceVerification20");
            lock1b.countDown();
        }

        @Override
        public void onNetworkError(Exception e) {
            lock1b.countDown();
        }

        @Override
        public void onMatrixError(MatrixError e) {
            lock1b.countDown();
        }

        @Override
        public void onUnexpectedError(Exception e) {
            lock1b.countDown();
        }
    });
    lock1b.await();
    assertTrue(results.containsKey("setDeviceVerification20"));
    // /
    final CountDownLatch lock2 = new CountDownLatch(1);
    final ArrayList<Event> receivedEvents2 = new ArrayList<>();
    EventTimeline.EventTimelineListener eventTimelineListener2 = new EventTimeline.EventTimelineListener() {

        public void onEvent(Event event, EventTimeline.Direction direction, RoomState roomState) {
            if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE_ENCRYPTED)) {
                receivedEvents2.add(event);
                lock2.countDown();
            }
        }
    };
    roomFromBobPOV.getLiveTimeLine().addEventTimelineListener(eventTimelineListener2);
    String aliceMessage2 = "Hello I'm still Alice!";
    roomFromAlicePOV.sendEvent(buildTextEvent(aliceMessage2, mAliceSession), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
        }

        @Override
        public void onNetworkError(Exception e) {
        }

        @Override
        public void onMatrixError(MatrixError e) {
        }

        @Override
        public void onUnexpectedError(Exception e) {
        }
    });
    lock2.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(1 == receivedEvents2.size());
    event = receivedEvents2.get(0);
    assertTrue(null == event.getClearEvent());
    assertTrue(null != event.getCryptoError());
    assertTrue(TextUtils.equals(event.getCryptoError().errcode, MXCryptoError.UNKNOWN_INBOUND_SESSION_ID_ERROR_CODE));
    // unblock the bob's device
    final CountDownLatch lock2b = new CountDownLatch(1);
    mAliceSession.getCrypto().setDeviceVerification(MXDeviceInfo.DEVICE_VERIFICATION_UNVERIFIED, mBobSession.getCredentials().deviceId, mBobSession.getMyUserId(), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
            results.put("setDeviceVerification40", "setDeviceVerification40");
            lock2b.countDown();
        }

        @Override
        public void onNetworkError(Exception e) {
            lock2b.countDown();
        }

        @Override
        public void onMatrixError(MatrixError e) {
            lock2b.countDown();
        }

        @Override
        public void onUnexpectedError(Exception e) {
            lock2b.countDown();
        }
    });
    lock2b.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("setDeviceVerification40"));
    // /
    final CountDownLatch lock3 = new CountDownLatch(1);
    final ArrayList<Event> receivedEvents3 = new ArrayList<>();
    EventTimeline.EventTimelineListener eventTimelineListener3 = new EventTimeline.EventTimelineListener() {

        public void onEvent(Event event, EventTimeline.Direction direction, RoomState roomState) {
            if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE)) {
                receivedEvents3.add(event);
                lock3.countDown();
            }
        }
    };
    roomFromBobPOV.getLiveTimeLine().addEventTimelineListener(eventTimelineListener3);
    String aliceMessage3 = "Hello I'm still Alice and you can read this!";
    roomFromAlicePOV.sendEvent(buildTextEvent(aliceMessage3, mAliceSession), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
        }

        @Override
        public void onNetworkError(Exception e) {
        }

        @Override
        public void onMatrixError(MatrixError e) {
        }

        @Override
        public void onUnexpectedError(Exception e) {
        }
    });
    lock3.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(1 == receivedEvents3.size());
    event = receivedEvents3.get(0);
    assertTrue(checkEncryptedEvent(event, mRoomId, aliceMessage3, mAliceSession));
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EventTimeline(org.matrix.androidsdk.data.EventTimeline) CountDownLatch(java.util.concurrent.CountDownLatch) Event(org.matrix.androidsdk.rest.model.Event) MatrixError(org.matrix.androidsdk.rest.model.MatrixError) Room(org.matrix.androidsdk.data.Room) RoomState(org.matrix.androidsdk.data.RoomState) Test(org.junit.Test)

Example 7 with Event

use of org.matrix.androidsdk.rest.model.Event in project matrix-android-sdk by matrix-org.

the class CryptoTest method test12_testAliceAndBobInACryptedRoomBackPaginationFromHomeServer.

@Test
public void test12_testAliceAndBobInACryptedRoomBackPaginationFromHomeServer() throws Exception {
    Log.e(LOG_TAG, "test12_testAliceAndBobInACryptedRoomBackPaginationFromHomeServer");
    Context context = InstrumentationRegistry.getContext();
    final HashMap<String, Object> results = new HashMap();
    doE2ETestWithAliceAndBobInARoomWithCryptedMessages(true);
    String eventId = mBobSession.getDataHandler().getStore().getLatestEvent(mRoomId).eventId;
    EventTimeline timeline = new EventTimeline(mBobSession.getDataHandler(), mRoomId, eventId);
    final CountDownLatch lock2 = new CountDownLatch(6);
    final ArrayList<Event> receivedEvents = new ArrayList<>();
    EventTimeline.EventTimelineListener eventTimelineListener = new EventTimeline.EventTimelineListener() {

        public void onEvent(Event event, EventTimeline.Direction direction, RoomState roomState) {
            if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE)) {
                receivedEvents.add(event);
                lock2.countDown();
            }
        }
    };
    timeline.addEventTimelineListener(eventTimelineListener);
    timeline.backPaginate(new ApiCallback<Integer>() {

        @Override
        public void onSuccess(Integer info) {
            results.put("backPaginate", "backPaginate");
            lock2.countDown();
        }

        @Override
        public void onNetworkError(Exception e) {
        }

        @Override
        public void onMatrixError(MatrixError e) {
        }

        @Override
        public void onUnexpectedError(Exception e) {
        }
    });
    lock2.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("backPaginate"));
    assertTrue(5 == receivedEvents.size());
    checkEncryptedEvent(receivedEvents.get(0), mRoomId, messagesFromAlice.get(1), mAliceSession);
    checkEncryptedEvent(receivedEvents.get(1), mRoomId, messagesFromBob.get(2), mBobSession);
    checkEncryptedEvent(receivedEvents.get(2), mRoomId, messagesFromBob.get(1), mBobSession);
    checkEncryptedEvent(receivedEvents.get(3), mRoomId, messagesFromBob.get(0), mBobSession);
    checkEncryptedEvent(receivedEvents.get(4), mRoomId, messagesFromAlice.get(0), mAliceSession);
    mBobSession.clear(context);
    mAliceSession.clear(context);
}
Also used : Context(android.content.Context) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EventTimeline(org.matrix.androidsdk.data.EventTimeline) CountDownLatch(java.util.concurrent.CountDownLatch) Event(org.matrix.androidsdk.rest.model.Event) JsonObject(com.google.gson.JsonObject) MatrixError(org.matrix.androidsdk.rest.model.MatrixError) RoomState(org.matrix.androidsdk.data.RoomState) Test(org.junit.Test)

Example 8 with Event

use of org.matrix.androidsdk.rest.model.Event in project matrix-android-sdk by matrix-org.

the class CryptoTest method test09_testAliceInACryptedRoomAfterInitialSync.

@Test
public void test09_testAliceInACryptedRoomAfterInitialSync() throws Exception {
    Log.e(LOG_TAG, "test09_testAliceInACryptedRoomAfterInitialSync");
    Context context = InstrumentationRegistry.getContext();
    final HashMap<String, Object> results = new HashMap<>();
    doE2ETestWithAliceInARoom();
    mAliceSession.getCrypto().setWarnOnUnknownDevices(false);
    final String message = "Hello myself!";
    Credentials aliceCredentials = mAliceSession.getCredentials();
    mAliceSession.clear(context);
    Uri uri = Uri.parse(CryptoTestHelper.TESTS_HOME_SERVER_URL);
    HomeServerConnectionConfig hs = new HomeServerConnectionConfig(uri);
    hs.setCredentials(aliceCredentials);
    IMXStore store = new MXFileStore(hs, context);
    final CountDownLatch lock1 = new CountDownLatch(1);
    final MXSession aliceSession2 = new MXSession(hs, new MXDataHandler(store, aliceCredentials), context);
    MXStoreListener listener = new MXStoreListener() {

        @Override
        public void postProcess(String accountId) {
        }

        @Override
        public void onStoreReady(String accountId) {
            results.put("onStoreReady", "onStoreReady");
            lock1.countDown();
        }

        @Override
        public void onStoreCorrupted(String accountId, String description) {
            lock1.countDown();
        }

        @Override
        public void onStoreOOM(String accountId, String description) {
            lock1.countDown();
        }
    };
    aliceSession2.getDataHandler().getStore().addMXStoreListener(listener);
    aliceSession2.getDataHandler().getStore().open();
    lock1.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("onStoreReady"));
    final CountDownLatch lock1b = new CountDownLatch(2);
    MXEventListener eventListener = new MXEventListener() {

        @Override
        public void onInitialSyncComplete(String toToken) {
            results.put("onInitialSyncComplete", "onInitialSyncComplete");
            lock1b.countDown();
        }

        @Override
        public void onCryptoSyncComplete() {
            results.put("onCryptoSyncComplete", "onCryptoSyncComplete");
            lock1b.countDown();
        }
    };
    aliceSession2.getDataHandler().addListener(eventListener);
    aliceSession2.startEventStream(null);
    lock1b.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("onInitialSyncComplete"));
    assertTrue(results.containsKey("onCryptoSyncComplete"));
    Room roomFromAlicePOV2 = aliceSession2.getDataHandler().getRoom(mRoomId);
    assertTrue(roomFromAlicePOV2.isEncrypted());
    final CountDownLatch lock2 = new CountDownLatch(1);
    if (false) {
        // The android client does not echo its own message
        MXEventListener aliceEventListener = new MXEventListener() {

            @Override
            public void onLiveEvent(Event event, RoomState roomState) {
                if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE)) {
                    try {
                        if (checkEncryptedEvent(event, mRoomId, message, aliceSession2)) {
                            lock2.countDown();
                        }
                    } catch (Exception e) {
                    }
                }
            }
        };
        roomFromAlicePOV2.addEventListener(aliceEventListener);
    }
    // the IOS client echoes the message
    // the android client does not
    roomFromAlicePOV2.sendEvent(buildTextEvent(message, aliceSession2), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
            results.put("sendEvent", "sendEvent");
            lock2.countDown();
        }

        @Override
        public void onNetworkError(Exception e) {
            lock2.countDown();
        }

        @Override
        public void onMatrixError(MatrixError e) {
            lock2.countDown();
        }

        @Override
        public void onUnexpectedError(Exception e) {
            lock2.countDown();
        }
    });
    lock2.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("sendEvent"));
    aliceSession2.clear(context);
}
Also used : Context(android.content.Context) MXStoreListener(org.matrix.androidsdk.data.store.MXStoreListener) HashMap(java.util.HashMap) IMXStore(org.matrix.androidsdk.data.store.IMXStore) MXFileStore(org.matrix.androidsdk.data.store.MXFileStore) CountDownLatch(java.util.concurrent.CountDownLatch) Uri(android.net.Uri) MXEventListener(org.matrix.androidsdk.listeners.MXEventListener) Event(org.matrix.androidsdk.rest.model.Event) JsonObject(com.google.gson.JsonObject) MatrixError(org.matrix.androidsdk.rest.model.MatrixError) Room(org.matrix.androidsdk.data.Room) Credentials(org.matrix.androidsdk.rest.model.login.Credentials) RoomState(org.matrix.androidsdk.data.RoomState) Test(org.junit.Test)

Example 9 with Event

use of org.matrix.androidsdk.rest.model.Event in project matrix-android-sdk by matrix-org.

the class CryptoTest method test15_testReplayAttack.

@Test
public void test15_testReplayAttack() throws Exception {
    Log.e(LOG_TAG, "test15_testReplayAttack");
    final HashMap<String, Object> results = new HashMap<>();
    doE2ETestWithAliceAndBobInARoom(true);
    mBobSession.getCrypto().setWarnOnUnknownDevices(false);
    mAliceSession.getCrypto().setWarnOnUnknownDevices(false);
    String messageFromAlice = "Hello I'm Alice!";
    final Room roomFromBobPOV = mBobSession.getDataHandler().getRoom(mRoomId);
    final Room roomFromAlicePOV = mAliceSession.getDataHandler().getRoom(mRoomId);
    assertTrue(roomFromBobPOV.isEncrypted());
    assertTrue(roomFromAlicePOV.isEncrypted());
    final CountDownLatch lock1 = new CountDownLatch(2);
    MXEventListener bobEventListener = new MXEventListener() {

        @Override
        public void onLiveEvent(Event event, RoomState roomState) {
            if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE) && !TextUtils.equals(event.getSender(), mBobSession.getMyUserId())) {
                results.put("bobEcho", event);
                event.setClearData(null);
                mBobSession.getDataHandler().decryptEvent(event, roomFromBobPOV.getLiveTimeLine().getTimelineId());
                results.put("decrypted", event);
                lock1.countDown();
            }
        }
    };
    roomFromBobPOV.addEventListener(bobEventListener);
    mBobSession.getDataHandler().addListener(new MXEventListener() {

        @Override
        public void onToDeviceEvent(Event event) {
            results.put("onToDeviceEvent", event);
            lock1.countDown();
        }
    });
    roomFromAlicePOV.sendEvent(buildTextEvent(messageFromAlice, mAliceSession), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
        }

        @Override
        public void onNetworkError(Exception e) {
        }

        @Override
        public void onMatrixError(MatrixError e) {
        }

        @Override
        public void onUnexpectedError(Exception e) {
        }
    });
    lock1.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("onToDeviceEvent"));
    assertTrue(results.containsKey("bobEcho"));
    assertTrue(results.containsKey("decrypted"));
    Event decryptedEvent = (Event) results.get("decrypted");
    assertTrue(null == decryptedEvent.getClearEvent());
    assertTrue(TextUtils.equals(decryptedEvent.getCryptoError().errcode, MXCryptoError.DUPLICATED_MESSAGE_INDEX_ERROR_CODE));
    // Decrypting it with no replay attack mitigation must still work
    mBobSession.getDataHandler().decryptEvent(decryptedEvent, null);
    assertTrue(checkEncryptedEvent(decryptedEvent, mRoomId, messageFromAlice, mAliceSession));
}
Also used : HashMap(java.util.HashMap) CountDownLatch(java.util.concurrent.CountDownLatch) MXEventListener(org.matrix.androidsdk.listeners.MXEventListener) Event(org.matrix.androidsdk.rest.model.Event) JsonObject(com.google.gson.JsonObject) MatrixError(org.matrix.androidsdk.rest.model.MatrixError) Room(org.matrix.androidsdk.data.Room) RoomState(org.matrix.androidsdk.data.RoomState) Test(org.junit.Test)

Example 10 with Event

use of org.matrix.androidsdk.rest.model.Event in project matrix-android-sdk by matrix-org.

the class CryptoTest method test17_testLateRoomKey.

@Test
public void test17_testLateRoomKey() throws Exception {
    Log.e(LOG_TAG, "test17_testLateRoomKey");
    final HashMap<String, Object> results = new HashMap<>();
    doE2ETestWithAliceAndBobInARoom(true);
    mBobSession.getCrypto().setWarnOnUnknownDevices(false);
    mAliceSession.getCrypto().setWarnOnUnknownDevices(false);
    String messageFromAlice = "Hello I'm Alice!";
    final Room roomFromBobPOV = mBobSession.getDataHandler().getRoom(mRoomId);
    final Room roomFromAlicePOV = mAliceSession.getDataHandler().getRoom(mRoomId);
    assertTrue(roomFromBobPOV.isEncrypted());
    assertTrue(roomFromAlicePOV.isEncrypted());
    final CountDownLatch lock1 = new CountDownLatch(2);
    MXEventListener bobEventListener = new MXEventListener() {

        @Override
        public void onToDeviceEvent(Event event) {
            if (!results.containsKey("onToDeviceEvent")) {
                results.put("onToDeviceEvent", event);
                lock1.countDown();
            }
        }
    };
    mBobSession.getDataHandler().addListener(bobEventListener);
    final ArrayList<Event> receivedEvents = new ArrayList<>();
    EventTimeline.EventTimelineListener eventTimelineListener = new EventTimeline.EventTimelineListener() {

        public void onEvent(Event event, EventTimeline.Direction direction, RoomState roomState) {
            if (TextUtils.equals(event.getType(), Event.EVENT_TYPE_MESSAGE)) {
                receivedEvents.add(event);
                lock1.countDown();
            }
        }
    };
    roomFromBobPOV.getLiveTimeLine().addEventTimelineListener(eventTimelineListener);
    roomFromAlicePOV.sendEvent(buildTextEvent(messageFromAlice, mAliceSession), new ApiCallback<Void>() {

        @Override
        public void onSuccess(Void info) {
        }

        @Override
        public void onNetworkError(Exception e) {
        }

        @Override
        public void onMatrixError(MatrixError e) {
        }

        @Override
        public void onUnexpectedError(Exception e) {
        }
    });
    lock1.await(2000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("onToDeviceEvent"));
    assertTrue(1 == receivedEvents.size());
    Event event = receivedEvents.get(0);
    assertTrue(checkEncryptedEvent(event, mRoomId, messageFromAlice, mAliceSession));
    // Reinject a modified version of the received room_key event from Alice.
    // From Bob pov, that mimics Alice resharing her keys but with an advanced outbound group session.
    Event toDeviceEvent = (Event) results.get("onToDeviceEvent");
    String sessionId = toDeviceEvent.getContentAsJsonObject().get("session_id").getAsString();
    String senderKey = toDeviceEvent.senderKey();
    // remove the session
    mBobSession.getCrypto().getOlmDevice().removeInboundGroupSession(sessionId, senderKey);
    event.setClearData(null);
    // check that the message cannot be decrypted
    assertTrue(!mBobSession.getDataHandler().decryptEvent(event, null));
    // check the error code
    assertTrue(TextUtils.equals(event.getCryptoError().errcode, MXCryptoError.UNKNOWN_INBOUND_SESSION_ID_ERROR_CODE));
    receivedEvents.clear();
    final CountDownLatch lock2 = new CountDownLatch(1);
    roomFromBobPOV.addEventListener(new MXEventListener() {

        @Override
        public void onEventDecrypted(Event event) {
            results.put("onEventDecrypted", "onEventDecrypted");
            receivedEvents.add(event);
            lock2.countDown();
        }
    });
    event.setClearData(null);
    // reinject the session key
    mBobSession.getDataHandler().onToDeviceEvent(toDeviceEvent);
    // the message should be decrypted later
    lock2.await(1000, TimeUnit.MILLISECONDS);
    assertTrue(results.containsKey("onEventDecrypted"));
    assertTrue(1 == receivedEvents.size());
    assertTrue(checkEncryptedEvent(receivedEvents.get(0), mRoomId, messageFromAlice, mAliceSession));
    assertTrue(null == receivedEvents.get(0).getCryptoError());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EventTimeline(org.matrix.androidsdk.data.EventTimeline) CountDownLatch(java.util.concurrent.CountDownLatch) MXEventListener(org.matrix.androidsdk.listeners.MXEventListener) Event(org.matrix.androidsdk.rest.model.Event) JsonObject(com.google.gson.JsonObject) MatrixError(org.matrix.androidsdk.rest.model.MatrixError) Room(org.matrix.androidsdk.data.Room) RoomState(org.matrix.androidsdk.data.RoomState) Test(org.junit.Test)

Aggregations

Event (org.matrix.androidsdk.rest.model.Event)73 ArrayList (java.util.ArrayList)31 JsonObject (com.google.gson.JsonObject)28 Room (org.matrix.androidsdk.data.Room)27 MatrixError (org.matrix.androidsdk.rest.model.MatrixError)27 HashMap (java.util.HashMap)23 CountDownLatch (java.util.concurrent.CountDownLatch)22 RoomState (org.matrix.androidsdk.data.RoomState)21 Test (org.junit.Test)20 MXEventListener (org.matrix.androidsdk.listeners.MXEventListener)19 Context (android.content.Context)14 MotionEvent (android.view.MotionEvent)9 EventTimeline (org.matrix.androidsdk.data.EventTimeline)9 IMXStore (org.matrix.androidsdk.data.store.IMXStore)7 ReceiptData (org.matrix.androidsdk.rest.model.ReceiptData)6 RoomMember (org.matrix.androidsdk.rest.model.RoomMember)6 Credentials (org.matrix.androidsdk.rest.model.login.Credentials)6 Uri (android.net.Uri)5 File (java.io.File)4 MessageRow (org.matrix.androidsdk.adapters.MessageRow)4