From f0bdae1417932e707437d236e96883bac3cc9159 Mon Sep 17 00:00:00 2001 From: Viktor Balogh Date: Sat, 19 Apr 2025 21:14:41 +0200 Subject: [PATCH] fix Conscrypt initialization order SSLSocketFactoryCompat relies on SSLContext.getInstance("TLS"), which is called from componentApplication.inject(this) in NextcloudTalkApplication .onCreate() - before Conscrypt is set as the provider. This caused issues on Android 7.0 devices when connecting to Nextcloud's push notification server. The result was a handshake error, because Android 7.0's native implementation only supports TLSv1.2 and the secp256r1 group, while the server supports only secp384r1. Setting Conscrypt as a provider earlier ensures that the native implementation is not used and the connection completes successfully. Call stack: :44, SSLSocketFactoryCompat (com.nextcloud.talk.utils.ssl) provideSslSocketFactoryCompat:156, RestModule (com.nextcloud.talk.dagger.modules) provideSslSocketFactoryCompat:56, RestModule_ProvideSslSocketFactoryCompatFactory (com.nextcloud.talk.dagger.modules) get:46, RestModule_ProvideSslSocketFactoryCompatFactory (com.nextcloud.talk.dagger.modules) get:14, RestModule_ProvideSslSocketFactoryCompatFactory (com.nextcloud.talk.dagger.modules) getSynchronized:54, DoubleCheck (dagger.internal) get:45, DoubleCheck (dagger.internal) get:69, RestModule_ProvideHttpClientFactory (com.nextcloud.talk.dagger.modules) get:19, RestModule_ProvideHttpClientFactory (com.nextcloud.talk.dagger.modules) getSynchronized:54, DoubleCheck (dagger.internal) get:45, DoubleCheck (dagger.internal) injectNextcloudTalkApplication:1393, DaggerNextcloudTalkApplicationComponent$NextcloudTalkApplicationComponentImpl (com.nextcloud.talk.application) inject:867, DaggerNextcloudTalkApplicationComponent$NextcloudTalkApplicationComponentImpl (com.nextcloud.talk.application) onCreate:145, NextcloudTalkApplication (com.nextcloud.talk.application) Signed-off-by: Viktor Balogh --- .../nextcloud/talk/application/NextcloudTalkApplication.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.kt b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.kt index 6614501e1..f875d6772 100644 --- a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.kt +++ b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.kt @@ -142,14 +142,14 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver { buildComponent() DavUtils.registerCustomFactories() + Security.insertProviderAt(Conscrypt.newProvider(), 1) + componentApplication.inject(this) Coil.setImageLoader(buildDefaultImageLoader()) setAppTheme(appPreferences.theme) super.onCreate() - Security.insertProviderAt(Conscrypt.newProvider(), 1) - ClosedInterfaceImpl().providerInstallerInstallIfNeededAsync() DeviceUtils.ignoreSpecialBatteryFeatures()