diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt index a87d2483e0..70e792d4f6 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt @@ -255,7 +255,11 @@ internal class DefaultCryptoService @Inject constructor( * @return the tracking status */ override fun getDeviceTrackingStatus(userId: String): Int { - return cryptoStore.getDeviceTrackingStatus(userId, DeviceListManager.TRACKING_STATUS_NOT_TRACKED) + return if (olmMachine.isUserTracked(userId)) { + 3 + } else { + -1 + } } /** diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index 710490b372..2d503c1df0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -332,6 +332,17 @@ internal class OlmMachine( suspend fun updateTrackedUsers(users: List) = withContext(Dispatchers.IO) { inner.updateTrackedUsers(users) } + + /** + * Check if the given user is considered to be tracked. + * A user can be marked for tracking using the + * [OlmMachine.updateTrackedUsers] method. + */ + @Throws(CryptoStoreException::class) + fun isUserTracked(userId: String): Boolean { + return this.inner.isUserTracked(userId) + } + /** * Generate one-time key claiming requests for all the users we are missing sessions for. *