Inline useBinaryId remote config.

This commit is contained in:
Greyson Parrelli
2026-05-18 13:19:05 +00:00
committed by jeffrey-signal
parent 73c3d141e3
commit e85637a58d
11 changed files with 29 additions and 58 deletions
@@ -190,7 +190,6 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
RemoteConfig.maxEnvelopeSizeBytes(),
RemoteConfig.maxIncrementalMacsPerEnvelope(),
RemoteConfig::useMessageSendRestFallback,
RemoteConfig.useBinaryId(),
new PreKeyRepository(
keysApi,
protocolStore.aci(),
@@ -32,7 +32,6 @@ import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.recipients.RecipientUtil;
import org.thoughtcrime.securesms.util.AppForegroundObserver;
import org.thoughtcrime.securesms.util.RemoteConfig;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
import org.whispersystems.signalservice.api.crypto.AttachmentCipherStreamUtil;
@@ -150,7 +149,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
Uri updateUri = null;
try {
DeviceContactsOutputStream out = new DeviceContactsOutputStream(writeDetails.outputStream, RemoteConfig.useBinaryId());
DeviceContactsOutputStream out = new DeviceContactsOutputStream(writeDetails.outputStream);
Recipient recipient = Recipient.resolved(recipientId);
if (recipient.getRegistered() == RecipientTable.RegisteredState.NOT_REGISTERED) {
@@ -215,7 +214,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
Uri updateUri = null;
try {
DeviceContactsOutputStream out = new DeviceContactsOutputStream(writeDetails.outputStream, RemoteConfig.useBinaryId());
DeviceContactsOutputStream out = new DeviceContactsOutputStream(writeDetails.outputStream);
List<Recipient> recipients = SignalDatabase.recipients().getRecipientsForMultiDeviceSync();
Map<RecipientId, Integer> inboxPositions = SignalDatabase.threads().getInboxPositions();
Set<RecipientId> archived = SignalDatabase.threads().getArchivedRecipients();
@@ -15,7 +15,6 @@ import org.thoughtcrime.securesms.jobmanager.impl.SealedSenderConstraint;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.net.NotPushRegisteredException;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.RemoteConfig;
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
import org.whispersystems.signalservice.api.crypto.AttachmentCipherStreamUtil;
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
@@ -78,7 +77,7 @@ public class MultiDeviceProfileKeyUpdateJob extends BaseJob {
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DeviceContactsOutputStream out = new DeviceContactsOutputStream(baos, RemoteConfig.useBinaryId());
DeviceContactsOutputStream out = new DeviceContactsOutputStream(baos);
out.write(new DeviceContact(Optional.ofNullable(SignalStore.account().getAci()),
Optional.ofNullable(SignalStore.account().getE164()),
@@ -161,7 +161,7 @@ object MessageDecryptor {
val envelope = if (cipherResult?.metadata?.sourceServiceId != null) {
envelope.newBuilder()
.sourceServiceIdBinary(if (RemoteConfig.useBinaryId) cipherResult.metadata.sourceServiceId.toByteString() else null)
.sourceServiceIdBinary(cipherResult.metadata.sourceServiceId.toByteString())
.sourceDeviceId(cipherResult.metadata.sourceDeviceId)
.build()
} else {
@@ -18,7 +18,6 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.recipients.Recipient.Companion.trustedPush
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.storage.StorageSyncModels.localToRemoteRecord
import org.thoughtcrime.securesms.util.RemoteConfig
import org.whispersystems.signalservice.api.storage.SignalContactRecord
import org.whispersystems.signalservice.api.storage.StorageId
import org.whispersystems.signalservice.api.storage.signalAci
@@ -238,8 +237,8 @@ class ContactRecordProcessor(
pniSignatureVerified = remote.proto.pniSignatureVerified || local.proto.pniSignatureVerified
note = remote.proto.note.nullIfBlank() ?: ""
avatarColor = if (SignalStore.account.isPrimaryDevice) local.proto.avatarColor else remote.proto.avatarColor
aciBinary = if (RemoteConfig.useBinaryId) local.proto.aciBinary.nullIfEmpty() ?: remote.proto.aciBinary else ByteString.EMPTY
pniBinary = if (RemoteConfig.useBinaryId) mergedPni?.toByteStringWithoutPrefix() ?: byteArrayOf().toByteString() else ByteString.EMPTY
aciBinary = local.proto.aciBinary.nullIfEmpty() ?: remote.proto.aciBinary
pniBinary = mergedPni?.toByteStringWithoutPrefix() ?: byteArrayOf().toByteString()
}.build().toSignalContactRecord(StorageId.forContact(keyGenerator.generate()))
val matchesRemote = doParamsMatch(remote, merged)
@@ -31,7 +31,6 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.notifications.profiles.NotificationProfile
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.util.RemoteConfig
import org.whispersystems.signalservice.api.push.SignalServiceAddress
import org.whispersystems.signalservice.api.storage.IAPSubscriptionId
import org.whispersystems.signalservice.api.storage.SignalCallLinkRecord
@@ -140,7 +139,7 @@ object StorageSyncModels {
contact = AccountRecord.PinnedConversation.Contact(
serviceId = "",
e164 = settings.e164 ?: "",
serviceIdBinary = settings.serviceId?.toByteString().takeIf { RemoteConfig.useBinaryId } ?: ByteString.EMPTY
serviceIdBinary = settings.serviceId?.toByteString() ?: ByteString.EMPTY
)
)
}
@@ -217,8 +216,8 @@ object StorageSyncModels {
nickname = recipient.nickname.takeUnless { it.isEmpty }?.let { ContactRecord.Name(given = it.givenName, family = it.familyName) }
note = recipient.note ?: ""
avatarColor = localToRemoteAvatarColor(recipient.avatarColor)
aciBinary = recipient.aci?.toByteString()?.takeIf { RemoteConfig.useBinaryId } ?: ByteString.EMPTY
pniBinary = recipient.pni?.toByteStringWithoutPrefix()?.takeIf { RemoteConfig.useBinaryId } ?: ByteString.EMPTY
aciBinary = recipient.aci?.toByteString() ?: ByteString.EMPTY
pniBinary = recipient.pni?.toByteStringWithoutPrefix() ?: ByteString.EMPTY
}.build().toSignalContactRecord(StorageId.forContact(rawStorageId))
}
@@ -304,14 +303,10 @@ object StorageSyncModels {
identifier = UuidUtil.toByteArray(record.distributionId.asUuid()).toByteString()
name = record.name
recipientServiceIds = emptyList()
recipientServiceIdsBinary = if (RemoteConfig.useBinaryId) {
record.getMembersToSync()
.map { Recipient.resolved(it) }
.filter { it.hasServiceId }
.map { it.requireServiceId().toByteString() }
} else {
emptyList()
}
recipientServiceIdsBinary = record.getMembersToSync()
.map { Recipient.resolved(it) }
.filter { it.hasServiceId }
.map { it.requireServiceId().toByteString() }
allowsReplies = record.allowsReplies
isBlockList = record.privacyMode.isBlockList
}.build().toSignalStoryDistributionListRecord(StorageId.forStoryDistributionList(rawStorageId))
@@ -515,7 +510,7 @@ object StorageSyncModels {
contact = RemoteRecipient.Contact(
serviceId = "",
e164 = recipient.e164 ?: "",
serviceIdBinary = recipient.serviceId?.toByteString().takeIf { RemoteConfig.useBinaryId } ?: ByteString.EMPTY
serviceIdBinary = recipient.serviceId?.toByteString() ?: ByteString.EMPTY
)
)
}
@@ -1208,15 +1208,6 @@ object RemoteConfig {
hotSwappable = true
)
/** Whether or not to send over binary service ids (alongside string service ids). */
@JvmStatic
@get:JvmName("useBinaryId")
val useBinaryId: Boolean by remoteBoolean(
key = "android.useBinaryServiceId.2",
defaultValue = true,
hotSwappable = false
)
@JvmStatic
@get:JvmName("backupsMegaphone")
val backupsMegaphone: Boolean by remoteBoolean(