 Issue 4705284891082752:
  Proxy configurators  (Closed)
    
  
    Issue 4705284891082752:
  Proxy configurators  (Closed) 
  | Left: | ||
| Right: | 
| 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.PrintWriter; | 20 import java.io.PrintWriter; | 
| 21 import java.lang.Thread.UncaughtExceptionHandler; | 21 import java.lang.Thread.UncaughtExceptionHandler; | 
| 22 | 22 | 
| 23 import org.adblockplus.android.compat.LinkProperties; | |
| 24 import org.adblockplus.android.compat.ProxyProperties; | |
| 25 | |
| 23 import android.annotation.SuppressLint; | 26 import android.annotation.SuppressLint; | 
| 24 import android.app.NotificationManager; | 27 import android.app.NotificationManager; | 
| 25 import android.content.Context; | 28 import android.content.Context; | 
| 26 import android.content.pm.PackageInfo; | 29 import android.content.pm.PackageInfo; | 
| 27 import android.content.pm.PackageManager.NameNotFoundException; | 30 import android.content.pm.PackageManager.NameNotFoundException; | 
| 28 import android.os.Build; | 31 import android.os.Build; | 
| 29 import android.util.Log; | 32 import android.util.Log; | 
| 30 | 33 | 
| 31 /** | 34 /** | 
| 32 * Writes crash data in file. | 35 * Writes crash data in file. | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 restoreProxy = false; | 166 restoreProxy = false; | 
| 164 int p = 0; | 167 int p = 0; | 
| 165 try | 168 try | 
| 166 { | 169 { | 
| 167 p = Integer.valueOf(port); | 170 p = Integer.valueOf(port); | 
| 168 } | 171 } | 
| 169 catch (final NumberFormatException e) | 172 catch (final NumberFormatException e) | 
| 170 { | 173 { | 
| 171 // ignore - no valid port, it will be correctly processed later | 174 // ignore - no valid port, it will be correctly processed later | 
| 172 } | 175 } | 
| 173 ProxySettings.setConnectionProxy(context, host, p, excl); | 176 | 
| 177 try | |
| 178 { | |
| 179 final ProxyProperties proxyProperties = new ProxyProperties(this.host, p, this.excl); | |
| 
Felix Dahlke
2014/08/24 11:51:19
We can move this closer to its usage, i.e. into th
 
René Jeschke
2014/08/24 11:54:14
Done.
 | |
| 180 final LinkProperties linkProperties = LinkProperties.fromContext(this.cont ext); | |
| 181 if (linkProperties != null && linkProperties.isValid()) | |
| 182 { | |
| 183 linkProperties.setHttpProxy(proxyProperties); | |
| 184 } | |
| 185 } | |
| 186 catch (final Throwable t) | |
| 187 { | |
| 188 // This method here must not throw any exceptions to make sure it does not kill anything else. | |
| 189 // And it's safe to ignore this exception here, because if resetting the p roxy fails, then it fails ... and we don't get a second chance to | |
| 190 // clear it again (because we're most likely currently crashing). | |
| 191 } | |
| 174 } | 192 } | 
| 175 } | 193 } | 
| OLD | NEW |