Merge "[PT17.5] Revert to booleans for send/not send broadcast constants."
This commit is contained in:
@@ -70,9 +70,8 @@ public class PacManager {
|
|||||||
private static final long MAX_PAC_SIZE = 20 * 1000 * 1000;
|
private static final long MAX_PAC_SIZE = 20 * 1000 * 1000;
|
||||||
|
|
||||||
// Return values for #setCurrentProxyScriptUrl
|
// Return values for #setCurrentProxyScriptUrl
|
||||||
enum ToSendOrNotToSendBroadcast {
|
public static final boolean DONT_SEND_BROADCAST = false;
|
||||||
DONT_SEND_BROADCAST, DO_SEND_BROADCAST
|
public static final boolean DO_SEND_BROADCAST = true;
|
||||||
}
|
|
||||||
|
|
||||||
private String mCurrentPac;
|
private String mCurrentPac;
|
||||||
@GuardedBy("mProxyLock")
|
@GuardedBy("mProxyLock")
|
||||||
@@ -176,11 +175,11 @@ public class PacManager {
|
|||||||
* @param proxy Proxy information that is about to be broadcast.
|
* @param proxy Proxy information that is about to be broadcast.
|
||||||
* @return Returns whether the broadcast should be sent : either DO_ or DONT_SEND_BROADCAST
|
* @return Returns whether the broadcast should be sent : either DO_ or DONT_SEND_BROADCAST
|
||||||
*/
|
*/
|
||||||
synchronized ToSendOrNotToSendBroadcast setCurrentProxyScriptUrl(ProxyInfo proxy) {
|
synchronized boolean setCurrentProxyScriptUrl(ProxyInfo proxy) {
|
||||||
if (!Uri.EMPTY.equals(proxy.getPacFileUrl())) {
|
if (!Uri.EMPTY.equals(proxy.getPacFileUrl())) {
|
||||||
if (proxy.getPacFileUrl().equals(mPacUrl) && (proxy.getPort() > 0)) {
|
if (proxy.getPacFileUrl().equals(mPacUrl) && (proxy.getPort() > 0)) {
|
||||||
// Allow to send broadcast, nothing to do.
|
// Allow to send broadcast, nothing to do.
|
||||||
return ToSendOrNotToSendBroadcast.DO_SEND_BROADCAST;
|
return DO_SEND_BROADCAST;
|
||||||
}
|
}
|
||||||
mPacUrl = proxy.getPacFileUrl();
|
mPacUrl = proxy.getPacFileUrl();
|
||||||
mCurrentDelay = DELAY_1;
|
mCurrentDelay = DELAY_1;
|
||||||
@@ -188,7 +187,7 @@ public class PacManager {
|
|||||||
mHasDownloaded = false;
|
mHasDownloaded = false;
|
||||||
getAlarmManager().cancel(mPacRefreshIntent);
|
getAlarmManager().cancel(mPacRefreshIntent);
|
||||||
bind();
|
bind();
|
||||||
return ToSendOrNotToSendBroadcast.DONT_SEND_BROADCAST;
|
return DONT_SEND_BROADCAST;
|
||||||
} else {
|
} else {
|
||||||
getAlarmManager().cancel(mPacRefreshIntent);
|
getAlarmManager().cancel(mPacRefreshIntent);
|
||||||
synchronized (mProxyLock) {
|
synchronized (mProxyLock) {
|
||||||
@@ -204,7 +203,7 @@ public class PacManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ToSendOrNotToSendBroadcast.DO_SEND_BROADCAST;
|
return DO_SEND_BROADCAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,8 +208,7 @@ public class ProxyTracker {
|
|||||||
public void sendProxyBroadcast() {
|
public void sendProxyBroadcast() {
|
||||||
final ProxyInfo defaultProxy = getDefaultProxy();
|
final ProxyInfo defaultProxy = getDefaultProxy();
|
||||||
final ProxyInfo proxyInfo = null != defaultProxy ? defaultProxy : new ProxyInfo("", 0, "");
|
final ProxyInfo proxyInfo = null != defaultProxy ? defaultProxy : new ProxyInfo("", 0, "");
|
||||||
if (mPacManager.setCurrentProxyScriptUrl(proxyInfo)
|
if (mPacManager.setCurrentProxyScriptUrl(proxyInfo) == PacManager.DONT_SEND_BROADCAST) {
|
||||||
== PacManager.ToSendOrNotToSendBroadcast.DONT_SEND_BROADCAST) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DBG) Slog.d(TAG, "sending Proxy Broadcast for " + proxyInfo);
|
if (DBG) Slog.d(TAG, "sending Proxy Broadcast for " + proxyInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user