| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 notrafficHandler.postDelayed(noTraffic, NO_TRAFFIC_TIMEOUT); | 262 notrafficHandler.postDelayed(noTraffic, NO_TRAFFIC_TIMEOUT); |
| 263 } | 263 } |
| 264 // Lock service | 264 // Lock service |
| 265 ongoingNotification = new Notification(); | 265 ongoingNotification = new Notification(); |
| 266 ongoingNotification.when = 0; | 266 ongoingNotification.when = 0; |
| 267 contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, Preferen
ces.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TA
SK), 0); | 267 contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, Preferen
ces.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TA
SK), 0); |
| 268 ongoingNotification.icon = R.drawable.ic_stat_blocking; | 268 ongoingNotification.icon = R.drawable.ic_stat_blocking; |
| 269 ongoingNotification.setLatestEventInfo(getApplicationContext(), getText(R.st
ring.app_name), msg, contentIntent); | 269 ongoingNotification.setLatestEventInfo(getApplicationContext(), getText(R.st
ring.app_name), msg, contentIntent); |
| 270 startForeground(ONGOING_NOTIFICATION_ID, ongoingNotification); | 270 startForeground(ONGOING_NOTIFICATION_ID, ongoingNotification); |
| 271 | 271 |
| 272 sendBroadcast(new Intent(BROADCAST_STATE_CHANGED).putExtra("enabled", true).
putExtra("port", port).putExtra("manual", !transparent && !nativeProxy)); | 272 sendBroadcast(new Intent(BROADCAST_STATE_CHANGED).putExtra("enabled", true).
putExtra("port", port).putExtra("manual", isManual())); |
| 273 Log.i(TAG, "Service started"); | 273 Log.i(TAG, "Service started"); |
| 274 } | 274 } |
| 275 | 275 |
| 276 @Override | 276 @Override |
| 277 public void onDestroy() | 277 public void onDestroy() |
| 278 { | 278 { |
| 279 super.onDestroy(); | 279 super.onDestroy(); |
| 280 | 280 |
| 281 stopNoTrafficCheck(false); | 281 stopNoTrafficCheck(false); |
| 282 | 282 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 { | 454 { |
| 455 return transparent; | 455 return transparent; |
| 456 } | 456 } |
| 457 | 457 |
| 458 public boolean isNativeProxy() | 458 public boolean isNativeProxy() |
| 459 { | 459 { |
| 460 return nativeProxy; | 460 return nativeProxy; |
| 461 } | 461 } |
| 462 | 462 |
| 463 /** | 463 /** |
| 464 * Checks if user has to set proxy settings manually |
| 465 */ |
| 466 public boolean isManual() |
| 467 { |
| 468 return !transparent && !nativeProxy; |
| 469 } |
| 470 |
| 471 /** |
| 464 * Checks if specified host is local. | 472 * Checks if specified host is local. |
| 465 */ | 473 */ |
| 466 private static final boolean isLocalHost(String host) | 474 private static final boolean isLocalHost(String host) |
| 467 { | 475 { |
| 468 if (host == null) | 476 if (host == null) |
| 469 return false; | 477 return false; |
| 470 | 478 |
| 471 try | 479 try |
| 472 { | 480 { |
| 473 if (host.equalsIgnoreCase("localhost")) | 481 if (host.equalsIgnoreCase("localhost")) |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 @Override | 721 @Override |
| 714 public void log(int level, Object obj, String message) | 722 public void log(int level, Object obj, String message) |
| 715 { | 723 { |
| 716 if (level <= logLevel) | 724 if (level <= logLevel) |
| 717 { | 725 { |
| 718 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); | 726 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); |
| 719 } | 727 } |
| 720 } | 728 } |
| 721 } | 729 } |
| 722 } | 730 } |
| OLD | NEW |