| OLD | NEW |
| 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.io.File; | 20 import java.io.File; |
| 21 import java.io.FileNotFoundException; | 21 import java.io.FileNotFoundException; |
| 22 import java.io.IOException; | 22 import java.io.IOException; |
| 23 import java.lang.reflect.Method; | 23 import java.lang.reflect.Method; |
| 24 import java.net.Inet4Address; | |
| 25 import java.net.InetAddress; | 24 import java.net.InetAddress; |
| 26 import java.net.ServerSocket; | 25 import java.net.ServerSocket; |
| 27 import java.util.List; | 26 import java.util.List; |
| 28 import java.util.Properties; | 27 import java.util.Properties; |
| 29 import java.util.concurrent.TimeoutException; | 28 import java.util.concurrent.TimeoutException; |
| 30 | 29 |
| 31 import sunlabs.brazil.server.Server; | 30 import sunlabs.brazil.server.Server; |
| 32 import sunlabs.brazil.util.Base64; | 31 import sunlabs.brazil.util.Base64; |
| 33 import android.annotation.SuppressLint; | 32 import android.annotation.SuppressLint; |
| 34 import android.app.Notification; | 33 import android.app.Notification; |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 387 |
| 389 Log.i(TAG, "Service stopped"); | 388 Log.i(TAG, "Service stopped"); |
| 390 } | 389 } |
| 391 | 390 |
| 392 /** | 391 /** |
| 393 * Restores system proxy settings via native call on Android 3.1+ devices | 392 * Restores system proxy settings via native call on Android 3.1+ devices |
| 394 * using Java reflection. | 393 * using Java reflection. |
| 395 */ | 394 */ |
| 396 private void clearConnectionProxy() | 395 private void clearConnectionProxy() |
| 397 { | 396 { |
| 398 String proxyHost = (String) proxyConfiguration.getProperty("adblock.proxyHos
t"); | 397 String proxyHost = proxyConfiguration.getProperty("adblock.proxyHost"); |
| 399 String proxyPort = (String) proxyConfiguration.getProperty("adblock.proxyPor
t"); | 398 String proxyPort = proxyConfiguration.getProperty("adblock.proxyPort"); |
| 400 String proxyExcl = (String) proxyConfiguration.getProperty("adblock.proxyExc
l"); | 399 String proxyExcl = proxyConfiguration.getProperty("adblock.proxyExcl"); |
| 401 int port = 0; | 400 int port = 0; |
| 402 try | 401 try |
| 403 { | 402 { |
| 404 if (proxyHost != null) | 403 if (proxyHost != null) |
| 405 port = Integer.valueOf(proxyPort); | 404 port = Integer.valueOf(proxyPort); |
| 406 } | 405 } |
| 407 catch (NumberFormatException e) | 406 catch (NumberFormatException e) |
| 408 { | 407 { |
| 409 Log.e(TAG, "Bad port setting", e); | 408 Log.e(TAG, "Bad port setting", e); |
| 410 } | 409 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 567 } |
| 569 catch (Exception e) | 568 catch (Exception e) |
| 570 { | 569 { |
| 571 Log.w(TAG, null, e); | 570 Log.w(TAG, null, e); |
| 572 } | 571 } |
| 573 return false; | 572 return false; |
| 574 } | 573 } |
| 575 | 574 |
| 576 /** | 575 /** |
| 577 * Initializes iptables executable. | 576 * Initializes iptables executable. |
| 578 * | 577 * |
| 579 * @throws FileNotFoundException | 578 * @throws FileNotFoundException |
| 580 * If iptables initialization failed due to provided reasons. | 579 * If iptables initialization failed due to provided reasons. |
| 581 */ | 580 */ |
| 582 private void initIptables() throws IOException, RootToolsException, TimeoutExc
eption, FileNotFoundException | 581 private void initIptables() throws IOException, RootToolsException, TimeoutExc
eption, FileNotFoundException |
| 583 { | 582 { |
| 584 if (!RootTools.isAccessGiven()) | 583 if (!RootTools.isAccessGiven()) |
| 585 throw new FileNotFoundException("No root access"); | 584 throw new FileNotFoundException("No root access"); |
| 586 | 585 |
| 587 File ipt = getFileStreamPath("iptables"); | 586 File ipt = getFileStreamPath("iptables"); |
| 588 | 587 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 @Override | 924 @Override |
| 926 public void log(int level, Object obj, String message) | 925 public void log(int level, Object obj, String message) |
| 927 { | 926 { |
| 928 if (level <= logLevel) | 927 if (level <= logLevel) |
| 929 { | 928 { |
| 930 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); | 929 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); |
| 931 } | 930 } |
| 932 } | 931 } |
| 933 } | 932 } |
| 934 } | 933 } |
| OLD | NEW |