This commit is contained in:
Benoit Marty 2019-05-20 17:13:08 +02:00
parent f5bd215f36
commit 6d8000b957
48 changed files with 185 additions and 185 deletions

View File

@ -134,7 +134,7 @@ internal class CryptoManager(
//private val mNetworkListener = object : IMXNetworkEventListener {
// override fun onNetworkConnectionUpdate(isConnected: Boolean) {
// if (isConnected && !isStarted()) {
// Timber.d("Start MXCrypto because a network connection has been retrieved ")
// Timber.v("Start MXCrypto because a network connection has been retrieved ")
// start(false, null)
// }
// }
@ -257,13 +257,13 @@ internal class CryptoManager(
}

override fun onSuccess(data: KeysUploadResponse) {
Timber.d("###########################################################")
Timber.d("uploadDeviceKeys done for " + mCredentials.userId)
Timber.d(" - device id : " + mCredentials.deviceId)
Timber.d(" - ed25519 : " + mOlmDevice.deviceEd25519Key)
Timber.d(" - curve25519 : " + mOlmDevice.deviceCurve25519Key)
Timber.d(" - oneTimeKeys: " + mOneTimeKeysUploader.mLastPublishedOneTimeKeys)
Timber.d("")
Timber.v("###########################################################")
Timber.v("uploadDeviceKeys done for " + mCredentials.userId)
Timber.v(" - device id : " + mCredentials.deviceId)
Timber.v(" - ed25519 : " + mOlmDevice.deviceEd25519Key)
Timber.v(" - curve25519 : " + mOlmDevice.deviceCurve25519Key)
Timber.v(" - oneTimeKeys: " + mOneTimeKeysUploader.mLastPublishedOneTimeKeys)
Timber.v("")

mOneTimeKeysUploader.maybeUploadOneTimeKeys(object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
@ -502,7 +502,7 @@ internal class CryptoManager(
// e2e rooms with them, so there is room for optimisation here, but for now
// we just invalidate everyone in the room.
if (null == existingAlgorithm) {
Timber.d("Enabling encryption in $roomId for the first time; invalidating device lists for all users therein")
Timber.v("Enabling encryption in $roomId for the first time; invalidating device lists for all users therein")

val userIds = ArrayList(membersId)

@ -578,7 +578,7 @@ internal class CryptoManager(
callback: MatrixCallback<MXEncryptEventContentResult>) {
// wait that the crypto is really started
if (!isStarted()) {
Timber.d("## encryptEventContent() : wait after e2e init")
Timber.v("## encryptEventContent() : wait after e2e init")

start(false, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
@ -626,11 +626,11 @@ internal class CryptoManager(

if (null != alg) {
val t0 = System.currentTimeMillis()
Timber.d("## encryptEventContent() starts")
Timber.v("## encryptEventContent() starts")

alg!!.encryptEventContent(eventContent, eventType, userIds, object : MatrixCallback<Content> {
override fun onSuccess(data: Content) {
Timber.d("## encryptEventContent() : succeeds after " + (System.currentTimeMillis() - t0) + " ms")
Timber.v("## encryptEventContent() : succeeds after " + (System.currentTimeMillis() - t0) + " ms")

callback.onSuccess(MXEncryptEventContentResult(data, EventType.ENCRYPTED))
}
@ -890,7 +890,7 @@ internal class CryptoManager(
password: String,
progressListener: ProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>) {
Timber.d("## importRoomKeys starts")
Timber.v("## importRoomKeys starts")

val t0 = System.currentTimeMillis()
val roomKeys: String
@ -906,7 +906,7 @@ internal class CryptoManager(

val t1 = System.currentTimeMillis()

Timber.d("## importRoomKeys : decryptMegolmKeyFile done in " + (t1 - t0) + " ms")
Timber.v("## importRoomKeys : decryptMegolmKeyFile done in " + (t1 - t0) + " ms")

try {
val list = MoshiProvider.providesMoshi()
@ -921,7 +921,7 @@ internal class CryptoManager(

val t2 = System.currentTimeMillis()

Timber.d("## importRoomKeys : JSON parsing " + (t2 - t1) + " ms")
Timber.v("## importRoomKeys : JSON parsing " + (t2 - t1) + " ms")

mMegolmSessionDataImporter.handle(importedSessions, true, progressListener, callback)
}

View File

@ -176,7 +176,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,

for (userId in userIds) {
if (!deviceTrackingStatuses.containsKey(userId) || TRACKING_STATUS_NOT_TRACKED == deviceTrackingStatuses[userId]) {
Timber.d("## startTrackingDeviceList() : Now tracking device list for $userId")
Timber.v("## startTrackingDeviceList() : Now tracking device list for $userId")
deviceTrackingStatuses.put(userId, TRACKING_STATUS_PENDING_DOWNLOAD)
isUpdated = true
}
@ -203,7 +203,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,

for (userId in changed) {
if (deviceTrackingStatuses.containsKey(userId)) {
Timber.d("## invalidateUserDeviceList() : Marking device list outdated for $userId")
Timber.v("## invalidateUserDeviceList() : Marking device list outdated for $userId")
deviceTrackingStatuses.put(userId, TRACKING_STATUS_PENDING_DOWNLOAD)
isUpdated = true
}
@ -215,7 +215,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,

for (userId in left) {
if (deviceTrackingStatuses.containsKey(userId)) {
Timber.d("## invalidateUserDeviceList() : No longer tracking device list for $userId")
Timber.v("## invalidateUserDeviceList() : No longer tracking device list for $userId")
deviceTrackingStatuses.put(userId, TRACKING_STATUS_NOT_TRACKED)
isUpdated = true
}
@ -319,7 +319,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,
// we didn't get any new invalidations since this download started:
// this user's device list is now up to date.
deviceTrackingStatuses.put(userId, TRACKING_STATUS_UP_TO_DATE)
Timber.d("Device list for $userId now up to date")
Timber.v("Device list for $userId now up to date")
}

// And the response result
@ -359,7 +359,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,
* @param callback the asynchronous callback
*/
fun downloadKeys(userIds: List<String>?, forceDownload: Boolean, callback: MatrixCallback<MXUsersDevicesMap<MXDeviceInfo>>?) {
Timber.d("## downloadKeys() : forceDownload $forceDownload : $userIds")
Timber.v("## downloadKeys() : forceDownload $forceDownload : $userIds")

// Map from userid -> deviceid -> DeviceInfo
val stored = MXUsersDevicesMap<MXDeviceInfo>()
@ -393,18 +393,18 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,
}

if (0 == downloadUsers.size) {
Timber.d("## downloadKeys() : no new user device")
Timber.v("## downloadKeys() : no new user device")

if (null != callback) {
CryptoAsyncHelper.getUiHandler().post { callback.onSuccess(stored) }
}
} else {
Timber.d("## downloadKeys() : starts")
Timber.v("## downloadKeys() : starts")
val t0 = System.currentTimeMillis()

doKeyDownloadForUsers(downloadUsers, object : MatrixCallback<MXUsersDevicesMap<MXDeviceInfo>> {
override fun onSuccess(data: MXUsersDevicesMap<MXDeviceInfo>) {
Timber.d("## downloadKeys() : doKeyDownloadForUsers succeeds after " + (System.currentTimeMillis() - t0) + " ms")
Timber.v("## downloadKeys() : doKeyDownloadForUsers succeeds after " + (System.currentTimeMillis() - t0) + " ms")

data.addEntriesFromMap(stored)

@ -428,7 +428,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,
* @param callback the asynchronous callback
*/
private fun doKeyDownloadForUsers(downloadUsers: MutableList<String>, callback: MatrixCallback<MXUsersDevicesMap<MXDeviceInfo>>?) {
Timber.d("## doKeyDownloadForUsers() : doKeyDownloadForUsers $downloadUsers")
Timber.v("## doKeyDownloadForUsers() : doKeyDownloadForUsers $downloadUsers")

// get the user ids which did not already trigger a keys download
val filteredUsers = addDownloadKeysPromise(downloadUsers, callback)
@ -460,7 +460,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,
.dispatchTo(object : MatrixCallback<KeysQueryResponse> {
override fun onSuccess(data: KeysQueryResponse) {
CryptoAsyncHelper.getEncryptBackgroundHandler().post {
Timber.d("## doKeyDownloadForUsers() : Got keys for " + filteredUsers.size + " users")
Timber.v("## doKeyDownloadForUsers() : Got keys for " + filteredUsers.size + " users")
val userIdsList = ArrayList(filteredUsers)

for (userId in userIdsList) {
@ -472,7 +472,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,
} else {
val devices = data.deviceKeys!![userId]

Timber.d("## doKeyDownloadForUsers() : Got keys for $userId : $devices")
Timber.v("## doKeyDownloadForUsers() : Got keys for $userId : $devices")

if (null != devices) {
val mutableDevices = HashMap(devices)
@ -690,7 +690,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore,

doKeyDownloadForUsers(users, object : MatrixCallback<MXUsersDevicesMap<MXDeviceInfo>> {
override fun onSuccess(data: MXUsersDevicesMap<MXDeviceInfo>) {
CryptoAsyncHelper.getEncryptBackgroundHandler().post { Timber.d("## refreshOutdatedDeviceLists() : done") }
CryptoAsyncHelper.getEncryptBackgroundHandler().post { Timber.v("## refreshOutdatedDeviceLists() : done") }
}

override fun onFailure(failure: Throwable) {

View File

@ -86,7 +86,7 @@ internal class IncomingRoomKeyRequestManager(
val roomId = body!!.roomId
val alg = body.algorithm

Timber.d("m.room_key_request from " + userId + ":" + deviceId + " for " + roomId + " / " + body.sessionId + " id " + request.mRequestId)
Timber.v("m.room_key_request from " + userId + ":" + deviceId + " for " + roomId + " / " + body.sessionId + " id " + request.mRequestId)

if (!TextUtils.equals(mCredentials.userId, userId)) {
// TODO: determine if we sent this device the keys already: in
@ -114,7 +114,7 @@ internal class IncomingRoomKeyRequestManager(
}

if (TextUtils.equals(deviceId, mCredentials.deviceId) && TextUtils.equals(mCredentials.userId, userId)) {
Timber.d("## processReceivedRoomKeyRequests() : oneself device - ignored")
Timber.v("## processReceivedRoomKeyRequests() : oneself device - ignored")
mCryptoStore.deleteIncomingRoomKeyRequest(request)
continue
}
@ -131,14 +131,14 @@ internal class IncomingRoomKeyRequestManager(

if (null != device) {
if (device.isVerified) {
Timber.d("## processReceivedRoomKeyRequests() : device is already verified: sharing keys")
Timber.v("## processReceivedRoomKeyRequests() : device is already verified: sharing keys")
mCryptoStore.deleteIncomingRoomKeyRequest(request)
request.mShare!!.run()
continue
}

if (device.isBlocked) {
Timber.d("## processReceivedRoomKeyRequests() : device is blocked -> ignored")
Timber.v("## processReceivedRoomKeyRequests() : device is blocked -> ignored")
mCryptoStore.deleteIncomingRoomKeyRequest(request)
continue
}
@ -160,7 +160,7 @@ internal class IncomingRoomKeyRequestManager(

if (null != receivedRoomKeyRequestCancellations) {
for (request in receivedRoomKeyRequestCancellations!!) {
Timber.d("## ## processReceivedRoomKeyRequests() : m.room_key_request cancellation for " + request.mUserId
Timber.v("## ## processReceivedRoomKeyRequests() : m.room_key_request cancellation for " + request.mUserId
+ ":" + request.mDeviceId + " id " + request.mRequestId)

// we should probably only notify the app of cancellations we told it

View File

@ -117,7 +117,7 @@ object MXEncryptedAttachments {

outStream.close()

Timber.d("Encrypt in " + (System.currentTimeMillis() - t0) + " ms")
Timber.v("Encrypt in " + (System.currentTimeMillis() - t0) + " ms")
return result
} catch (oom: OutOfMemoryError) {
Timber.e(oom, "## encryptAttachment failed " + oom.message)
@ -214,7 +214,7 @@ object MXEncryptedAttachments {
val decryptedStream = ByteArrayInputStream(outStream.toByteArray())
outStream.close()

Timber.d("Decrypt in " + (System.currentTimeMillis() - t0) + " ms")
Timber.v("Decrypt in " + (System.currentTimeMillis() - t0) + " ms")

return decryptedStream
} catch (oom: OutOfMemoryError) {

View File

@ -354,7 +354,7 @@ object MXMegolmExportEncryption {
}
}

Timber.d("## deriveKeys() : " + iterations + " in " + (System.currentTimeMillis() - t0) + " ms")
Timber.v("## deriveKeys() : " + iterations + " in " + (System.currentTimeMillis() - t0) + " ms")

return key
}

View File

@ -87,7 +87,7 @@ internal class MXOlmDevice(
mOlmAccount = mStore.getAccount()

if (null == mOlmAccount) {
Timber.d("MXOlmDevice : create a new olm account")
Timber.v("MXOlmDevice : create a new olm account")
// Else, create it
try {
mOlmAccount = OlmAccount()
@ -97,7 +97,7 @@ internal class MXOlmDevice(
}

} else {
Timber.d("MXOlmDevice : use an existing account")
Timber.v("MXOlmDevice : use an existing account")
}

try {
@ -198,7 +198,7 @@ internal class MXOlmDevice(
* @return the session id for the outbound session.
*/
fun createOutboundSession(theirIdentityKey: String, theirOneTimeKey: String): String? {
Timber.d("## createOutboundSession() ; theirIdentityKey $theirIdentityKey theirOneTimeKey $theirOneTimeKey")
Timber.v("## createOutboundSession() ; theirIdentityKey $theirIdentityKey theirOneTimeKey $theirOneTimeKey")
var olmSession: OlmSession? = null

try {
@ -216,7 +216,7 @@ internal class MXOlmDevice(

val sessionIdentifier = olmSession.sessionIdentifier()

Timber.d("## createOutboundSession() ; olmSession.sessionIdentifier: $sessionIdentifier")
Timber.v("## createOutboundSession() ; olmSession.sessionIdentifier: $sessionIdentifier")
return sessionIdentifier

} catch (e: Exception) {
@ -238,7 +238,7 @@ internal class MXOlmDevice(
*/
fun createInboundSession(theirDeviceIdentityKey: String, messageType: Int, ciphertext: String): Map<String, String>? {

Timber.d("## createInboundSession() : theirIdentityKey: $theirDeviceIdentityKey")
Timber.v("## createInboundSession() : theirIdentityKey: $theirDeviceIdentityKey")

var olmSession: OlmSession? = null

@ -251,7 +251,7 @@ internal class MXOlmDevice(
return null
}

Timber.d("## createInboundSession() : sessionId: " + olmSession.sessionIdentifier())
Timber.v("## createInboundSession() : sessionId: " + olmSession.sessionIdentifier())

try {
mOlmAccount!!.removeOneTimeKeys(olmSession)
@ -260,10 +260,10 @@ internal class MXOlmDevice(
Timber.e(e, "## createInboundSession() : removeOneTimeKeys failed")
}

Timber.d("## createInboundSession() : ciphertext: $ciphertext")
Timber.v("## createInboundSession() : ciphertext: $ciphertext")
try {
val sha256 = mOlmUtility!!.sha256(URLEncoder.encode(ciphertext, "utf-8"))
Timber.d("## createInboundSession() :ciphertext: SHA256:" + sha256)
Timber.v("## createInboundSession() :ciphertext: SHA256:" + sha256)
} catch (e: Exception) {
Timber.e(e, "## createInboundSession() :ciphertext: cannot encode ciphertext")
}
@ -343,8 +343,8 @@ internal class MXOlmDevice(

if (mxOlmSession != null) {
try {
Timber.d("## encryptMessage() : olmSession.sessionIdentifier: $sessionId")
//Timber.d("## encryptMessage() : payloadString: " + payloadString);
Timber.v("## encryptMessage() : olmSession.sessionIdentifier: $sessionId")
//Timber.v("## encryptMessage() : payloadString: " + payloadString);

olmMessage = mxOlmSession.olmSession.encryptMessage(payloadString)
mStore.storeSession(mxOlmSession, theirDeviceIdentityKey)

View File

@ -146,7 +146,7 @@ internal class OneTimeKeysUploader(
}

override fun onSuccess(data: Unit) {
Timber.d("## maybeUploadOneTimeKeys() : succeeded")
Timber.v("## maybeUploadOneTimeKeys() : succeeded")
uploadKeysDone(null)

callback?.onSuccess(Unit)

View File

@ -121,12 +121,12 @@ internal class OutgoingRoomKeyRequestManager(
?: // no request was made for this key
return

Timber.d("cancelRoomKeyRequest: requestId: " + req.mRequestId + " state: " + req.mState + " andResend: " + andResend)
Timber.v("cancelRoomKeyRequest: requestId: " + req.mRequestId + " state: " + req.mState + " andResend: " + andResend)

if (req.mState === OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING || req.mState === OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING_AND_WILL_RESEND) {
// nothing to do here
} else if (req.mState === OutgoingRoomKeyRequest.RequestState.UNSENT || req.mState === OutgoingRoomKeyRequest.RequestState.FAILED) {
Timber.d("## cancelRoomKeyRequest() : deleting unnecessary room key request for $requestBody")
Timber.v("## cancelRoomKeyRequest() : deleting unnecessary room key request for $requestBody")
mCryptoStore.deleteOutgoingRoomKeyRequest(req.mRequestId)
} else if (req.mState === OutgoingRoomKeyRequest.RequestState.SENT) {
if (andResend) {
@ -151,7 +151,7 @@ internal class OutgoingRoomKeyRequestManager(

Handler().postDelayed(Runnable {
if (mSendOutgoingRoomKeyRequestsRunning) {
Timber.d("## startTimer() : RoomKeyRequestSend already in progress!")
Timber.v("## startTimer() : RoomKeyRequestSend already in progress!")
return@Runnable
}

@ -169,7 +169,7 @@ internal class OutgoingRoomKeyRequestManager(
return
}

Timber.d("## sendOutgoingRoomKeyRequests() : Looking for queued outgoing room key requests")
Timber.v("## sendOutgoingRoomKeyRequests() : Looking for queued outgoing room key requests")
val outgoingRoomKeyRequest = mCryptoStore.getOutgoingRoomKeyRequestByState(
HashSet<OutgoingRoomKeyRequest.RequestState>(Arrays.asList<OutgoingRoomKeyRequest.RequestState>(OutgoingRoomKeyRequest.RequestState.UNSENT,
OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING,
@ -194,7 +194,7 @@ internal class OutgoingRoomKeyRequestManager(
* @param request the request
*/
private fun sendOutgoingRoomKeyRequest(request: OutgoingRoomKeyRequest) {
Timber.d("## sendOutgoingRoomKeyRequest() : Requesting keys " + request.mRequestBody
Timber.v("## sendOutgoingRoomKeyRequest() : Requesting keys " + request.mRequestBody
+ " from " + request.mRecipients + " id " + request.mRequestId)

val requestMessage = RoomKeyShareRequest()
@ -205,7 +205,7 @@ internal class OutgoingRoomKeyRequestManager(
sendMessageToDevices(requestMessage, request.mRecipients, request.mRequestId, object : MatrixCallback<Unit> {
private fun onDone(state: OutgoingRoomKeyRequest.RequestState) {
if (request.mState !== OutgoingRoomKeyRequest.RequestState.UNSENT) {
Timber.d("## sendOutgoingRoomKeyRequest() : Cannot update room key request from UNSENT as it was already updated to " + request.mState)
Timber.v("## sendOutgoingRoomKeyRequest() : Cannot update room key request from UNSENT as it was already updated to " + request.mState)
} else {
request.mState = state
mCryptoStore.updateOutgoingRoomKeyRequest(request)
@ -216,7 +216,7 @@ internal class OutgoingRoomKeyRequestManager(
}

override fun onSuccess(data: Unit) {
Timber.d("## sendOutgoingRoomKeyRequest succeed")
Timber.v("## sendOutgoingRoomKeyRequest succeed")
onDone(OutgoingRoomKeyRequest.RequestState.SENT)
}

@ -233,7 +233,7 @@ internal class OutgoingRoomKeyRequestManager(
* @param request the request
*/
private fun sendOutgoingRoomKeyRequestCancellation(request: OutgoingRoomKeyRequest) {
Timber.d("## sendOutgoingRoomKeyRequestCancellation() : Sending cancellation for key request for " + request.mRequestBody
Timber.v("## sendOutgoingRoomKeyRequestCancellation() : Sending cancellation for key request for " + request.mRequestBody
+ " to " + request.mRecipients
+ " cancellation id " + request.mCancellationTxnId)

@ -250,7 +250,7 @@ internal class OutgoingRoomKeyRequestManager(


override fun onSuccess(data: Unit) {
Timber.d("## sendOutgoingRoomKeyRequestCancellation() : done")
Timber.v("## sendOutgoingRoomKeyRequestCancellation() : done")
val resend = request.mState === OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING_AND_WILL_RESEND

onDone()

View File

@ -79,14 +79,14 @@ internal class EnsureOlmSessionsForDevicesAction(private val mOlmDevice: MXOlmDe
//
// That should eventually resolve itself, but it's poor form.

Timber.d("## claimOneTimeKeysForUsersDevices() : $usersDevicesToClaim")
Timber.v("## claimOneTimeKeysForUsersDevices() : $usersDevicesToClaim")

mClaimOneTimeKeysForUsersDeviceTask
.configureWith(ClaimOneTimeKeysForUsersDeviceTask.Params(usersDevicesToClaim))
.dispatchTo(object : MatrixCallback<MXUsersDevicesMap<MXKey>> {
override fun onSuccess(data: MXUsersDevicesMap<MXKey>) {
try {
Timber.d("## claimOneTimeKeysForUsersDevices() : keysClaimResponse.oneTimeKeys: $data")
Timber.v("## claimOneTimeKeysForUsersDevices() : keysClaimResponse.oneTimeKeys: $data")

for (userId in userIds) {
val deviceInfos = devicesByUser[userId]
@ -113,7 +113,7 @@ internal class EnsureOlmSessionsForDevicesAction(private val mOlmDevice: MXOlmDe
}

if (null == oneTimeKey) {
Timber.d("## ensureOlmSessionsForDevices() : No one-time keys " + oneTimeKeyAlgorithm
Timber.v("## ensureOlmSessionsForDevices() : No one-time keys " + oneTimeKeyAlgorithm
+ " for device " + userId + " : " + deviceId)
continue
}
@ -164,7 +164,7 @@ internal class EnsureOlmSessionsForDevicesAction(private val mOlmDevice: MXOlmDe
sessionId = mOlmDevice.createOutboundSession(deviceInfo.identityKey()!!, oneTimeKey.value)

if (!TextUtils.isEmpty(sessionId)) {
Timber.d("## verifyKeyAndStartSession() : Started new sessionid " + sessionId
Timber.v("## verifyKeyAndStartSession() : Started new sessionid " + sessionId
+ " for device " + deviceInfo + "(theirOneTimeKey: " + oneTimeKey.value + ")")
} else {
// Possibly a bad key

View File

@ -39,7 +39,7 @@ internal class EnsureOlmSessionsForUsersAction(private val mOlmDevice: MXOlmDevi
* @param callback the asynchronous callback
*/
fun handle(users: List<String>, callback: MatrixCallback<MXUsersDevicesMap<MXOlmSessionResult>>) {
Timber.d("## ensureOlmSessionsForUsers() : ensureOlmSessionsForUsers $users")
Timber.v("## ensureOlmSessionsForUsers() : ensureOlmSessionsForUsers $users")

val devicesByUser = HashMap<String /* userId */, MutableList<MXDeviceInfo>>()


View File

@ -65,7 +65,7 @@ internal class MegolmSessionDataImporter(private val mOlmDevice: MXOlmDevice,
if (null != decrypting) {
try {
val sessionId = megolmSessionData.sessionId
Timber.d("## importRoomKeys retrieve mSenderKey " + megolmSessionData.senderKey + " sessionId " + sessionId)
Timber.v("## importRoomKeys retrieve mSenderKey " + megolmSessionData.senderKey + " sessionId " + sessionId)

totalNumbersOfImportedKeys++

@ -106,7 +106,7 @@ internal class MegolmSessionDataImporter(private val mOlmDevice: MXOlmDevice,

val t1 = System.currentTimeMillis()

Timber.d("## importMegolmSessionsData : sessions import " + (t1 - t0) + " ms (" + megolmSessionsData.size + " sessions)")
Timber.v("## importMegolmSessionsData : sessions import " + (t1 - t0) + " ms (" + megolmSessionsData.size + " sessions)")

val finalTotalNumbersOfImportedKeys = totalNumbersOfImportedKeys


View File

@ -70,7 +70,7 @@ internal class MessageEncrypter(private val mCredentials: Credentials,
val sessionId = mOlmDevice.getSessionId(deviceKey)

if (!TextUtils.isEmpty(sessionId)) {
Timber.d("Using sessionid $sessionId for device $deviceKey")
Timber.v("Using sessionid $sessionId for device $deviceKey")
val deviceInfo = deviceInfoParticipantKey[deviceKey]

payloadJson["recipient"] = deviceInfo!!.userId

View File

@ -183,7 +183,7 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials,
}

if (mPendingEvents[k]!![timelineId]!!.indexOf(event) < 0) {
Timber.d("## addEventToPendingList() : add Event " + event.eventId + " in room id " + event.roomId)
Timber.v("## addEventToPendingList() : add Event " + event.eventId + " in room id " + event.roomId)
mPendingEvents[k]!![timelineId]!!.add(event)
}
}
@ -207,7 +207,7 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials,
}

if (event.type == EventType.FORWARDED_ROOM_KEY) {
Timber.d("## onRoomKeyEvent(), forward adding key : roomId " + roomKeyContent.roomId + " sessionId " + roomKeyContent.sessionId
Timber.v("## onRoomKeyEvent(), forward adding key : roomId " + roomKeyContent.roomId + " sessionId " + roomKeyContent.sessionId
+ " sessionKey " + roomKeyContent.sessionKey) // from " + event);
val forwardedRoomKeyContent = event.content.toModel<ForwardedRoomKeyContent>()!!

@ -233,7 +233,7 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials,

keysClaimed["ed25519"] = forwardedRoomKeyContent.senderClaimedEd25519Key!!
} else {
Timber.d("## onRoomKeyEvent(), Adding key : roomId " + roomKeyContent.roomId + " sessionId " + roomKeyContent.sessionId
Timber.v("## onRoomKeyEvent(), Adding key : roomId " + roomKeyContent.roomId + " sessionId " + roomKeyContent.sessionId
+ " sessionKey " + roomKeyContent.sessionKey) // from " + event);

if (null == senderKey) {
@ -300,7 +300,7 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials,
TODO()
//mSession!!.onEventDecrypted(event)
}
Timber.d("## onNewSession() : successful re-decryption of " + event.eventId)
Timber.v("## onNewSession() : successful re-decryption of " + event.eventId)
}
}
}
@ -344,7 +344,7 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials,
return
}

Timber.d("## shareKeysWithDevice() : sharing keys for session " + body!!.senderKey + "|" + body.sessionId
Timber.v("## shareKeysWithDevice() : sharing keys for session " + body!!.senderKey + "|" + body.sessionId
+ " with device " + userId + ":" + deviceId)

val inboundGroupSession = mOlmDevice.getInboundGroupSession(body.sessionId, body.senderKey, body.roomId)
@ -357,11 +357,11 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials,
val sendToDeviceMap = MXUsersDevicesMap<Any>()
sendToDeviceMap.setObject(encodedPayload, userId, deviceId)

Timber.d("## shareKeysWithDevice() : sending to $userId:$deviceId")
Timber.v("## shareKeysWithDevice() : sending to $userId:$deviceId")
mSendToDeviceTask.configureWith(SendToDeviceTask.Params(EventType.ENCRYPTED, sendToDeviceMap))
.dispatchTo(object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
Timber.d("## shareKeysWithDevice() : sent to $userId:$deviceId")
Timber.v("## shareKeysWithDevice() : sent to $userId:$deviceId")
}

override fun onFailure(failure: Throwable) {

View File

@ -112,7 +112,7 @@ internal class MXMegolmEncryption(
}

val t0 = System.currentTimeMillis()
Timber.d("## encryptEventContent () starts")
Timber.v("## encryptEventContent () starts")

getDevicesInRoom(userIds, object : MatrixCallback<MXUsersDevicesMap<MXDeviceInfo>> {

@ -136,7 +136,7 @@ internal class MXMegolmEncryption(
override fun onSuccess(devicesInRoom: MXUsersDevicesMap<MXDeviceInfo>) {
ensureOutboundSession(devicesInRoom, object : MatrixCallback<MXOutboundSessionInfo> {
override fun onSuccess(data: MXOutboundSessionInfo) {
Timber.d("## encryptEventContent () processPendingEncryptions after " + (System.currentTimeMillis() - t0) + "ms")
Timber.v("## encryptEventContent () processPendingEncryptions after " + (System.currentTimeMillis() - t0) + "ms")
processPendingEncryptions(data)
}

@ -190,7 +190,7 @@ internal class MXMegolmEncryption(
}

if (mShareOperationIsProgress) {
Timber.d("## ensureOutboundSessionInRoom() : already in progress")
Timber.v("## ensureOutboundSessionInRoom() : already in progress")
// Key share already in progress
return
}
@ -245,7 +245,7 @@ internal class MXMegolmEncryption(
callback: MatrixCallback<Unit>?) {
// nothing to send, the task is done
if (0 == devicesByUsers.size) {
Timber.d("## shareKey() : nothing more to do")
Timber.v("## shareKey() : nothing more to do")

if (null != callback) {
CryptoAsyncHelper.getUiHandler().post { callback.onSuccess(Unit) }
@ -273,7 +273,7 @@ internal class MXMegolmEncryption(
}
}

Timber.d("## shareKey() ; userId $userIds")
Timber.v("## shareKey() ; userId $userIds")
shareUserDevicesKey(session, subMap, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
for (userId in userIds) {
@ -314,11 +314,11 @@ internal class MXMegolmEncryption(
payload["content"] = submap

val t0 = System.currentTimeMillis()
Timber.d("## shareUserDevicesKey() : starts")
Timber.v("## shareUserDevicesKey() : starts")

mEnsureOlmSessionsForDevicesAction.handle(devicesByUser, object : MatrixCallback<MXUsersDevicesMap<MXOlmSessionResult>> {
override fun onSuccess(data: MXUsersDevicesMap<MXOlmSessionResult>) {
Timber.d("## shareUserDevicesKey() : ensureOlmSessionsForDevices succeeds after "
Timber.v("## shareUserDevicesKey() : ensureOlmSessionsForDevices succeeds after "
+ (System.currentTimeMillis() - t0) + " ms")
val contentMap = MXUsersDevicesMap<Any>()

@ -347,7 +347,7 @@ internal class MXMegolmEncryption(
continue
}

Timber.d("## shareUserDevicesKey() : Sharing keys with device $userId:$deviceID")
Timber.v("## shareUserDevicesKey() : Sharing keys with device $userId:$deviceID")
//noinspection ArraysAsListWithZeroOrOneArgument,ArraysAsListWithZeroOrOneArgument
contentMap.setObject(mMessageEncrypter.encryptMessage(payload, Arrays.asList(sessionResult.mDevice)), userId, deviceID)
haveTargets = true
@ -356,12 +356,12 @@ internal class MXMegolmEncryption(

if (haveTargets) {
val t0 = System.currentTimeMillis()
Timber.d("## shareUserDevicesKey() : has target")
Timber.v("## shareUserDevicesKey() : has target")

mSendToDeviceTask.configureWith(SendToDeviceTask.Params(EventType.ENCRYPTED, contentMap))
.dispatchTo(object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
Timber.d("## shareUserDevicesKey() : sendToDevice succeeds after "
Timber.v("## shareUserDevicesKey() : sendToDevice succeeds after "
+ (System.currentTimeMillis() - t0) + " ms")

// Add the devices we have shared with to session.sharedWithDevices.
@ -390,7 +390,7 @@ internal class MXMegolmEncryption(
})
.executeBy(mTaskExecutor)
} else {
Timber.d("## shareUserDevicesKey() : no need to sharekey")
Timber.v("## shareUserDevicesKey() : no need to sharekey")

if (null != callback) {
CryptoAsyncHelper.getUiHandler().post { callback.onSuccess(Unit) }

View File

@ -39,7 +39,7 @@ internal class MXOutboundSessionInfo(
val sessionLifetime = System.currentTimeMillis() - mCreationTime

if (mUseCount >= rotationPeriodMsgs || sessionLifetime >= rotationPeriodMs) {
Timber.d("## needsRotation() : Rotating megolm session after " + mUseCount + ", " + sessionLifetime + "ms")
Timber.v("## needsRotation() : Rotating megolm session after " + mUseCount + ", " + sessionLifetime + "ms")
needsRotation = true
}

@ -57,7 +57,7 @@ internal class MXOutboundSessionInfo(

for (userId in userIds) {
if (null == devicesInRoom.getUserDeviceIds(userId)) {
Timber.d("## sharedWithTooManyDevices() : Starting new session because we shared with $userId")
Timber.v("## sharedWithTooManyDevices() : Starting new session because we shared with $userId")
return true
}

@ -65,7 +65,7 @@ internal class MXOutboundSessionInfo(

for (deviceId in deviceIds!!) {
if (null == devicesInRoom.getObject(deviceId, userId)) {
Timber.d("## sharedWithTooManyDevices() : Starting new session because we shared with $userId:$deviceId")
Timber.v("## sharedWithTooManyDevices() : Starting new session because we shared with $userId:$deviceId")
return true
}
}

View File

@ -184,7 +184,7 @@ internal class MXOlmDecryption(
val payload = mOlmDevice.decryptMessage(messageBody, messageType, sessionId, theirDeviceIdentityKey)

if (null != payload) {
Timber.d("## decryptMessage() : Decrypted Olm message from $theirDeviceIdentityKey with session $sessionId")
Timber.v("## decryptMessage() : Decrypted Olm message from $theirDeviceIdentityKey with session $sessionId")
return payload
} else {
val foundSession = mOlmDevice.matchesSession(theirDeviceIdentityKey, sessionId, messageType, messageBody)
@ -220,7 +220,7 @@ internal class MXOlmDecryption(
return null
}

Timber.d("## decryptMessage() : Created new inbound Olm session get id " + res["session_id"] + " with " + theirDeviceIdentityKey)
Timber.v("## decryptMessage() : Created new inbound Olm session get id " + res["session_id"] + " with " + theirDeviceIdentityKey)

return res["payload"]
}

View File

@ -334,7 +334,7 @@ internal class KeysBackup(
override fun onProgress(progress: Int, total: Int) {
// Reset previous listeners if any
resetBackupAllGroupSessionsListeners()
Timber.d("backupAllGroupSessions: backupProgress: $progress/$total")
Timber.v("backupAllGroupSessions: backupProgress: $progress/$total")
try {
progressListener?.onProgress(progress, total)
} catch (e: Exception) {
@ -342,7 +342,7 @@ internal class KeysBackup(
}

if (progress == total) {
Timber.d("backupAllGroupSessions: complete")
Timber.v("backupAllGroupSessions: complete")
callback?.onSuccess(Unit)
return
}
@ -417,13 +417,13 @@ internal class KeysBackup(
|| authData == null
|| authData.publicKey.isEmpty()
|| authData.signatures.isNullOrEmpty()) {
Timber.d("getKeysBackupTrust: Key backup is absent or missing required data")
Timber.v("getKeysBackupTrust: Key backup is absent or missing required data")
return keysBackupVersionTrust
}

val mySigs: Map<String, *> = authData.signatures!![myUserId] as Map<String, *>
if (mySigs.isEmpty()) {
Timber.d("getKeysBackupTrust: Ignoring key backup because it lacks any signatures from this user")
Timber.v("getKeysBackupTrust: Ignoring key backup because it lacks any signatures from this user")
return keysBackupVersionTrust
}

@ -442,13 +442,13 @@ internal class KeysBackup(
var isSignatureValid = false

if (device == null) {
Timber.d("getKeysBackupTrust: Signature from unknown device $deviceId")
Timber.v("getKeysBackupTrust: Signature from unknown device $deviceId")
} else {
try {
mOlmDevice.verifySignature(device.fingerprint()!!, authData.signalableJSONDictionary(), mySigs[keyId] as String)
isSignatureValid = true
} catch (e: OlmException) {
Timber.d("getKeysBackupTrust: Bad signature from device " + device.deviceId + " " + e.localizedMessage)
Timber.v("getKeysBackupTrust: Bad signature from device " + device.deviceId + " " + e.localizedMessage)
}

if (isSignatureValid && device.isVerified) {
@ -478,7 +478,7 @@ internal class KeysBackup(
override fun trustKeysBackupVersion(keysBackupVersion: KeysVersionResult,
trust: Boolean,
callback: MatrixCallback<Unit>) {
Timber.d("trustKeyBackupVersion: $trust, version ${keysBackupVersion.version}")
Timber.v("trustKeyBackupVersion: $trust, version ${keysBackupVersion.version}")

CryptoAsyncHelper.getDecryptBackgroundHandler().post {
val myUserId = mCredentials.userId
@ -572,7 +572,7 @@ internal class KeysBackup(
override fun trustKeysBackupVersionWithRecoveryKey(keysBackupVersion: KeysVersionResult,
recoveryKey: String,
callback: MatrixCallback<Unit>) {
Timber.d("trustKeysBackupVersionWithRecoveryKey: version ${keysBackupVersion.version}")
Timber.v("trustKeysBackupVersionWithRecoveryKey: version ${keysBackupVersion.version}")

CryptoAsyncHelper.getDecryptBackgroundHandler().post {
if (!isValidRecoveryKeyForKeysBackupVersion(recoveryKey, keysBackupVersion)) {
@ -598,7 +598,7 @@ internal class KeysBackup(
override fun trustKeysBackupVersionWithPassphrase(keysBackupVersion: KeysVersionResult,
password: String,
callback: MatrixCallback<Unit>) {
Timber.d("trustKeysBackupVersionWithPassphrase: version ${keysBackupVersion.version}")
Timber.v("trustKeysBackupVersionWithPassphrase: version ${keysBackupVersion.version}")

CryptoAsyncHelper.getDecryptBackgroundHandler().post {
val recoveryKey = recoveryKeyFromPassword(password, keysBackupVersion, null)
@ -686,7 +686,7 @@ internal class KeysBackup(
sessionId: String?,
stepProgressListener: StepProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>) {
Timber.d("restoreKeysWithRecoveryKey: From backup version: ${keysVersionResult.version}")
Timber.v("restoreKeysWithRecoveryKey: From backup version: ${keysVersionResult.version}")

CryptoAsyncHelper.getDecryptBackgroundHandler().post(Runnable {
// Check if the recovery is valid before going any further
@ -728,13 +728,13 @@ internal class KeysBackup(
}
}
}
Timber.d("restoreKeysWithRecoveryKey: Decrypted " + sessionsData.size + " keys out of "
Timber.v("restoreKeysWithRecoveryKey: Decrypted " + sessionsData.size + " keys out of "
+ sessionsFromHsCount + " from the backup store on the homeserver")

// Do not trigger a backup for them if they come from the backup version we are using
val backUp = keysVersionResult.version != mKeysBackupVersion?.version
if (backUp) {
Timber.d("restoreKeysWithRecoveryKey: Those keys will be backed up to backup version: " + mKeysBackupVersion?.version)
Timber.v("restoreKeysWithRecoveryKey: Those keys will be backed up to backup version: " + mKeysBackupVersion?.version)
}

// Import them into the crypto store
@ -788,7 +788,7 @@ internal class KeysBackup(
sessionId: String?,
stepProgressListener: StepProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>) {
Timber.d("[MXKeyBackup] restoreKeyBackup with password: From backup version: ${keysBackupVersion.version}")
Timber.v("[MXKeyBackup] restoreKeyBackup with password: From backup version: ${keysBackupVersion.version}")

CryptoAsyncHelper.getDecryptBackgroundHandler().post {
val progressListener = if (stepProgressListener != null) {
@ -807,7 +807,7 @@ internal class KeysBackup(

if (recoveryKey == null) {
mUIHandler.post {
Timber.d("backupKeys: Invalid configuration")
Timber.v("backupKeys: Invalid configuration")
callback.onFailure(IllegalStateException("Invalid configuration"))
}

@ -918,7 +918,7 @@ internal class KeysBackup(
mUIHandler.postDelayed({ backupKeys() }, delayInMs)
}
else -> {
Timber.d("maybeBackupKeys: Skip it because state: $state")
Timber.v("maybeBackupKeys: Skip it because state: $state")
}
}
}
@ -1062,12 +1062,12 @@ internal class KeysBackup(
}

private fun checkAndStartWithKeysBackupVersion(keyBackupVersion: KeysVersionResult?) {
Timber.d("checkAndStartWithKeyBackupVersion: ${keyBackupVersion?.version}")
Timber.v("checkAndStartWithKeyBackupVersion: ${keyBackupVersion?.version}")

mKeysBackupVersion = keyBackupVersion

if (keyBackupVersion == null) {
Timber.d("checkAndStartWithKeysBackupVersion: Found no key backup version on the homeserver")
Timber.v("checkAndStartWithKeysBackupVersion: Found no key backup version on the homeserver")
resetKeysBackupData()
mKeysBackupStateManager.state = KeysBackupState.Disabled
} else {
@ -1077,19 +1077,19 @@ internal class KeysBackup(
val versionInStore = mCryptoStore.getKeyBackupVersion()

if (data.usable) {
Timber.d("checkAndStartWithKeysBackupVersion: Found usable key backup. version: " + keyBackupVersion.version)
Timber.v("checkAndStartWithKeysBackupVersion: Found usable key backup. version: " + keyBackupVersion.version)
// Check the version we used at the previous app run
if (versionInStore != null && versionInStore != keyBackupVersion.version) {
Timber.d(" -> clean the previously used version $versionInStore")
Timber.v(" -> clean the previously used version $versionInStore")
resetKeysBackupData()
}

Timber.d(" -> enabling key backups")
Timber.v(" -> enabling key backups")
enableKeysBackup(keyBackupVersion)
} else {
Timber.d("checkAndStartWithKeysBackupVersion: No usable key backup. version: " + keyBackupVersion.version)
Timber.v("checkAndStartWithKeysBackupVersion: No usable key backup. version: " + keyBackupVersion.version)
if (versionInStore != null) {
Timber.d(" -> disabling key backup")
Timber.v(" -> disabling key backup")
resetKeysBackupData()
}

@ -1273,11 +1273,11 @@ internal class KeysBackup(
*/
@UiThread
private fun backupKeys() {
Timber.d("backupKeys")
Timber.v("backupKeys")

// Sanity check, as this method can be called after a delay, the state may have change during the delay
if (!isEnabled || mBackupKey == null || mKeysBackupVersion == null) {
Timber.d("backupKeys: Invalid configuration")
Timber.v("backupKeys: Invalid configuration")
backupAllGroupSessionsCallback?.onFailure(IllegalStateException("Invalid configuration"))
resetBackupAllGroupSessionsListeners()

@ -1286,14 +1286,14 @@ internal class KeysBackup(

if (state === KeysBackupState.BackingUp) {
// Do nothing if we are already backing up
Timber.d("backupKeys: Invalid state: $state")
Timber.v("backupKeys: Invalid state: $state")
return
}

// Get a chunk of keys to backup
val sessions = mCryptoStore.inboundGroupSessionsToBackup(KEY_BACKUP_SEND_KEYS_MAX_COUNT)

Timber.d("backupKeys: 1 - " + sessions.size + " sessions to back up")
Timber.v("backupKeys: 1 - " + sessions.size + " sessions to back up")

if (sessions.isEmpty()) {
// Backup is up to date
@ -1307,7 +1307,7 @@ internal class KeysBackup(
mKeysBackupStateManager.state = KeysBackupState.BackingUp

CryptoAsyncHelper.getEncryptBackgroundHandler().post {
Timber.d("backupKeys: 2 - Encrypting keys")
Timber.v("backupKeys: 2 - Encrypting keys")

// Gather data to send to the homeserver
// roomId -> sessionId -> MXKeyBackupData
@ -1329,7 +1329,7 @@ internal class KeysBackup(
}
}

Timber.d("backupKeys: 4 - Sending request")
Timber.v("backupKeys: 4 - Sending request")

// Make the request
mStoreSessionDataTask
@ -1337,19 +1337,19 @@ internal class KeysBackup(
.dispatchTo(object : MatrixCallback<BackupKeysResult> {
override fun onSuccess(data: BackupKeysResult) {
mUIHandler.post {
Timber.d("backupKeys: 5a - Request complete")
Timber.v("backupKeys: 5a - Request complete")

// Mark keys as backed up
mCryptoStore.markBackupDoneForInboundGroupSessions(sessions)

if (sessions.size < KEY_BACKUP_SEND_KEYS_MAX_COUNT) {
Timber.d("backupKeys: All keys have been backed up")
Timber.v("backupKeys: All keys have been backed up")
onServerDataRetrieved(data.count, data.hash)

// Note: Changing state will trigger the call to backupAllGroupSessionsCallback.onSuccess()
mKeysBackupStateManager.state = KeysBackupState.ReadyToBackUp
} else {
Timber.d("backupKeys: Continue to back up keys")
Timber.v("backupKeys: Continue to back up keys")
mKeysBackupStateManager.state = KeysBackupState.WillBackUp

backupKeys()

View File

@ -133,7 +133,7 @@ private fun deriveKey(password: String,
}
}

Timber.d("KeysBackupPassword", "## deriveKeys() : " + iterations + " in " + (System.currentTimeMillis() - t0) + " ms")
Timber.v("KeysBackupPassword", "## deriveKeys() : " + iterations + " in " + (System.currentTimeMillis() - t0) + " ms")

return dk
}

View File

@ -29,7 +29,7 @@ internal class KeysBackupStateManager(private val uiHandler: Handler) {
// Backup state
var state = KeysBackupState.Unknown
set(newState) {
Timber.d("KeysBackup", "setState: $field -> $newState")
Timber.v("KeysBackup", "setState: $field -> $newState")

field = newState


View File

@ -25,6 +25,6 @@ internal object RealmCryptoStoreMigration : RealmMigration {
const val CRYPTO_STORE_SCHEMA_VERSION = 0L

override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
Timber.d("Migrating Realm Crypto from $oldVersion to $newVersion")
Timber.v("Migrating Realm Crypto from $oldVersion to $newVersion")
}
}

View File

@ -164,17 +164,17 @@ internal class DefaultSasVerificationService(private val mCredentials: Credentia
otherUserId!!,
startReq,
success = {
Timber.d("## SAS onStartRequestReceived ${startReq.transactionID!!}")
Timber.v("## SAS onStartRequestReceived ${startReq.transactionID!!}")
val tid = startReq.transactionID!!
val existing = getExistingTransaction(otherUserId, tid)
val existingTxs = getExistingTransactionsForUser(otherUserId)
if (existing != null) {
//should cancel both!
Timber.d("## SAS onStartRequestReceived - Request exist with same if ${startReq.transactionID!!}")
Timber.v("## SAS onStartRequestReceived - Request exist with same if ${startReq.transactionID!!}")
existing.cancel(CancelCode.UnexpectedMessage)
cancelTransaction(tid, otherUserId, startReq.fromDevice!!, CancelCode.UnexpectedMessage)
} else if (existingTxs?.isEmpty() == false) {
Timber.d("## SAS onStartRequestReceived - There is already a transaction with this user ${startReq.transactionID!!}")
Timber.v("## SAS onStartRequestReceived - There is already a transaction with this user ${startReq.transactionID!!}")
//Multiple keyshares between two devices: any two devices may only have at most one key verification in flight at a time.
existingTxs.forEach {
it.cancel(CancelCode.UnexpectedMessage)
@ -183,7 +183,7 @@ internal class DefaultSasVerificationService(private val mCredentials: Credentia
} else {
//Ok we can create
if (KeyVerificationStart.VERIF_METHOD_SAS == startReq.method) {
Timber.d("## SAS onStartRequestReceived - request accepted ${startReq.transactionID!!}")
Timber.v("## SAS onStartRequestReceived - request accepted ${startReq.transactionID!!}")
val tx = IncomingSASVerificationTransaction(
this,
setDeviceVerificationAction,
@ -232,7 +232,7 @@ internal class DefaultSasVerificationService(private val mCredentials: Credentia
}

private fun onCancelReceived(event: Event) {
Timber.d("## SAS onCancelReceived")
Timber.v("## SAS onCancelReceived")
val cancelReq = event.content.toModel<KeyVerificationCancel>()!!

if (!cancelReq.isValid()) {
@ -242,7 +242,7 @@ internal class DefaultSasVerificationService(private val mCredentials: Credentia
}
val otherUserId = event.sender!!

Timber.d("## SAS onCancelReceived otherUser:$otherUserId reason:${cancelReq.reason}")
Timber.v("## SAS onCancelReceived otherUser:$otherUserId reason:${cancelReq.reason}")
val existing = getExistingTransaction(otherUserId, cancelReq.transactionID!!)
if (existing == null) {
Timber.e("## Received invalid cancel request")
@ -415,7 +415,7 @@ internal class DefaultSasVerificationService(private val mCredentials: Credentia
mSendToDeviceTask.configureWith(SendToDeviceTask.Params(EventType.KEY_VERIFICATION_CANCEL, contentMap, transactionId))
.dispatchTo(object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
Timber.d("## SAS verification [$transactionId] canceled for reason ${code.value}")
Timber.v("## SAS verification [$transactionId] canceled for reason ${code.value}")
}

override fun onFailure(failure: Throwable) {

View File

@ -80,7 +80,7 @@ internal class IncomingSASVerificationTransaction(
}

override fun onVerificationStart(startReq: KeyVerificationStart) {
Timber.d("## SAS received verification request from state $state")
Timber.v("## SAS received verification request from state $state")
if (state != SasVerificationTxState.None) {
Timber.e("## received verification request from invalid state")
//should I cancel??
@ -148,7 +148,7 @@ internal class IncomingSASVerificationTransaction(

private fun doAccept(accept: KeyVerificationAccept) {
this.accepted = accept
Timber.d("## SAS accept request id:$transactionId")
Timber.v("## SAS accept request id:$transactionId")

//The hash commitment is the hash (using the selected hash algorithm) of the unpadded base64 representation of QB,
// concatenated with the canonical JSON representation of the content of the m.key.verification.start message
@ -166,12 +166,12 @@ internal class IncomingSASVerificationTransaction(


override fun onVerificationAccept(accept: KeyVerificationAccept) {
Timber.d("## SAS invalid message for incoming request id:$transactionId")
Timber.v("## SAS invalid message for incoming request id:$transactionId")
cancel(CancelCode.UnexpectedMessage)
}

override fun onKeyVerificationKey(userId: String, vKey: KeyVerificationKey) {
Timber.d("## SAS received key for request id:$transactionId")
Timber.v("## SAS received key for request id:$transactionId")
if (state != SasVerificationTxState.SendingAccept && state != SasVerificationTxState.Accepted) {
Timber.e("## received key from invalid state $state")
cancel(CancelCode.UnexpectedMessage)
@ -222,7 +222,7 @@ internal class IncomingSASVerificationTransaction(
}

override fun onKeyVerificationMac(vKey: KeyVerificationMac) {
Timber.d("## SAS received mac for request id:$transactionId")
Timber.v("## SAS received mac for request id:$transactionId")
//Check for state?
if (state != SasVerificationTxState.SendingKey
&& state != SasVerificationTxState.KeySent

View File

@ -117,7 +117,7 @@ internal class OutgoingSASVerificationRequest(
}

override fun onVerificationAccept(accept: KeyVerificationAccept) {
Timber.d("## onVerificationAccept id:$transactionId")
Timber.v("## onVerificationAccept id:$transactionId")
if (state != SasVerificationTxState.Started) {
Timber.e("## received accept request from invalid state $state")
cancel(CancelCode.UnexpectedMessage)
@ -154,7 +154,7 @@ internal class OutgoingSASVerificationRequest(
}

override fun onKeyVerificationKey(userId: String, vKey: KeyVerificationKey) {
Timber.d("## onKeyVerificationKey id:$transactionId")
Timber.v("## onKeyVerificationKey id:$transactionId")
if (state != SasVerificationTxState.SendingKey && state != SasVerificationTxState.KeySent) {
Timber.e("## received key from invalid state $state")
cancel(CancelCode.UnexpectedMessage)
@ -196,7 +196,7 @@ internal class OutgoingSASVerificationRequest(
}

override fun onKeyVerificationMac(vKey: KeyVerificationMac) {
Timber.d("## onKeyVerificationMac id:$transactionId")
Timber.v("## onKeyVerificationMac id:$transactionId")
if (state != SasVerificationTxState.OnKeyReceived
&& state != SasVerificationTxState.ShortCodeReady
&& state != SasVerificationTxState.ShortCodeAccepted

View File

@ -125,7 +125,7 @@ internal abstract class SASVerificationTransaction(
* both short codes do match
*/
override fun userHasVerifiedShortCode() {
Timber.d("## SAS short code verified by user for id:$transactionId")
Timber.v("## SAS short code verified by user for id:$transactionId")
if (state != SasVerificationTxState.ShortCodeReady) {
//ignore and cancel?
Timber.e("## Accepted short code from invalid state $state")
@ -199,7 +199,7 @@ internal abstract class SASVerificationTransaction(
abstract fun onKeyVerificationMac(vKey: KeyVerificationMac)

protected fun verifyMacs() {
Timber.d("## SAS verifying macs for id:$transactionId")
Timber.v("## SAS verifying macs for id:$transactionId")
state = SasVerificationTxState.Verifying

//Keys have been downloaded earlier in process
@ -277,7 +277,7 @@ internal abstract class SASVerificationTransaction(
mSendToDeviceTask.configureWith(SendToDeviceTask.Params(type, contentMap, transactionId))
.dispatchTo(object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
Timber.d("## SAS verification [$transactionId] toDevice type '$type' success.")
Timber.v("## SAS verification [$transactionId] toDevice type '$type' success.")
CryptoAsyncHelper.getDecryptBackgroundHandler().post {
if (onDone != null) {
onDone()

View File

@ -119,7 +119,7 @@ internal class SyncThread(private val syncTask: SyncTask,
if (failure is Failure.NetworkConnection
&& failure.cause is SocketTimeoutException) {
// Timeout are not critical
Timber.d("Timeout")
Timber.v("Timeout")
} else {
Timber.e(failure)
}

View File

@ -42,14 +42,14 @@ internal class BackgroundDetectionObserver : LifecycleObserver {

@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onMoveToForeground() {
Timber.d("App returning to foreground…")
Timber.v("App returning to foreground…")
isIsBackground = false
listeners.forEach { it.onMoveToForeground() }
}

@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onMoveToBackground() {
Timber.d("App going to background…")
Timber.v("App going to background…")
isIsBackground = true
listeners.forEach { it.onMoveToBackground() }
}

View File

@ -28,7 +28,7 @@ import timber.log.Timber
class DebugReceiver : BroadcastReceiver() {

override fun onReceive(context: Context, intent: Intent) {
Timber.d("Received debug action: ${intent.action}")
Timber.v("Received debug action: ${intent.action}")

intent.action?.let {
when {
@ -44,11 +44,11 @@ class DebugReceiver : BroadcastReceiver() {
}

private fun logPrefs(name: String, sharedPreferences: SharedPreferences?) {
Timber.d("SharedPreferences $name:")
Timber.v("SharedPreferences $name:")

sharedPreferences?.let { prefs ->
prefs.all.keys.forEach { key ->
Timber.d("$key : ${prefs.all[key]}")
Timber.v("$key : ${prefs.all[key]}")
}
}
}

View File

@ -26,7 +26,7 @@ public class OnApplicationUpgradeReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
Timber.d("## onReceive() : Application has been upgraded, restart event stream service.");
Timber.v("## onReceive() : Application has been upgraded, restart event stream service.");

// Start Event stream
// TODO EventStreamServiceX.Companion.onApplicationUpgrade(context);

View File

@ -94,7 +94,7 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
}

override fun onDeletedMessages() {
Timber.d("## onDeletedMessages()")
Timber.v("## onDeletedMessages()")
}

/**

View File

@ -138,7 +138,7 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
override fun onResume() {
super.onResume()

Timber.d("onResume Activity ${this.javaClass.simpleName}")
Timber.v("onResume Activity ${this.javaClass.simpleName}")

if (this !is BugReportActivity) {
rageShake?.start()

View File

@ -62,7 +62,7 @@ abstract class VectorBaseFragment : BaseMvRxFragment(), OnBackPressed {
override fun onResume() {
super.onResume()

Timber.d("onResume Fragment ${this.javaClass.simpleName}")
Timber.v("onResume Fragment ${this.javaClass.simpleName}")
}

@CallSuper

View File

@ -36,7 +36,7 @@ abstract class VectorPreferenceFragment : PreferenceFragmentCompat() {
override fun onResume() {
super.onResume()

Timber.d("onResume Fragment ${this.javaClass.simpleName}")
Timber.v("onResume Fragment ${this.javaClass.simpleName}")
}

/* ==========================================================================================

View File

@ -70,20 +70,20 @@ class CallService : VectorService() {
* @param callId the callId
*/
private fun displayIncomingCallNotification(intent: Intent) {
Timber.d("displayIncomingCallNotification")
Timber.v("displayIncomingCallNotification")

// TODO
/*

// the incoming call in progress is already displayed
if (!TextUtils.isEmpty(mIncomingCallId)) {
Timber.d("displayIncomingCallNotification : the incoming call in progress is already displayed")
Timber.v("displayIncomingCallNotification : the incoming call in progress is already displayed")
} else if (!TextUtils.isEmpty(mCallIdInProgress)) {
Timber.d("displayIncomingCallNotification : a 'call in progress' notification is displayed")
Timber.v("displayIncomingCallNotification : a 'call in progress' notification is displayed")
} else if (null == CallsManager.getSharedInstance().activeCall) {
val callId = intent.getStringExtra(EXTRA_CALL_ID)

Timber.d("displayIncomingCallNotification : display the dedicated notification")
Timber.v("displayIncomingCallNotification : display the dedicated notification")
val notification = NotificationUtils.buildIncomingCallNotification(
this,
intent.getBooleanExtra(EXTRA_IS_VIDEO, false),

View File

@ -469,7 +469,7 @@ class EventStreamServiceX : VectorService() {
// But it could be triggered because of multi accounts management.
// The dedicated account is removing but some pushes are still received.
if (null == session || !session.isAlive) {
Timber.d("prepareCallNotification : don't bing - no session")
Timber.v("prepareCallNotification : don't bing - no session")
return
}


View File

@ -83,10 +83,10 @@ class KeysBackupBanner @JvmOverloads constructor(
*/
fun render(newState: State, force: Boolean = false) {
if (newState == state && !force) {
Timber.d("State unchanged")
Timber.v("State unchanged")
return
}
Timber.d("Rendering $newState")
Timber.v("Rendering $newState")

state = newState


View File

@ -164,9 +164,9 @@ fun openCamera(activity: Activity, titlePrefix: String, requestCode: Int): Strin

if (dummyUri != null) {
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, dummyUri)
Timber.d("trying to take a photo on " + dummyUri.toString())
Timber.v("trying to take a photo on " + dummyUri.toString())
} else {
Timber.d("trying to take a photo with no predefined uri")
Timber.v("trying to take a photo with no predefined uri")
}

// Store the dummy URI which will be set to a placeholder location. When all is lost on Samsung devices,

View File

@ -59,9 +59,9 @@ fun lsFiles(context: Context) {

private fun logAction(file: File): Boolean {
if (file.isDirectory) {
Timber.d(file.toString())
Timber.v(file.toString())
} else {
Timber.d(file.toString() + " " + file.length() + " bytes")
Timber.v(file.toString() + " " + file.length() + " bytes")
}
return true
}

View File

@ -78,10 +78,10 @@ fun logPermissionStatuses(context: Context) {
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_CONTACTS)

Timber.d("## logPermissionStatuses() : log the permissions status used by the app")
Timber.v("## logPermissionStatuses() : log the permissions status used by the app")

for (permission in permissions) {
Timber.d(("Status of [$permission] : " +
Timber.v(("Status of [$permission] : " +
if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(context, permission))
"PERMISSION_GRANTED"
else
@ -244,7 +244,7 @@ private fun checkPermissions(permissionsToBeGrantedBitMap: Int,
}
explanationMessage += activity.getString(R.string.permissions_rationale_msg_contacts)
}
else -> Timber.d("## checkPermissions(): already denied permission not supported")
else -> Timber.v("## checkPermissions(): already denied permission not supported")
}
}
}

View File

@ -125,7 +125,7 @@ object BadgeProxy {
}

// update the badge counter
Timber.d("## updateBadgeCount(): badge update count=$unreadRoomsCount")
Timber.v("## updateBadgeCount(): badge update count=$unreadRoomsCount")
updateBadgeCount(aContext, unreadRoomsCount)
}
*/

View File

@ -32,7 +32,7 @@ object CommandParser {
if (!textMessage.startsWith("/")) {
return ParsedCommand.ErrorNotACommand
} else {
Timber.d("parseSplashCommand")
Timber.v("parseSplashCommand")

// "/" only
if (textMessage.length == 1) {

View File

@ -105,7 +105,7 @@ class KeysBackupRestoreFromKeyViewModel : ViewModel() {
object : MatrixCallback<Unit> {

override fun onSuccess(data: Unit) {
Timber.d("##### trustKeysBackupVersion onSuccess")
Timber.v("##### trustKeysBackupVersion onSuccess")
}

})

View File

@ -112,7 +112,7 @@ class KeysBackupRestoreFromPassphraseViewModel : ViewModel() {
object : MatrixCallback<Unit> {

override fun onSuccess(data: Unit) {
Timber.d("##### trustKeysBackupVersion onSuccess")
Timber.v("##### trustKeysBackupVersion onSuccess")
}

})

View File

@ -36,7 +36,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver(), KoinComponent {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent == null || context == null) return

Timber.d("ReplyNotificationBroadcastReceiver received : $intent")
Timber.v("ReplyNotificationBroadcastReceiver received : $intent")

when (intent.action) {
NotificationUtils.SMART_REPLY_ACTION ->
@ -102,7 +102,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver(), KoinComponent {
room.storeOutgoingEvent(event)
room.sendEvent(event, object : MatrixCallback<Void?> {
override fun onSuccess(info: Void?) {
Timber.d("Send message : onSuccess ")
Timber.v("Send message : onSuccess ")
val notifiableMessageEvent = NotifiableMessageEvent(
event.eventId,
false,
@ -120,12 +120,12 @@ class NotificationBroadcastReceiver : BroadcastReceiver(), KoinComponent {
}

override fun onNetworkError(e: Exception) {
Timber.d("Send message : onNetworkError " + e.message, e)
Timber.v("Send message : onNetworkError " + e.message, e)
onSmartReplyFailed(e.localizedMessage)
}

override fun onMatrixError(e: MatrixError) {
Timber.d("Send message : onMatrixError " + e.message)
Timber.v("Send message : onMatrixError " + e.message)
if (e is MXCryptoError) {
Toast.makeText(context, e.detailedErrorDescription, Toast.LENGTH_SHORT).show()
onSmartReplyFailed(e.detailedErrorDescription)

View File

@ -89,7 +89,7 @@ class NotificationDrawerManager(val context: Context) {
//If we support multi session, event list should be per userId
//Currently only manage single session
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
Timber.d("%%%%%%%% onNotifiableEventReceived $notifiableEvent")
Timber.v("%%%%%%%% onNotifiableEventReceived $notifiableEvent")
}
synchronized(eventList) {
val existing = eventList.firstOrNull { it.eventId == notifiableEvent.eventId }
@ -128,7 +128,7 @@ class NotificationDrawerManager(val context: Context) {

/** Clear all known message events for this room and refresh the notification drawer */
fun clearMessageEventOfRoom(roomId: String?) {
Timber.d("clearMessageEventOfRoom $roomId")
Timber.v("clearMessageEventOfRoom $roomId")

if (roomId != null) {
eventList.removeAll { e ->
@ -190,7 +190,7 @@ class NotificationDrawerManager(val context: Context) {

synchronized(eventList) {

Timber.d("%%%%%%%% REFRESH NOTIFICATION DRAWER ")
Timber.v("%%%%%%%% REFRESH NOTIFICATION DRAWER ")
//TMP code
var hasNewEvent = false
var summaryIsNoisy = false
@ -224,7 +224,7 @@ class NotificationDrawerManager(val context: Context) {
}


Timber.d("%%%%%%%% REFRESH NOTIFICATION DRAWER ${roomIdToEventMap.size} room groups")
Timber.v("%%%%%%%% REFRESH NOTIFICATION DRAWER ${roomIdToEventMap.size} room groups")

var globalLastMessageTimestamp = 0L

@ -233,7 +233,7 @@ class NotificationDrawerManager(val context: Context) {

if (events.isEmpty()) {
//Just clear this notification
Timber.d("%%%%%%%% REFRESH NOTIFICATION DRAWER $roomId has no more events")
Timber.v("%%%%%%%% REFRESH NOTIFICATION DRAWER $roomId has no more events")
NotificationUtils.cancelNotificationMessage(context, roomId, ROOM_MESSAGES_NOTIFICATION_ID)
continue
}
@ -292,13 +292,13 @@ class NotificationDrawerManager(val context: Context) {
summaryInboxStyle.addLine(summaryLine)
} catch (e: Throwable) {
//String not found or bad format
Timber.d("%%%%%%%% REFRESH NOTIFICATION DRAWER failed to resolve string")
Timber.v("%%%%%%%% REFRESH NOTIFICATION DRAWER failed to resolve string")
summaryInboxStyle.addLine(roomName)
}

if (firstTime || roomGroup.hasNewEvent) {
//Should update displayed notification
Timber.d("%%%%%%%% REFRESH NOTIFICATION DRAWER $roomId need refresh")
Timber.v("%%%%%%%% REFRESH NOTIFICATION DRAWER $roomId need refresh")
val lastMessageTimestamp = events.last().timestamp

if (globalLastMessageTimestamp < lastMessageTimestamp) {
@ -314,7 +314,7 @@ class NotificationDrawerManager(val context: Context) {
hasNewEvent = true
summaryIsNoisy = summaryIsNoisy || roomGroup.shouldBing
} else {
Timber.d("%%%%%%%% REFRESH NOTIFICATION DRAWER $roomId is up to date")
Timber.v("%%%%%%%% REFRESH NOTIFICATION DRAWER $roomId is up to date")
}
}


View File

@ -35,7 +35,7 @@ class OutdatedEventDetector(val context: Context) {
if (session.isAlive) {
session.dataHandler.getRoom(roomID)?.let { room ->
if (room.isEventRead(eventID)) {
Timber.d("Notifiable Event $eventID is read, and should be removed")
Timber.v("Notifiable Event $eventID is read, and should be removed")
return true
}
}

View File

@ -296,7 +296,7 @@ object BugReporter {
mBugReportCall!!.cancel()
}

Timber.d("## onWrite() : $percentage%")
Timber.v("## onWrite() : $percentage%")
publishProgress(percentage)
}

@ -638,7 +638,7 @@ object BugReporter {
* @return the gzipped file
*/
private fun compressFile(fin: File): File? {
Timber.d("## compressFile() : compress " + fin.name)
Timber.v("## compressFile() : compress " + fin.name)

val dstFile = File(fin.parent, fin.name + ".gz")

@ -665,7 +665,7 @@ object BugReporter {
gos.close()
inputStream.close()

Timber.d("## compressFile() : " + fin.length() + " compressed to " + dstFile.length() + " bytes")
Timber.v("## compressFile() : " + fin.length() + " compressed to " + dstFile.length() + " bytes")
return dstFile
} catch (e: Exception) {
Timber.e(e, "## compressFile() failed " + e.message)

View File

@ -410,7 +410,7 @@ public class PreferencesManager {
uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
}

Timber.d("## getNotificationRingTone() returns " + uri);
Timber.v("## getNotificationRingTone() returns " + uri);
return uri;
}


View File

@ -1159,7 +1159,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
val matrixInstance = Matrix.getInstance(context)
val pushManager = matrixInstance.pushManager

Timber.d("onPushRuleClick $preferenceKey : set to $newValue")
Timber.v("onPushRuleClick $preferenceKey : set to $newValue")

when (preferenceKey) {