mirror of
https://gitlab.com/xynngh/YetAnotherCallBlocker.git
synced 2025-02-16 20:00:35 +01:00
Try not to crash if Conscrypt can't be loaded
This commit is contained in:
parent
eb6f4f56ad
commit
97b33b93fa
@ -1,11 +1,15 @@
|
|||||||
package dummydomain.yetanothercallblocker.utils;
|
package dummydomain.yetanothercallblocker.utils;
|
||||||
|
|
||||||
import org.conscrypt.Conscrypt;
|
import org.conscrypt.Conscrypt;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
|
|
||||||
public class DeferredInit {
|
public class DeferredInit {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(DeferredInit.class);
|
||||||
|
|
||||||
private static boolean networkInitialized;
|
private static boolean networkInitialized;
|
||||||
private static final Object NETWORK_INIT_LOCK = new Object();
|
private static final Object NETWORK_INIT_LOCK = new Object();
|
||||||
|
|
||||||
@ -15,7 +19,11 @@ public class DeferredInit {
|
|||||||
synchronized (NETWORK_INIT_LOCK) {
|
synchronized (NETWORK_INIT_LOCK) {
|
||||||
if (networkInitialized) return;
|
if (networkInitialized) return;
|
||||||
|
|
||||||
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
try {
|
||||||
|
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.warn("initNetwork()", t);
|
||||||
|
}
|
||||||
|
|
||||||
networkInitialized = true;
|
networkInitialized = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user