Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/org/adblockplus/android/ProxySettings.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Left Patch Set: Removed newly added neetutils code Created April 25, 2014, 9:31 a.m.
Right Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/org/adblockplus/android/ProxyService.java ('k') | src/org/adblockplus/android/RefreshableListPreference.java » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
(...skipping 15 matching lines...) Expand all
26 import android.net.NetworkInfo; 26 import android.net.NetworkInfo;
27 import android.os.Parcelable; 27 import android.os.Parcelable;
28 import android.util.Log; 28 import android.util.Log;
29 29
30 public class ProxySettings 30 public class ProxySettings
31 { 31 {
32 private static final String TAG = Utils.getTag(ProxySettings.class); 32 private static final String TAG = Utils.getTag(ProxySettings.class);
33 33
34 public static Object getActiveLinkProxy(final ConnectivityManager connectivity Manager) throws Exception 34 public static Object getActiveLinkProxy(final ConnectivityManager connectivity Manager) throws Exception
35 { 35 {
36 // LinkProperties lp = connectivityManager.getActiveLinkProperties() 36 /*
37 * LinkProperties lp = connectivityManager.getActiveLinkProperties()
38 */
37 final Method method = connectivityManager.getClass().getMethod("getActiveLin kProperties"); 39 final Method method = connectivityManager.getClass().getMethod("getActiveLin kProperties");
38 final Object lp = method.invoke(connectivityManager); 40 final Object lp = method.invoke(connectivityManager);
39 41
40 final Object pp = ProxySettings.getLinkProxy(lp); 42 final Object pp = ProxySettings.getLinkProxy(lp);
41 return pp; 43 return pp;
42 } 44 }
43 45
44 /** 46 /**
45 * Reads proxy settings from link properties on Android 3.1+ using Java reflec tion. 47 * Reads proxy settings from link properties on Android 3.1+ using Java
48 * reflection.
46 * 49 *
47 * @param linkProperties 50 * @param linkProperties
48 * android.net.LinkProperties 51 * android.net.LinkProperties
49 * @return ProxyProperties 52 * @return ProxyProperties
50 * @throws Exception 53 * @throws Exception
51 */ 54 */
52 public static Object getLinkProxy(final Object linkProperties) throws Exceptio n 55 public static Object getLinkProxy(final Object linkProperties) throws Exceptio n
53 { 56 {
54 /* 57 /*
55 * linkProperties.getHttpProxy(); 58 * linkProperties.getHttpProxy();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 * devices using Java reflection. 151 * devices using Java reflection.
149 * 152 *
150 * @return true if device supports native proxy setting 153 * @return true if device supports native proxy setting
151 */ 154 */
152 public static boolean setConnectionProxy(final Context context, final String h ost, final int port, final String excl) 155 public static boolean setConnectionProxy(final Context context, final String h ost, final int port, final String excl)
153 { 156 {
154 Method method = null; 157 Method method = null;
155 try 158 try
156 { 159 {
157 /* 160 /*
158 * android.net.LinkProperties lp = ConnectivityManager.getActiveLinkProper ties(); 161 * android.net.LinkProperties lp =
162 * ConnectivityManager.getActiveLinkProperties();
159 */ 163 */
160 method = ConnectivityManager.class.getMethod("getActiveLinkProperties"); 164 method = ConnectivityManager.class.getMethod("getActiveLinkProperties");
161 } 165 }
162 catch (final NoSuchMethodException e) 166 catch (final NoSuchMethodException e)
163 { 167 {
164 // This is normal situation for pre-ICS devices 168 // This is normal situation for pre-ICS devices
165 return false; 169 return false;
166 } 170 }
167 catch (final Exception e) 171 catch (final Exception e)
168 { 172 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return false; 239 return false;
236 } 240 }
237 catch (final Exception e) 241 catch (final Exception e)
238 { 242 {
239 // This should not happen 243 // This should not happen
240 Log.e(TAG, "setHttpProxy failure", e); 244 Log.e(TAG, "setHttpProxy failure", e);
241 return false; 245 return false;
242 } 246 }
243 } 247 }
244 } 248 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld