use of org.thoughtcrime.securesms.util.FeatureFlags in project Signal-Android by WhisperSystems.
the class ApplicationContext method initializeLogging.
private void initializeLogging() {
persistentLogger = new PersistentLogger(this);
org.signal.core.util.logging.Log.initialize(FeatureFlags::internalUser, new AndroidLogger(), persistentLogger);
SignalProtocolLoggerProvider.setProvider(new CustomSignalProtocolLogger());
SignalExecutors.UNBOUNDED.execute(() -> {
Log.blockUntilAllWritesFinished();
LogDatabase.getInstance(this).trimToSize();
});
}
use of org.thoughtcrime.securesms.util.FeatureFlags in project Signal-Android by WhisperSystems.
the class ApplicationContext method onCreate.
@Override
public void onCreate() {
Tracer.getInstance().start("Application#onCreate()");
AppStartup.getInstance().onApplicationCreate();
SignalLocalMetrics.ColdStart.start();
long startTime = System.currentTimeMillis();
if (FeatureFlags.internalUser()) {
Tracer.getInstance().setMaxBufferSize(35_000);
}
super.onCreate();
AppStartup.getInstance().addBlocking("security-provider", this::initializeSecurityProvider).addBlocking("sqlcipher-init", () -> {
SqlCipherLibraryLoader.load();
SignalDatabase.init(this, DatabaseSecretProvider.getOrCreateDatabaseSecret(this), AttachmentSecretProvider.getInstance(this).getOrCreateAttachmentSecret());
}).addBlocking("logging", () -> {
initializeLogging();
Log.i(TAG, "onCreate()");
}).addBlocking("crash-handling", this::initializeCrashHandling).addBlocking("rx-init", this::initializeRx).addBlocking("event-bus", () -> EventBus.builder().logNoSubscriberMessages(false).installDefaultEventBus()).addBlocking("app-dependencies", this::initializeAppDependencies).addBlocking("notification-channels", () -> NotificationChannels.create(this)).addBlocking("first-launch", this::initializeFirstEverAppLaunch).addBlocking("app-migrations", this::initializeApplicationMigrations).addBlocking("ring-rtc", this::initializeRingRtc).addBlocking("mark-registration", () -> RegistrationUtil.maybeMarkRegistrationComplete(this)).addBlocking("lifecycle-observer", () -> ApplicationDependencies.getAppForegroundObserver().addListener(this)).addBlocking("message-retriever", this::initializeMessageRetrieval).addBlocking("dynamic-theme", () -> DynamicTheme.setDefaultDayNightMode(this)).addBlocking("vector-compat", () -> {
if (Build.VERSION.SDK_INT < 21) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
}).addBlocking("proxy-init", () -> {
if (SignalStore.proxy().isProxyEnabled()) {
Log.w(TAG, "Proxy detected. Enabling Conscrypt.setUseEngineSocketByDefault()");
Conscrypt.setUseEngineSocketByDefault(true);
}
}).addBlocking("blob-provider", this::initializeBlobProvider).addBlocking("feature-flags", FeatureFlags::init).addBlocking("glide", () -> SignalGlideModule.setRegisterGlideComponents(new SignalGlideComponents())).addNonBlocking(this::cleanAvatarStorage).addNonBlocking(this::initializeRevealableMessageManager).addNonBlocking(this::initializePendingRetryReceiptManager).addNonBlocking(this::initializeFcmCheck).addNonBlocking(CreateSignedPreKeyJob::enqueueIfNeeded).addNonBlocking(this::initializePeriodicTasks).addNonBlocking(this::initializeCircumvention).addNonBlocking(this::initializePendingMessages).addNonBlocking(this::initializeCleanup).addNonBlocking(this::initializeGlideCodecs).addNonBlocking(RefreshPreKeysJob::scheduleIfNecessary).addNonBlocking(StorageSyncHelper::scheduleRoutineSync).addNonBlocking(() -> ApplicationDependencies.getJobManager().beginJobLoop()).addNonBlocking(EmojiSource::refresh).addNonBlocking(() -> ApplicationDependencies.getGiphyMp4Cache().onAppStart(this)).addNonBlocking(this::ensureProfileUploaded).addPostRender(() -> RateLimitUtil.retryAllRateLimitedMessages(this)).addPostRender(this::initializeExpiringMessageManager).addPostRender(() -> SignalStore.settings().setDefaultSms(Util.isDefaultSmsProvider(this))).addPostRender(() -> DownloadLatestEmojiDataJob.scheduleIfNecessary(this)).addPostRender(EmojiSearchIndexDownloadJob::scheduleIfNecessary).addPostRender(() -> SignalDatabase.messageLog().trimOldMessages(System.currentTimeMillis(), FeatureFlags.retryRespondMaxAge())).addPostRender(() -> JumboEmoji.updateCurrentVersion(this)).addPostRender(RetrieveReleaseChannelJob::enqueue).execute();
Log.d(TAG, "onCreate() took " + (System.currentTimeMillis() - startTime) + " ms");
SignalLocalMetrics.ColdStart.onApplicationCreateFinished();
Tracer.getInstance().end("Application#onCreate()");
}
use of org.thoughtcrime.securesms.util.FeatureFlags in project Signal-Android by signalapp.
the class ApplicationContext method onCreate.
@Override
public void onCreate() {
Tracer.getInstance().start("Application#onCreate()");
AppStartup.getInstance().onApplicationCreate();
SignalLocalMetrics.ColdStart.start();
long startTime = System.currentTimeMillis();
if (FeatureFlags.internalUser()) {
Tracer.getInstance().setMaxBufferSize(35_000);
}
super.onCreate();
AppStartup.getInstance().addBlocking("security-provider", this::initializeSecurityProvider).addBlocking("sqlcipher-init", () -> {
SqlCipherLibraryLoader.load();
SignalDatabase.init(this, DatabaseSecretProvider.getOrCreateDatabaseSecret(this), AttachmentSecretProvider.getInstance(this).getOrCreateAttachmentSecret());
}).addBlocking("logging", () -> {
initializeLogging();
Log.i(TAG, "onCreate()");
}).addBlocking("crash-handling", this::initializeCrashHandling).addBlocking("rx-init", this::initializeRx).addBlocking("event-bus", () -> EventBus.builder().logNoSubscriberMessages(false).installDefaultEventBus()).addBlocking("app-dependencies", this::initializeAppDependencies).addBlocking("notification-channels", () -> NotificationChannels.create(this)).addBlocking("first-launch", this::initializeFirstEverAppLaunch).addBlocking("app-migrations", this::initializeApplicationMigrations).addBlocking("ring-rtc", this::initializeRingRtc).addBlocking("mark-registration", () -> RegistrationUtil.maybeMarkRegistrationComplete(this)).addBlocking("lifecycle-observer", () -> ApplicationDependencies.getAppForegroundObserver().addListener(this)).addBlocking("message-retriever", this::initializeMessageRetrieval).addBlocking("dynamic-theme", () -> DynamicTheme.setDefaultDayNightMode(this)).addBlocking("vector-compat", () -> {
if (Build.VERSION.SDK_INT < 21) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
}).addBlocking("proxy-init", () -> {
if (SignalStore.proxy().isProxyEnabled()) {
Log.w(TAG, "Proxy detected. Enabling Conscrypt.setUseEngineSocketByDefault()");
Conscrypt.setUseEngineSocketByDefault(true);
}
}).addBlocking("blob-provider", this::initializeBlobProvider).addBlocking("feature-flags", FeatureFlags::init).addBlocking("glide", () -> SignalGlideModule.setRegisterGlideComponents(new SignalGlideComponents())).addNonBlocking(this::cleanAvatarStorage).addNonBlocking(this::initializeRevealableMessageManager).addNonBlocking(this::initializePendingRetryReceiptManager).addNonBlocking(this::initializeFcmCheck).addNonBlocking(CreateSignedPreKeyJob::enqueueIfNeeded).addNonBlocking(this::initializePeriodicTasks).addNonBlocking(this::initializeCircumvention).addNonBlocking(this::initializePendingMessages).addNonBlocking(this::initializeCleanup).addNonBlocking(this::initializeGlideCodecs).addNonBlocking(RefreshPreKeysJob::scheduleIfNecessary).addNonBlocking(StorageSyncHelper::scheduleRoutineSync).addNonBlocking(() -> ApplicationDependencies.getJobManager().beginJobLoop()).addNonBlocking(EmojiSource::refresh).addNonBlocking(() -> ApplicationDependencies.getGiphyMp4Cache().onAppStart(this)).addNonBlocking(this::ensureProfileUploaded).addPostRender(() -> RateLimitUtil.retryAllRateLimitedMessages(this)).addPostRender(this::initializeExpiringMessageManager).addPostRender(() -> SignalStore.settings().setDefaultSms(Util.isDefaultSmsProvider(this))).addPostRender(() -> DownloadLatestEmojiDataJob.scheduleIfNecessary(this)).addPostRender(EmojiSearchIndexDownloadJob::scheduleIfNecessary).addPostRender(() -> SignalDatabase.messageLog().trimOldMessages(System.currentTimeMillis(), FeatureFlags.retryRespondMaxAge())).addPostRender(() -> JumboEmoji.updateCurrentVersion(this)).addPostRender(RetrieveReleaseChannelJob::enqueue).execute();
Log.d(TAG, "onCreate() took " + (System.currentTimeMillis() - startTime) + " ms");
SignalLocalMetrics.ColdStart.onApplicationCreateFinished();
Tracer.getInstance().end("Application#onCreate()");
}
use of org.thoughtcrime.securesms.util.FeatureFlags in project Signal-Android by signalapp.
the class ApplicationContext method initializeLogging.
private void initializeLogging() {
persistentLogger = new PersistentLogger(this);
org.signal.core.util.logging.Log.initialize(FeatureFlags::internalUser, new AndroidLogger(), persistentLogger);
SignalProtocolLoggerProvider.setProvider(new CustomSignalProtocolLogger());
SignalExecutors.UNBOUNDED.execute(() -> {
Log.blockUntilAllWritesFinished();
LogDatabase.getInstance(this).trimToSize();
});
}
Aggregations