Fix some PinState bugs.

master
Greyson Parrelli 2020-04-24 19:40:50 -04:00
parent 575caa53d3
commit cca85bfee3
2 changed files with 13 additions and 0 deletions

View File

@ -181,6 +181,12 @@ public final class PinState {
@WorkerThread
public static synchronized void onEnableRegistrationLockForUserWithPin() throws IOException {
Log.i(TAG, "onEnableRegistrationLockForUserWithPin()");
if (getState() == State.PIN_WITH_REGISTRATION_LOCK_ENABLED) {
Log.i(TAG, "Registration lock already enabled. Skipping.");
return;
}
assertState(State.PIN_WITH_REGISTRATION_LOCK_DISABLED);
SignalStore.kbsValues().setV2RegistrationLockEnabled(false);
@ -198,6 +204,12 @@ public final class PinState {
@WorkerThread
public static synchronized void onDisableRegistrationLockForUserWithPin() throws IOException {
Log.i(TAG, "onDisableRegistrationLockForUserWithPin()");
if (getState() == State.PIN_WITH_REGISTRATION_LOCK_DISABLED) {
Log.i(TAG, "Registration lock already disabled. Skipping.");
return;
}
assertState(State.PIN_WITH_REGISTRATION_LOCK_ENABLED);
SignalStore.kbsValues().setV2RegistrationLockEnabled(true);

View File

@ -194,6 +194,7 @@ public final class FeatureFlags {
public static boolean pinsForAll() {
return SignalStore.registrationValues().pinWasRequiredAtRegistration() ||
SignalStore.kbsValues().isV2RegistrationLockEnabled() ||
SignalStore.kbsValues().hasPin() ||
pinsForAllMandatory() ||
getValue(PINS_FOR_ALL_LEGACY, false) ||
getValue(PINS_FOR_ALL, false);