mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-25 15:37:32 +00:00
Feature flag OkHttp automatic network retry.
This commit is contained in:
@@ -50,6 +50,7 @@ import org.thoughtcrime.securesms.shakereport.ShakeToReport;
|
||||
import org.thoughtcrime.securesms.util.AlarmSleepTimer;
|
||||
import org.thoughtcrime.securesms.util.ByteUnit;
|
||||
import org.thoughtcrime.securesms.util.EarlyMessageCache;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.FrameRateTracker;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
@@ -94,7 +95,8 @@ public class ApplicationDependencyProvider implements ApplicationDependencies.Pr
|
||||
return new SignalServiceAccountManager(networkAccess.getConfiguration(context),
|
||||
new DynamicCredentialsProvider(context),
|
||||
BuildConfig.SIGNAL_AGENT,
|
||||
provideGroupsV2Operations());
|
||||
provideGroupsV2Operations(),
|
||||
FeatureFlags.okHttpAutomaticRetry());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +111,8 @@ public class ApplicationDependencyProvider implements ApplicationDependencies.Pr
|
||||
Optional.of(new SecurityEventListener(context)),
|
||||
provideClientZkOperations().getProfileOperations(),
|
||||
SignalExecutors.newCachedBoundedExecutor("signal-messages", 1, 16),
|
||||
ByteUnit.KILOBYTES.toBytes(512));
|
||||
ByteUnit.KILOBYTES.toBytes(512),
|
||||
FeatureFlags.okHttpAutomaticRetry());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,7 +124,8 @@ public class ApplicationDependencyProvider implements ApplicationDependencies.Pr
|
||||
BuildConfig.SIGNAL_AGENT,
|
||||
new PipeConnectivityListener(),
|
||||
sleepTimer,
|
||||
provideClientZkOperations().getProfileOperations());
|
||||
provideClientZkOperations().getProfileOperations(),
|
||||
FeatureFlags.okHttpAutomaticRetry());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -9,6 +9,7 @@ import com.google.android.gms.security.ProviderInstaller;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -33,7 +34,7 @@ public class AccountManagerFactory {
|
||||
}
|
||||
|
||||
return new SignalServiceAccountManager(new SignalServiceNetworkAccess(context).getConfiguration(number),
|
||||
uuid, number, password, BuildConfig.SIGNAL_AGENT);
|
||||
uuid, number, password, BuildConfig.SIGNAL_AGENT, FeatureFlags.okHttpAutomaticRetry());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,7 @@ public class AccountManagerFactory {
|
||||
}
|
||||
|
||||
return new SignalServiceAccountManager(new SignalServiceNetworkAccess(context).getConfiguration(number),
|
||||
null, number, password, BuildConfig.SIGNAL_AGENT);
|
||||
null, number, password, BuildConfig.SIGNAL_AGENT, FeatureFlags.okHttpAutomaticRetry());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -70,6 +70,7 @@ public final class FeatureFlags {
|
||||
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset.2";
|
||||
private static final String AUTOMATIC_SESSION_INTERVAL = "android.automaticSessionResetInterval";
|
||||
private static final String DEFAULT_MAX_BACKOFF = "android.defaultMaxBackoff";
|
||||
private static final String OKHTTP_AUTOMATIC_RETRY = "android.okhttpAutomaticRetry";
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -96,7 +97,8 @@ public final class FeatureFlags {
|
||||
GROUP_NAME_MAX_LENGTH,
|
||||
AUTOMATIC_SESSION_RESET,
|
||||
AUTOMATIC_SESSION_INTERVAL,
|
||||
DEFAULT_MAX_BACKOFF
|
||||
DEFAULT_MAX_BACKOFF,
|
||||
OKHTTP_AUTOMATIC_RETRY
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -133,7 +135,8 @@ public final class FeatureFlags {
|
||||
GROUP_NAME_MAX_LENGTH,
|
||||
AUTOMATIC_SESSION_RESET,
|
||||
AUTOMATIC_SESSION_INTERVAL,
|
||||
DEFAULT_MAX_BACKOFF
|
||||
DEFAULT_MAX_BACKOFF,
|
||||
OKHTTP_AUTOMATIC_RETRY
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -308,6 +311,11 @@ public final class FeatureFlags {
|
||||
return getInteger(DEFAULT_MAX_BACKOFF, 60);
|
||||
}
|
||||
|
||||
/** Whether or not to allow automatic retries from OkHttp */
|
||||
public static boolean okHttpAutomaticRetry() {
|
||||
return getBoolean(OKHTTP_AUTOMATIC_RETRY, false);
|
||||
}
|
||||
|
||||
/** Only for rendering debug info. */
|
||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||
return new TreeMap<>(REMOTE_VALUES);
|
||||
|
Reference in New Issue
Block a user