Search in sources :

Example 1 with FeatureFlags

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();
    });
}
Also used : PersistentLogger(org.thoughtcrime.securesms.logging.PersistentLogger) AndroidLogger(org.signal.core.util.logging.AndroidLogger) CustomSignalProtocolLogger(org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger) FeatureFlags(org.thoughtcrime.securesms.util.FeatureFlags)

Example 2 with FeatureFlags

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()");
}
Also used : EmojiSearchIndexDownloadJob(org.thoughtcrime.securesms.jobs.EmojiSearchIndexDownloadJob) CreateSignedPreKeyJob(org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob) SignalGlideComponents(org.thoughtcrime.securesms.mms.SignalGlideComponents) FeatureFlags(org.thoughtcrime.securesms.util.FeatureFlags) RefreshPreKeysJob(org.thoughtcrime.securesms.jobs.RefreshPreKeysJob)

Example 3 with FeatureFlags

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()");
}
Also used : EmojiSearchIndexDownloadJob(org.thoughtcrime.securesms.jobs.EmojiSearchIndexDownloadJob) CreateSignedPreKeyJob(org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob) SignalGlideComponents(org.thoughtcrime.securesms.mms.SignalGlideComponents) FeatureFlags(org.thoughtcrime.securesms.util.FeatureFlags) RefreshPreKeysJob(org.thoughtcrime.securesms.jobs.RefreshPreKeysJob)

Example 4 with FeatureFlags

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();
    });
}
Also used : PersistentLogger(org.thoughtcrime.securesms.logging.PersistentLogger) AndroidLogger(org.signal.core.util.logging.AndroidLogger) CustomSignalProtocolLogger(org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger) FeatureFlags(org.thoughtcrime.securesms.util.FeatureFlags)

Aggregations

FeatureFlags (org.thoughtcrime.securesms.util.FeatureFlags)4 AndroidLogger (org.signal.core.util.logging.AndroidLogger)2 CreateSignedPreKeyJob (org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob)2 EmojiSearchIndexDownloadJob (org.thoughtcrime.securesms.jobs.EmojiSearchIndexDownloadJob)2 RefreshPreKeysJob (org.thoughtcrime.securesms.jobs.RefreshPreKeysJob)2 CustomSignalProtocolLogger (org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger)2 PersistentLogger (org.thoughtcrime.securesms.logging.PersistentLogger)2 SignalGlideComponents (org.thoughtcrime.securesms.mms.SignalGlideComponents)2