we apply redirection link as the url everywhere for cellular captive portal.
this url should only be used when load the portal page at the first place (when users
click on the notification) and shouldn't be used as the re-evaluation url
as it wont return the expected response code.
instead we should use special URL (generate_204) from connectivity
service which will return 204 if redirection is gone.
Test: manual test with cold and hot TMO SIM
Bug:
62532802
Change-Id: I56bb03a58447c5c46758e692ff357d540ea4cd7b
int httpResponseCode = 500;
int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_PROBE);
try {
- urlConnection = (HttpURLConnection) mNetwork.openConnection(mUrl);
+ urlConnection = (HttpURLConnection) mNetwork.openConnection(
+ new URL(mCm.getCaptivePortalServerUrl()));
urlConnection.setInstanceFollowRedirects(false);
urlConnection.setConnectTimeout(SOCKET_TIMEOUT_MS);
urlConnection.setReadTimeout(SOCKET_TIMEOUT_MS);
urlConnection.getInputStream();
httpResponseCode = urlConnection.getResponseCode();
} catch (IOException e) {
+ loge(e.getMessage());
} finally {
if (urlConnection != null) urlConnection.disconnect();
TrafficStats.setThreadStatsTag(oldTag);