diff options
author | fionaxu <fionaxu@google.com> | 2017-07-10 09:34:07 -0700 |
---|---|---|
committer | Chen Xu <fionaxu@google.com> | 2017-09-07 18:49:55 +0000 |
commit | a4434f86a028a14f3367702b8b5dd7967ef811ae (patch) | |
tree | 85bfa0b393e6be5d600995f26d835f7820ab14e6 /packages/CarrierDefaultApp/src | |
parent | fb5369bc3f0f58909fac98d9d4661dbeb8241c75 (diff) |
fix cellular captive portal reevaluation url
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
Diffstat (limited to 'packages/CarrierDefaultApp/src')
-rw-r--r-- | packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java index c1f03fd81151..ae8fc80f03c7 100644 --- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java +++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java @@ -226,7 +226,8 @@ public class CaptivePortalLoginActivity extends Activity { 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); @@ -234,6 +235,7 @@ public class CaptivePortalLoginActivity extends Activity { urlConnection.getInputStream(); httpResponseCode = urlConnection.getResponseCode(); } catch (IOException e) { + loge(e.getMessage()); } finally { if (urlConnection != null) urlConnection.disconnect(); TrafficStats.setThreadStatsTag(oldTag); |