Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.19.2 #1643

Merged
merged 70 commits into from
Aug 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
9c3513f
Merge pull request #1563 from oxen-io/release/1.18.5
ThomasSession Jul 23, 2024
8ad7005
Adding back the fullscreen intent permission
ThomasSession Jul 23, 2024
fc5c7a7
Merge pull request #1566 from oxen-io/release/1.18.6
ThomasSession Jul 24, 2024
631d93c
Replace kapt with ksp and update dependencies (#1560)
simophin Jul 24, 2024
0a08eb6
Fix leak Response body
Jul 24, 2024
64c7224
Merge pull request #1568 from bemusementpark/fix-body
bemusementpark Jul 25, 2024
ac4f252
Fix longpress message fails
Jul 25, 2024
a495ec2
Merge pull request #1570 from bemusementpark/longpress
ThomasSession Jul 25, 2024
dec02ce
Fix double closing on memory file (#1579)
simophin Jul 29, 2024
fbbef48
Merge pull request #1564 from oxen-io/feature/adding-back-fullscreen-…
ThomasSession Jul 31, 2024
60c111d
Removing the snodes version patch
ThomasSession Jul 31, 2024
137a26c
KeepAliveService doesn't seem to be used anywhere
ThomasSession Aug 1, 2024
33f23e5
Another unused or referenced service
ThomasSession Aug 1, 2024
2a5f86e
Merge pull request #1587 from oxen-io/feature/remove-snode-version-patch
ThomasSession Aug 1, 2024
2f135a6
Cleaning up foreground service calls
ThomasSession Aug 1, 2024
d8bcb83
Fix app exit after Lock Screen
Jul 27, 2024
268b6cc
Fix crashes on conversation screen (#1590)
simophin Aug 1, 2024
fb7c24a
Update app/src/main/java/org/thoughtcrime/securesms/service/KeyCachin…
ThomasSession Aug 1, 2024
7dcfba4
Update app/src/main/java/org/thoughtcrime/securesms/service/KeyCachin…
ThomasSession Aug 1, 2024
e71f650
Update app/src/main/java/org/thoughtcrime/securesms/service/WebRtcCal…
ThomasSession Aug 1, 2024
a56e1d0
Merge pull request #1591 from oxen-io/feature/service-clean-up
ThomasSession Aug 1, 2024
b93ec3b
Optimise Snode and Snode.Version
Aug 2, 2024
41ab9b9
Updated logic for hiding the input in conversation
ThomasSession Aug 2, 2024
9ce3ab4
Added a background to emoji variations popup
ThomasSession Aug 2, 2024
482f169
Refactor SnodeApi
Aug 2, 2024
48554fa
[SES-2494] Applying proper styling for message request
ThomasSession Aug 2, 2024
c1d40cd
Optimise SnodesAPI
Aug 3, 2024
3c8302f
Optimise SnodeAPI further
Aug 3, 2024
6e1ed8c
Add SnodeTest
Aug 3, 2024
5417660
Improve Version to cap parts at 16-bits rather than masking them
Aug 3, 2024
2125502
Refactor a few MessagingModuleConfiguration function calls
Aug 3, 2024
61cb602
Simplify and document some functions
Aug 3, 2024
f5d1deb
Add shared SecureRandom instance
Aug 3, 2024
cd1a064
Merge pull request #1596 from oxen-io/feature/clean-ups
ThomasSession Aug 5, 2024
fa0abef
Fix Snode Version CACHE usage
Aug 5, 2024
f9ace6a
Add LruCache and thread-safety
Aug 5, 2024
415264e
Merge pull request #1594 from bemusementpark/shared-random
bemusementpark Aug 5, 2024
2960edd
Fix removeDuplicates
Aug 5, 2024
41f5fcc
Merge branch 'dev' into more-snodes
Aug 5, 2024
982e23b
Merge branch 'dev' into release/1.19.0
ThomasSession Aug 5, 2024
8a9faa1
Fix SnodeAPI error thrown outside of Promise
Aug 5, 2024
c6c1aa6
Merge pull request #1597 from oxen-io/release/1.19.0
ThomasSession Aug 5, 2024
d6c5ab2
Merge pull request #1593 from bemusementpark/more-snodes
bemusementpark Aug 5, 2024
f865f9f
Merge branch 'dev' into merge/1.19.0
ThomasSession Aug 8, 2024
007e705
Merge pull request #1607 from oxen-io/merge/1.19.0
ThomasSession Aug 8, 2024
50929b8
Merge remote-tracking branch 'origin/dev' into release/1.19.1
Aug 14, 2024
5a248da
Merge pull request #1618 from oxen-io/release/1.19.1
simophin Aug 14, 2024
93a2890
Removing unrequired APi checks (#1620)
ThomasSession Aug 15, 2024
bc6718e
Feature/resource cleanup (#1623)
ThomasSession Aug 18, 2024
f379604
Feature/convo capitalised (#1624)
ThomasSession Aug 18, 2024
16d6efb
SES-2524 - Rewrite media gallery in Compose (#1619)
simophin Aug 19, 2024
8093393
Removing unsed UI tests (#1625)
ThomasSession Aug 19, 2024
2a438ac
Add missing play button on media gallery page (#1626)
simophin Aug 19, 2024
6701cb1
SES-2437 - fix broken path animation (#1627)
ThomasSession Aug 19, 2024
9919f71
[SES-2512] Rewrite ProfilePictureView (#1622)
simophin Aug 19, 2024
43c6e86
Bumped version code
ThomasSession Aug 20, 2024
8fc6679
Revert "[SES-2512] Rewrite ProfilePictureView (#1622)" (#1629)
simophin Aug 20, 2024
70f217c
Using open documents so that the downloads can be accessed (#1631)
ThomasSession Aug 21, 2024
ab2e374
Replaced MLKit with ZXing for QR code scanning (#1630)
AL-Session Aug 21, 2024
eea54d1
Add back action mode title (#1633)
simophin Aug 21, 2024
d5ff61f
[SES-2574] Fix crash on gallery screen (#1632)
simophin Aug 21, 2024
0fa8a6e
Merge branch 'dev' into release/1.19.2
ThomasSession Aug 21, 2024
245241e
Fix search ANR (#1634)
simophin Aug 21, 2024
e731c7d
Fix/ip2 country out of memory (#1628)
ThomasSession Aug 21, 2024
b14f8f6
Using the proper icon (#1635)
ThomasSession Aug 21, 2024
20e1fbc
Merge branch 'dev' into release/1.19.2
ThomasSession Aug 21, 2024
8e10e1a
Incorrect copy for denied permission (#1636)
simophin Aug 22, 2024
55c49ec
Merge branch 'dev' into release/1.19.2
ThomasSession Aug 22, 2024
afbb713
Applied save-crash workaround (#1640)
AL-Session Aug 23, 2024
a50e304
Removing resources
ThomasSession Aug 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add shared SecureRandom instance
bemusementpark committed Aug 3, 2024
commit f5d1debc323a889067f44a7945159a54034ee4d9
Original file line number Diff line number Diff line change
@@ -33,18 +33,16 @@ import android.view.View
import com.annimon.stream.Stream
import com.google.android.mms.pdu_alt.CharacterSets
import com.google.android.mms.pdu_alt.EncodedStringValue
import network.loki.messenger.R
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.components.ComposeText
import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.UnsupportedEncodingException
import java.security.SecureRandom
import java.util.Arrays
import java.util.Collections
import java.util.concurrent.TimeUnit
import kotlin.math.max
import kotlin.math.min
import network.loki.messenger.R
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.components.ComposeText

object Util {
private val TAG: String = Log.tag(Util::class.java)
@@ -248,32 +246,6 @@ object Util {
return result
}

fun getSecretBytes(size: Int): ByteArray {
return getSecretBytes(SecureRandom(), size)
}

fun getSecretBytes(secureRandom: SecureRandom, size: Int): ByteArray {
val secret = ByteArray(size)
secureRandom.nextBytes(secret)
return secret
}

fun <T> getRandomElement(elements: Array<T>): T {
return elements[SecureRandom().nextInt(elements.size)]
}

fun <T> getRandomElement(elements: List<T>): T {
return elements[SecureRandom().nextInt(elements.size)]
}

fun equals(a: Any?, b: Any?): Boolean {
return a === b || (a != null && a == b)
}

fun hashCode(vararg objects: Any?): Int {
return objects.contentHashCode()
}

fun uri(uri: String?): Uri? {
return if (uri == null) null
else Uri.parse(uri)
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.thoughtcrime.securesms.crypto;


import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import android.content.Context;
import android.os.Build;
import androidx.annotation.NonNull;

import org.session.libsession.utilities.TextSecurePreferences;

import java.security.SecureRandom;

/**
* A provider that is responsible for creating or retrieving the AttachmentSecret model.
*
@@ -81,9 +81,8 @@ private AttachmentSecret getEncryptedAttachmentSecret(@NonNull String serialized
}

private AttachmentSecret createAndStoreAttachmentSecret(@NonNull Context context) {
SecureRandom random = new SecureRandom();
byte[] secret = new byte[32];
random.nextBytes(secret);
SECURE_RANDOM.nextBytes(secret);

AttachmentSecret attachmentSecret = new AttachmentSecret(null, null, secret);
storeAttachmentSecret(context, attachmentSecret);
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package org.thoughtcrime.securesms.crypto;


import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import android.content.Context;
import android.os.Build;
import androidx.annotation.NonNull;

import org.session.libsession.utilities.TextSecurePreferences;

import java.io.IOException;
import java.security.SecureRandom;

public class DatabaseSecretProvider {

@@ -60,9 +61,8 @@ private DatabaseSecret getEncryptedDatabaseSecret(@NonNull String serializedEncr
}

private DatabaseSecret createAndStoreDatabaseSecret(@NonNull Context context) {
SecureRandom random = new SecureRandom();
byte[] secret = new byte[32];
random.nextBytes(secret);
SECURE_RANDOM.nextBytes(secret);

DatabaseSecret databaseSecret = new DatabaseSecret(secret);

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.thoughtcrime.securesms.crypto;


import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import androidx.annotation.NonNull;
import android.util.Pair;

@@ -11,7 +13,6 @@
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

import javax.crypto.Cipher;
import javax.crypto.CipherOutputStream;
@@ -31,7 +32,7 @@ public static Pair<byte[], OutputStream> createFor(@NonNull AttachmentSecret att
throws IOException
{
byte[] random = new byte[32];
new SecureRandom().nextBytes(random);
SECURE_RANDOM.nextBytes(random);

try {
Mac mac = Mac.getInstance("HmacSHA256");
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.thoughtcrime.securesms.database;

import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
@@ -26,7 +28,6 @@
import org.thoughtcrime.securesms.util.BitmapUtil;

import java.io.Closeable;
import java.security.SecureRandom;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -303,7 +304,7 @@ public void updateProfilePicture(String groupID, Bitmap newValue) {
public void updateProfilePicture(String groupID, byte[] newValue) {
long avatarId;

if (newValue != null) avatarId = Math.abs(new SecureRandom().nextLong());
if (newValue != null) avatarId = Math.abs(SECURE_RANDOM.nextLong());
else avatarId = 0;


@@ -458,12 +459,6 @@ public void setActive(String groupId, boolean active) {
database.update(TABLE_NAME, values, GROUP_ID + " = ?", new String[] {groupId});
}

public byte[] allocateGroupId() {
byte[] groupId = new byte[16];
new SecureRandom().nextBytes(groupId);
return groupId;
}

public boolean hasGroup(@NonNull String groupId) {
try (Cursor cursor = databaseHelper.getReadableDatabase().rawQuery(
"SELECT 1 FROM " + TABLE_NAME + " WHERE " + GROUP_ID + " = ? LIMIT 1",
Original file line number Diff line number Diff line change
@@ -46,11 +46,11 @@ import org.session.libsession.utilities.IdentityKeyMismatchList
import org.session.libsession.utilities.NetworkFailure
import org.session.libsession.utilities.NetworkFailureList
import org.session.libsession.utilities.TextSecurePreferences.Companion.isReadReceiptsEnabled
import org.session.libsession.utilities.Util.toIsoBytes
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.utilities.JsonUtil
import org.session.libsignal.utilities.Log
import org.session.libsignal.utilities.ThreadUtils.queue
import org.session.libsignal.utilities.Util.SECURE_RANDOM
import org.session.libsignal.utilities.guava.Optional
import org.thoughtcrime.securesms.attachments.MmsNotificationAttachment
import org.thoughtcrime.securesms.database.SmsDatabase.InsertListener
@@ -66,7 +66,6 @@ import org.thoughtcrime.securesms.mms.SlideDeck
import org.thoughtcrime.securesms.util.asSequence
import java.io.Closeable
import java.io.IOException
import java.security.SecureRandom
import java.util.LinkedList

class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : MessagingDatabase(context, databaseHelper) {
@@ -1200,7 +1199,7 @@ class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : Messa

inner class OutgoingMessageReader(private val message: OutgoingMediaMessage?,
private val threadId: Long) {
private val id = SecureRandom().nextLong()
private val id = SECURE_RANDOM.nextLong()
val current: MessageRecord
get() {
val slideDeck = SlideDeck(context, message!!.attachments)
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@
*/
package org.thoughtcrime.securesms.database;

import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
@@ -49,7 +51,6 @@
import org.thoughtcrime.securesms.dependencies.DatabaseComponent;
import java.io.Closeable;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
@@ -784,7 +785,7 @@ public class OutgoingMessageReader {
public OutgoingMessageReader(OutgoingTextMessage message, long threadId) {
this.message = message;
this.threadId = threadId;
this.id = new SecureRandom().nextLong();
this.id = SECURE_RANDOM.nextLong();
}

public MessageRecord getCurrent() {
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.thoughtcrime.securesms.glide;

import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import androidx.annotation.NonNull;

import java.io.IOException;
import java.security.SecureRandom;

import okhttp3.Headers;
import okhttp3.Interceptor;
@@ -30,15 +31,15 @@ public class PaddedHeadersInterceptor implements Interceptor {

private @NonNull Headers getPaddedHeaders(@NonNull Headers headers) {
return headers.newBuilder()
.add(PADDING_HEADER, getRandomString(new SecureRandom(), MIN_RANDOM_BYTES, MAX_RANDOM_BYTES))
.add(PADDING_HEADER, getRandomString(MIN_RANDOM_BYTES, MAX_RANDOM_BYTES))
.build();
}

private static @NonNull String getRandomString(@NonNull SecureRandom secureRandom, int minLength, int maxLength) {
char[] buffer = new char[secureRandom.nextInt(maxLength - minLength) + minLength];
private static @NonNull String getRandomString(int minLength, int maxLength) {
char[] buffer = new char[SECURE_RANDOM.nextInt(maxLength - minLength) + minLength];

for (int i = 0 ; i < buffer.length; i++) {
buffer[i] = (char) (secureRandom.nextInt(74) + 48); // Random char from 0-Z
buffer[i] = (char) (SECURE_RANDOM.nextInt(74) + 48); // Random char from 0-Z
}

return new String(buffer);
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.logging;

import static org.session.libsignal.crypto.CipherUtil.CIPHER_LOCK;
import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import androidx.annotation.NonNull;

@@ -17,7 +18,6 @@
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@@ -64,7 +64,7 @@ public static class Writer {
}

void writeEntry(@NonNull String entry) throws IOException {
new SecureRandom().nextBytes(ivBuffer);
SECURE_RANDOM.nextBytes(ivBuffer);

byte[] plaintext = entry.getBytes();
try {
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.thoughtcrime.securesms.logging;

import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import android.content.Context;
import android.os.Build;
import androidx.annotation.NonNull;
@@ -9,7 +11,6 @@
import org.session.libsession.utilities.TextSecurePreferences;

import java.io.IOException;
import java.security.SecureRandom;

class LogSecretProvider {

@@ -40,9 +41,8 @@ private static byte[] parseEncryptedSecret(String secret) {
}

private static byte[] createAndStoreSecret(@NonNull Context context) {
SecureRandom random = new SecureRandom();
byte[] secret = new byte[32];
random.nextBytes(secret);
SECURE_RANDOM.nextBytes(secret);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(secret);
4 changes: 2 additions & 2 deletions app/src/main/java/org/thoughtcrime/securesms/mms/Slide.kt
Original file line number Diff line number Diff line change
@@ -21,14 +21,14 @@ import android.content.res.Resources
import android.net.Uri
import androidx.annotation.DrawableRes
import com.squareup.phrase.Phrase
import java.security.SecureRandom
import network.loki.messenger.R
import org.session.libsession.messaging.sending_receiving.attachments.Attachment
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentTransferProgress
import org.session.libsession.messaging.sending_receiving.attachments.UriAttachment
import org.session.libsession.utilities.StringSubstitutionConstants.EMOJI_KEY
import org.session.libsession.utilities.Util.equals
import org.session.libsession.utilities.Util.hashCode
import org.session.libsignal.utilities.Util.SECURE_RANDOM
import org.session.libsignal.utilities.guava.Optional
import org.thoughtcrime.securesms.conversation.v2.Util
import org.thoughtcrime.securesms.util.MediaUtil
@@ -160,7 +160,7 @@ abstract class Slide(@JvmField protected val context: Context, protected val att
): Attachment {
val resolvedType =
Optional.fromNullable(MediaUtil.getMimeType(context, uri)).or(defaultMime)
val fastPreflightId = SecureRandom().nextLong().toString()
val fastPreflightId = SECURE_RANDOM.nextLong().toString()
return UriAttachment(
uri,
if (hasThumbnail) uri else null,
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.thoughtcrime.securesms.net;

import static org.session.libsignal.utilities.Util.SECURE_RANDOM;

import androidx.annotation.NonNull;
import android.text.TextUtils;

@@ -15,7 +17,6 @@
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -54,7 +55,7 @@ public RequestController fetch(@NonNull String url, long contentLength, @NonNull
private RequestController fetchChunksWithUnknownTotalSize(@NonNull String url, @NonNull Callback callback) {
CompositeRequestController compositeController = new CompositeRequestController();

long chunkSize = new SecureRandom().nextInt(1024) + 1024;
long chunkSize = SECURE_RANDOM.nextInt(1024) + 1024;
Request request = new Request.Builder()
.url(url)
.cacheControl(NO_CACHE)
Loading