| LEFT | RIGHT | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
| 3  * Copyright (C) 2006-2014 Eyeo GmbH | 3  * Copyright (C) 2006-2014 Eyeo GmbH | 
| 4  * | 4  * | 
| 5  * Adblock Plus is free software: you can redistribute it and/or modify | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6  * it under the terms of the GNU General Public License version 3 as | 6  * it under the terms of the GNU General Public License version 3 as | 
| 7  * published by the Free Software Foundation. | 7  * published by the Free Software Foundation. | 
| 8  * | 8  * | 
| 9  * Adblock Plus is distributed in the hope that it will be useful, | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
| 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 package org.adblockplus.android; | 18 package org.adblockplus.android; | 
| 19 | 19 | 
| 20 import java.util.concurrent.locks.ReentrantLock; | 20 import org.adblockplus.android.configurators.NativeProxyConfigurator; | 
| 21 |  | 
| 22 import org.adblockplus.android.configurators.ReflectionProxyConfigurator; |  | 
| 23 import org.adblockplus.android.updater.UpdaterActivity; | 21 import org.adblockplus.android.updater.UpdaterActivity; | 
| 24 import org.adblockplus.libadblockplus.JsValue; | 22 import org.adblockplus.libadblockplus.JsValue; | 
| 25 import org.adblockplus.libadblockplus.Subscription; | 23 import org.adblockplus.libadblockplus.Subscription; | 
| 26 import org.apache.commons.lang.StringUtils; | 24 import org.apache.commons.lang.StringUtils; | 
| 27 | 25 | 
| 28 import android.app.Notification; | 26 import android.app.Notification; | 
| 29 import android.app.PendingIntent; | 27 import android.app.PendingIntent; | 
| 30 import android.content.Context; | 28 import android.content.Context; | 
| 31 import android.content.Intent; | 29 import android.content.Intent; | 
| 32 import android.support.v4.app.NotificationCompat; | 30 import android.support.v4.app.NotificationCompat; | 
| 33 | 31 | 
| 34 public final class Utils | 32 public final class Utils | 
| 35 { | 33 { | 
| 36   private static final ReentrantLock LOCK = new ReentrantLock(); |  | 
| 37   private static boolean nativeProxySupportChecked = false; | 34   private static boolean nativeProxySupportChecked = false; | 
| 38   private static boolean nativeProxySupported = false; | 35   private static boolean nativeProxySupported = false; | 
| 39 | 36 | 
| 40   private Utils() | 37   private Utils() | 
| 41   { | 38   { | 
| 42     // | 39     // | 
| 43   } | 40   } | 
| 44 | 41 | 
| 45   public static boolean isNativeProxySupported(final Context context) | 42   public static synchronized boolean isNativeProxySupported(final Context contex
     t) | 
| 46   { | 43   { | 
| 47     LOCK.lock(); | 44     if (!nativeProxySupportChecked) | 
| 48     try |  | 
| 49     { | 45     { | 
| 50       if (!nativeProxySupportChecked) | 46       nativeProxySupported = NativeProxyConfigurator.canUse(context); | 
| 51       { | 47       nativeProxySupportChecked = true; | 
| 52         nativeProxySupported = ReflectionProxyConfigurator.canUse(context); | 48     } | 
| 53         nativeProxySupportChecked = true; |  | 
| 54       } |  | 
| 55 | 49 | 
| 56       return nativeProxySupported; | 50     return nativeProxySupported; | 
| 57     } |  | 
| 58     finally |  | 
| 59     { |  | 
| 60       LOCK.unlock(); |  | 
| 61     } |  | 
| 62   } | 51   } | 
| 63 | 52 | 
| 64   public static String getTag(final Class<?> clazz) | 53   public static String getTag(final Class<?> clazz) | 
| 65   { | 54   { | 
| 66     return clazz.getSimpleName(); | 55     return clazz.getSimpleName(); | 
| 67   } | 56   } | 
| 68 | 57 | 
| 69   public static String capitalizeString(final String s) | 58   public static String capitalizeString(final String s) | 
| 70   { | 59   { | 
| 71     if (s == null || s.length() == 0) | 60     if (s == null || s.length() == 0) | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 137       time = lastDownload; | 126       time = lastDownload; | 
| 138       status = "synchronize_last_at"; | 127       status = "synchronize_last_at"; | 
| 139     } | 128     } | 
| 140 | 129 | 
| 141     context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS) | 130     context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS) | 
| 142         .putExtra("url", sub.getProperty("url").toString()) | 131         .putExtra("url", sub.getProperty("url").toString()) | 
| 143         .putExtra("status", status) | 132         .putExtra("status", status) | 
| 144         .putExtra("time", time * 1000L)); | 133         .putExtra("time", time * 1000L)); | 
| 145   } | 134   } | 
| 146 } | 135 } | 
| LEFT | RIGHT | 
|---|