| Index: src/org/adblockplus/android/Utils.java |
| diff --git a/src/org/adblockplus/android/Utils.java b/src/org/adblockplus/android/Utils.java |
| index 2a79ffdb476bac3e6482bee0715deab3cdcf8758..aaa29c66f53a35d18012334ee033a880062c39e4 100644 |
| --- a/src/org/adblockplus/android/Utils.java |
| +++ b/src/org/adblockplus/android/Utils.java |
| @@ -17,6 +17,9 @@ |
| package org.adblockplus.android; |
| +import java.util.concurrent.locks.ReentrantLock; |
| + |
| +import org.adblockplus.android.configurators.ReflectionProxyConfigurator; |
| import org.adblockplus.android.updater.UpdaterActivity; |
| import org.adblockplus.libadblockplus.JsValue; |
| import org.adblockplus.libadblockplus.Subscription; |
| @@ -30,11 +33,34 @@ import android.support.v4.app.NotificationCompat; |
| public final class Utils |
| { |
| + private static final ReentrantLock LOCK = new ReentrantLock(); |
| + private static boolean nativeProxySupportChecked = false; |
| + private static boolean nativeProxySupported = false; |
| + |
| private Utils() |
| { |
| // |
| } |
| + public static boolean isNativeProxySupported(final Context context) |
| + { |
| + LOCK.lock(); |
| + try |
| + { |
| + if (!nativeProxySupportChecked) |
| + { |
| + nativeProxySupported = ReflectionProxyConfigurator.canUse(context); |
| + nativeProxySupportChecked = true; |
| + } |
| + |
| + return nativeProxySupported; |
| + } |
| + finally |
| + { |
| + LOCK.unlock(); |
| + } |
| + } |
| + |
| public static String getTag(final Class<?> clazz) |
| { |
| return clazz.getSimpleName(); |