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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 { | 845 { |
846 @Override | 846 @Override |
847 public void onReceive(Context ctx, Intent intent) | 847 public void onReceive(Context ctx, Intent intent) |
848 { | 848 { |
849 String action = intent.getAction(); | 849 String action = intent.getAction(); |
850 Log.i(TAG, "Action: " + action); | 850 Log.i(TAG, "Action: " + action); |
851 // Connectivity change | 851 // Connectivity change |
852 if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) | 852 if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) |
853 { | 853 { |
854 ConnectivityManager connectivityManager = (ConnectivityManager) getSyste
mService(Context.CONNECTIVITY_SERVICE); | 854 ConnectivityManager connectivityManager = (ConnectivityManager) getSyste
mService(Context.CONNECTIVITY_SERVICE); |
| 855 // TODO Should we use ConnectivityManagerCompat.getNetworkInfoFromBroadc
ast() instead? |
855 NetworkInfo info = connectivityManager.getActiveNetworkInfo(); | 856 NetworkInfo info = connectivityManager.getActiveNetworkInfo(); |
856 if (info == null) | 857 if (info == null) |
857 return; | 858 return; |
858 String typeName = info.getTypeName(); | 859 String typeName = info.getTypeName(); |
859 String subtypeName = info.getSubtypeName(); | 860 String subtypeName = info.getSubtypeName(); |
860 boolean available = info.isAvailable(); | 861 boolean available = info.isAvailable(); |
861 | 862 |
862 Log.i(TAG, "Network Type: " + typeName + ", subtype: " + subtypeName + "
, available: " + available); | 863 Log.i(TAG, "Network Type: " + typeName + ", subtype: " + subtypeName + "
, available: " + available); |
863 if (info.getType() == ConnectivityManager.TYPE_WIFI) | 864 if (info.getType() == ConnectivityManager.TYPE_WIFI) |
864 { | 865 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 @Override | 928 @Override |
928 public void log(int level, Object obj, String message) | 929 public void log(int level, Object obj, String message) |
929 { | 930 { |
930 if (level <= logLevel) | 931 if (level <= logLevel) |
931 { | 932 { |
932 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); | 933 Log.println(7 - level, obj != null ? obj.toString() : TAG, message); |
933 } | 934 } |
934 } | 935 } |
935 } | 936 } |
936 } | 937 } |
OLD | NEW |