Merge "Expose captive portal urls for configuration"
am: 55319378ee
Change-Id: If5970fdafa7c624855ef9d29921542e2fb6fdfa0
This commit is contained in:
@@ -108,7 +108,6 @@ import android.net.VpnService;
|
|||||||
import android.net.metrics.IpConnectivityLog;
|
import android.net.metrics.IpConnectivityLog;
|
||||||
import android.net.metrics.NetworkEvent;
|
import android.net.metrics.NetworkEvent;
|
||||||
import android.net.netlink.InetDiagMessage;
|
import android.net.netlink.InetDiagMessage;
|
||||||
import android.net.shared.NetworkMonitorUtils;
|
|
||||||
import android.net.shared.PrivateDnsConfig;
|
import android.net.shared.PrivateDnsConfig;
|
||||||
import android.net.util.MultinetworkPolicyTracker;
|
import android.net.util.MultinetworkPolicyTracker;
|
||||||
import android.net.util.NetdService;
|
import android.net.util.NetdService;
|
||||||
@@ -238,6 +237,16 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
private static final boolean LOGD_BLOCKED_NETWORKINFO = true;
|
private static final boolean LOGD_BLOCKED_NETWORKINFO = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default URL to use for {@link #getCaptivePortalServerUrl()}. This should not be changed
|
||||||
|
* by OEMs for configuration purposes, as this value is overridden by
|
||||||
|
* Settings.Global.CAPTIVE_PORTAL_HTTP_URL.
|
||||||
|
* R.string.config_networkCaptivePortalServerUrl should be overridden instead for this purpose
|
||||||
|
* (preferably via runtime resource overlays).
|
||||||
|
*/
|
||||||
|
private static final String DEFAULT_CAPTIVE_PORTAL_HTTP_URL =
|
||||||
|
"http://connectivitycheck.gstatic.com/generate_204";
|
||||||
|
|
||||||
// TODO: create better separation between radio types and network types
|
// TODO: create better separation between radio types and network types
|
||||||
|
|
||||||
// how long to wait before switching back to a radio's default network
|
// how long to wait before switching back to a radio's default network
|
||||||
@@ -6712,9 +6721,20 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public String getCaptivePortalServerUrl() {
|
public String getCaptivePortalServerUrl() {
|
||||||
enforceConnectivityInternalPermission();
|
enforceConnectivityInternalPermission();
|
||||||
final String defaultUrl = mContext.getResources().getString(
|
String settingUrl = mContext.getResources().getString(
|
||||||
R.string.config_networkDefaultCaptivePortalServerUrl);
|
R.string.config_networkCaptivePortalServerUrl);
|
||||||
return NetworkMonitorUtils.getCaptivePortalServerHttpUrl(mContext, defaultUrl);
|
|
||||||
|
if (!TextUtils.isEmpty(settingUrl)) {
|
||||||
|
return settingUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
settingUrl = Settings.Global.getString(mContext.getContentResolver(),
|
||||||
|
Settings.Global.CAPTIVE_PORTAL_HTTP_URL);
|
||||||
|
if (!TextUtils.isEmpty(settingUrl)) {
|
||||||
|
return settingUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DEFAULT_CAPTIVE_PORTAL_HTTP_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user