OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 catch (Exception e) | 171 catch (Exception e) |
172 { | 172 { |
173 // This should not happen | 173 // This should not happen |
174 Log.e(TAG, "setHttpProxy failure", e); | 174 Log.e(TAG, "setHttpProxy failure", e); |
175 return false; | 175 return false; |
176 } | 176 } |
177 try | 177 try |
178 { | 178 { |
179 ConnectivityManager connectivityManager = (ConnectivityManager) context.ge
tSystemService(Context.CONNECTIVITY_SERVICE); | 179 ConnectivityManager connectivityManager = (ConnectivityManager) context.ge
tSystemService(Context.CONNECTIVITY_SERVICE); |
180 Object lp = method.invoke(connectivityManager); | 180 Object lp = method.invoke(connectivityManager); |
181 if (lp == null) // There is no active link now, but device has native | 181 // There is no active link now, but device has native proxy support |
182 // proxy support | 182 if (lp == null) |
183 return true; | 183 return true; |
184 | 184 |
185 String className = "android.net.ProxyProperties"; | 185 String className = "android.net.ProxyProperties"; |
186 Class<?> c = Class.forName(className); | 186 Class<?> c = Class.forName(className); |
187 method = lp.getClass().getMethod("setHttpProxy", c); | 187 method = lp.getClass().getMethod("setHttpProxy", c); |
188 if (host != null) | 188 if (host != null) |
189 { | 189 { |
190 /* | 190 /* |
191 * ProxyProperties pp = new ProxyProperties(host, port, excl); | 191 * ProxyProperties pp = new ProxyProperties(host, port, excl); |
192 */ | 192 */ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return false; | 239 return false; |
240 } | 240 } |
241 catch (Exception e) | 241 catch (Exception e) |
242 { | 242 { |
243 // This should not happen | 243 // This should not happen |
244 Log.e(TAG, "setHttpProxy failure", e); | 244 Log.e(TAG, "setHttpProxy failure", e); |
245 return false; | 245 return false; |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
OLD | NEW |