| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 * settings accordingly. | 670 * settings accordingly. |
| 671 */ | 671 */ |
| 672 private BroadcastReceiver connectionReceiver = new BroadcastReceiver() { | 672 private BroadcastReceiver connectionReceiver = new BroadcastReceiver() { |
| 673 @Override | 673 @Override |
| 674 public void onReceive(Context ctx, Intent intent) | 674 public void onReceive(Context ctx, Intent intent) |
| 675 { | 675 { |
| 676 String action = intent.getAction(); | 676 String action = intent.getAction(); |
| 677 Log.i(TAG, "Action: " + action); | 677 Log.i(TAG, "Action: " + action); |
| 678 if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) | 678 if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) |
| 679 { | 679 { |
| 680 NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_N
ETWORK_INFO); | 680 ConnectivityManager connectivityManager = (ConnectivityManager) getSyste
mService(Context.CONNECTIVITY_SERVICE); |
| 681 NetworkInfo info = connectivityManager.getActiveNetworkInfo(); |
| 681 if (info == null) | 682 if (info == null) |
| 682 return; | 683 return; |
| 683 String typeName = info.getTypeName(); | 684 String typeName = info.getTypeName(); |
| 684 String subtypeName = info.getSubtypeName(); | 685 String subtypeName = info.getSubtypeName(); |
| 685 boolean available = info.isAvailable(); | 686 boolean available = info.isAvailable(); |
| 686 Log.i(TAG, "Network Type: " + typeName + ", subtype: " + subtypeName + "
, available: " + available); | 687 Log.i(TAG, "Network Type: " + typeName + ", subtype: " + subtypeName + "
, available: " + available); |
| 687 if (info.getType() == ConnectivityManager.TYPE_WIFI) | 688 if (info.getType() == ConnectivityManager.TYPE_WIFI) |
| 688 ProxySettings.setConnectionProxy(getApplicationContext(), LOCALHOST, p
ort, ""); | 689 ProxySettings.setConnectionProxy(getApplicationContext(), LOCALHOST, p
ort, ""); |
| 689 } | 690 } |
| 690 else if ("android.net.wifi.LINK_CONFIGURATION_CHANGED".equals(action)) | 691 else if ("android.net.wifi.LINK_CONFIGURATION_CHANGED".equals(action)) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 @Override | 742 @Override |
| 742 public void log(int level, Object obj, String message) | 743 public void log(int level, Object obj, String message) |
| 743 { | 744 { |
| 744 if (level <= logLevel) | 745 if (level <= logLevel) |
| 745 { | 746 { |
| 746 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); | 747 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); |
| 747 } | 748 } |
| 748 } | 749 } |
| 749 } | 750 } |
| 750 } | 751 } |
| OLD | NEW |