mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 19:18:37 +00:00
Make max envelope size remote configurable.
This commit is contained in:
@@ -174,10 +174,9 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
|||||||
keysApi,
|
keysApi,
|
||||||
Optional.of(new SecurityEventListener(context)),
|
Optional.of(new SecurityEventListener(context)),
|
||||||
SignalExecutors.newCachedBoundedExecutor("signal-messages", ThreadUtil.PRIORITY_IMPORTANT_BACKGROUND_THREAD, 1, 16, 30),
|
SignalExecutors.newCachedBoundedExecutor("signal-messages", ThreadUtil.PRIORITY_IMPORTANT_BACKGROUND_THREAD, 1, 16, 30),
|
||||||
ByteUnit.KILOBYTES.toBytes(256),
|
RemoteConfig.maxEnvelopeSizeBytes(),
|
||||||
RemoteConfig::useMessageSendRestFallback,
|
RemoteConfig::useMessageSendRestFallback,
|
||||||
RemoteConfig.usePqRatchet(),
|
RemoteConfig.usePqRatchet());
|
||||||
RemoteConfig.internalUser() ? Optional.of(ByteUnit.KILOBYTES.toBytes(96)) : Optional.empty());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -875,7 +875,7 @@ object RemoteConfig {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@get:JvmName("promptForDelayedNotificationLogs")
|
@get:JvmName("promptForDelayedNotificationLogs")
|
||||||
val promptForDelayedNotificationLogs: String by remoteString(
|
val promptForDelayedNotificationLogs: String by remoteString(
|
||||||
key = RemoteConfig.PROMPT_FOR_NOTIFICATION_LOGS,
|
key = PROMPT_FOR_NOTIFICATION_LOGS,
|
||||||
defaultValue = "*",
|
defaultValue = "*",
|
||||||
hotSwappable = true
|
hotSwappable = true
|
||||||
)
|
)
|
||||||
@@ -1177,5 +1177,14 @@ object RemoteConfig {
|
|||||||
if (value.asBoolean(false)) UsePqRatchet.YES else UsePqRatchet.NO
|
if (value.asBoolean(false)) UsePqRatchet.YES else UsePqRatchet.NO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The maximum allowed envelope size for messages we send. */
|
||||||
|
@JvmStatic
|
||||||
|
@get:JvmName("maxEnvelopeSizeBytes")
|
||||||
|
val maxEnvelopeSizeBytes: Long by remoteLong(
|
||||||
|
key = "android.maxEnvelopeSizeBytes",
|
||||||
|
defaultValue = 256.kibiBytes.inWholeBytes,
|
||||||
|
hotSwappable = true
|
||||||
|
)
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ public class SignalServiceMessageSender {
|
|||||||
private final long maxEnvelopeSize;
|
private final long maxEnvelopeSize;
|
||||||
private final BooleanSupplier useRestFallback;
|
private final BooleanSupplier useRestFallback;
|
||||||
private final UsePqRatchet usePqRatchet;
|
private final UsePqRatchet usePqRatchet;
|
||||||
private final Optional<Long> internalOnlyMaxEnvelopeSize;
|
|
||||||
|
|
||||||
public SignalServiceMessageSender(PushServiceSocket pushServiceSocket,
|
public SignalServiceMessageSender(PushServiceSocket pushServiceSocket,
|
||||||
SignalServiceDataStore store,
|
SignalServiceDataStore store,
|
||||||
@@ -198,8 +197,7 @@ public class SignalServiceMessageSender {
|
|||||||
ExecutorService executor,
|
ExecutorService executor,
|
||||||
long maxEnvelopeSize,
|
long maxEnvelopeSize,
|
||||||
BooleanSupplier useRestFallback,
|
BooleanSupplier useRestFallback,
|
||||||
UsePqRatchet usePqRatchet,
|
UsePqRatchet usePqRatchet)
|
||||||
Optional<Long> internalOnlyMaxEnvelopeSize)
|
|
||||||
{
|
{
|
||||||
CredentialsProvider credentialsProvider = pushServiceSocket.getCredentialsProvider();
|
CredentialsProvider credentialsProvider = pushServiceSocket.getCredentialsProvider();
|
||||||
|
|
||||||
@@ -218,7 +216,6 @@ public class SignalServiceMessageSender {
|
|||||||
this.keysApi = keysApi;
|
this.keysApi = keysApi;
|
||||||
this.useRestFallback = useRestFallback;
|
this.useRestFallback = useRestFallback;
|
||||||
this.usePqRatchet = usePqRatchet;
|
this.usePqRatchet = usePqRatchet;
|
||||||
this.internalOnlyMaxEnvelopeSize = internalOnlyMaxEnvelopeSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2817,10 +2814,6 @@ public class SignalServiceMessageSender {
|
|||||||
throw new ContentTooLargeException(size);
|
throw new ContentTooLargeException(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalOnlyMaxEnvelopeSize.isPresent() && size > internalOnlyMaxEnvelopeSize.get()) {
|
|
||||||
throw new ContentTooLargeException(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2831,10 +2824,6 @@ public class SignalServiceMessageSender {
|
|||||||
throw new ContentTooLargeException(size);
|
throw new ContentTooLargeException(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalOnlyMaxEnvelopeSize.isPresent() && size > internalOnlyMaxEnvelopeSize.get()) {
|
|
||||||
throw new ContentTooLargeException(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user