Start mirroring to SVR2.

This commit is contained in:
Greyson Parrelli
2023-07-05 19:05:30 -04:00
committed by Clark Chen
parent dfb7304626
commit e1570e9512
111 changed files with 1828 additions and 2299 deletions

View File

@@ -18,7 +18,6 @@ import org.thoughtcrime.securesms.groups.SelectionLimits;
import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.messageprocessingalarm.MessageProcessReceiver;
import org.whispersystems.signalservice.internal.crypto.PaddingInputStream;
import java.io.IOException;
import java.util.HashMap;
@@ -109,6 +108,7 @@ public final class FeatureFlags {
private static final String MAX_ATTACHMENT_COUNT = "android.attachments.maxCount";
private static final String MAX_ATTACHMENT_RECEIVE_SIZE_BYTES = "global.attachments.maxReceiveBytes";
private static final String MAX_ATTACHMENT_SIZE_BYTES = "global.attachments.maxBytes";
private static final String SVR2_KILLSWITCH = "android.svr2.killSwitch";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -169,7 +169,8 @@ public final class FeatureFlags {
MAX_ATTACHMENT_COUNT,
MAX_ATTACHMENT_RECEIVE_SIZE_BYTES,
MAX_ATTACHMENT_SIZE_BYTES,
AD_HOC_CALLING
AD_HOC_CALLING,
SVR2_KILLSWITCH
);
@VisibleForTesting
@@ -235,7 +236,8 @@ public final class FeatureFlags {
EDIT_MESSAGE_SEND,
MAX_ATTACHMENT_COUNT,
MAX_ATTACHMENT_RECEIVE_SIZE_BYTES,
MAX_ATTACHMENT_SIZE_BYTES
MAX_ATTACHMENT_SIZE_BYTES,
SVR2_KILLSWITCH
);
/**
@@ -243,7 +245,8 @@ public final class FeatureFlags {
*/
@VisibleForTesting
static final Set<String> STICKY = SetUtil.newHashSet(
VERIFY_V2
VERIFY_V2,
SVR2_KILLSWITCH
);
/**
@@ -752,6 +755,14 @@ public final class FeatureFlags {
return getInteger(MESSAGE_PROCESSOR_DELAY, 300);
}
/**
* Whether or not SVR2 should be used at all. Defaults to true. In practice this is reserved as a killswitch.
*/
public static boolean svr2() {
// Despite us always inverting the value, it's important that this defaults to false so that the STICKY property works as intended
return !getBoolean(SVR2_KILLSWITCH, false);
}
private enum VersionFlag {
/** The flag is no set */
OFF,

View File

@@ -65,7 +65,7 @@ public final class SupportEmailUtil {
"\n" +
context.getString(R.string.SupportEmailUtil_signal_package) + " " + getSignalPackage(context) +
"\n" +
context.getString(R.string.SupportEmailUtil_registration_lock) + " " + getRegistrationLockEnabled(context) +
context.getString(R.string.SupportEmailUtil_registration_lock) + " " + getRegistrationLockEnabled() +
"\n" +
context.getString(R.string.SupportEmailUtil_locale) + " " + Locale.getDefault().toString();
}
@@ -86,7 +86,7 @@ public final class SupportEmailUtil {
return String.format("%s (%s)", BuildConfig.APPLICATION_ID, AppSignatureUtil.getAppSignature(context));
}
private static CharSequence getRegistrationLockEnabled(@NonNull Context context) {
return String.valueOf(TextSecurePreferences.isV1RegistrationLockEnabled(context) || SignalStore.kbsValues().isV2RegistrationLockEnabled());
private static CharSequence getRegistrationLockEnabled() {
return String.valueOf(SignalStore.svr().isRegistrationLockEnabled());
}
}

View File

@@ -334,14 +334,6 @@ public class TextSecurePreferences {
return getStringPreference(context, REGISTRATION_LOCK_PIN_PREF_V1, null);
}
public static void clearRegistrationLockV1(@NonNull Context context) {
//noinspection deprecation
getSharedPreferences(context)
.edit()
.remove(REGISTRATION_LOCK_PIN_PREF_V1)
.apply();
}
/**
* @deprecated Use only for migrations to the Key Backup Store registration pinV2.
*/