Loading packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -77,6 +77,7 @@ public class CaptivePortalLoginActivity extends Activity { private WebView mWebView; private WebView mWebView; private MyWebViewClient mWebViewClient; private MyWebViewClient mWebViewClient; private boolean mLaunchBrowser = false; private boolean mLaunchBrowser = false; private Thread mTestingThread = null; @Override @Override protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) { Loading Loading @@ -127,8 +128,6 @@ public class CaptivePortalLoginActivity extends Activity { @Override @Override public void onDestroy() { public void onDestroy() { super.onDestroy(); releaseNetworkRequest(); if (mLaunchBrowser) { if (mLaunchBrowser) { // Give time for this network to become default. After 500ms just proceed. // Give time for this network to become default. After 500ms just proceed. for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) { Loading @@ -143,6 +142,13 @@ public class CaptivePortalLoginActivity extends Activity { if (DBG) logd("starting activity with intent ACTION_VIEW for " + url); if (DBG) logd("starting activity with intent ACTION_VIEW for " + url); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } } if (mTestingThread != null) { mTestingThread.interrupt(); } mWebView.destroy(); releaseNetworkRequest(); super.onDestroy(); } } // Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties. // Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties. Loading Loading @@ -215,13 +221,14 @@ public class CaptivePortalLoginActivity extends Activity { } } private void testForCaptivePortal() { private void testForCaptivePortal() { new Thread(new Runnable() { mTestingThread = new Thread(new Runnable() { public void run() { public void run() { // Give time for captive portal to open. // Give time for captive portal to open. try { try { Thread.sleep(1000); Thread.sleep(1000); } catch (InterruptedException e) { } catch (InterruptedException e) { } } if (isFinishing() || isDestroyed()) return; HttpURLConnection urlConnection = null; HttpURLConnection urlConnection = null; int httpResponseCode = 500; int httpResponseCode = 500; int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_PROBE); int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_PROBE); Loading @@ -244,7 +251,8 @@ public class CaptivePortalLoginActivity extends Activity { done(true); done(true); } } } } }).start(); }); mTestingThread.start(); } } private Network getNetworkForCaptivePortal() { private Network getNetworkForCaptivePortal() { Loading Loading
packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -77,6 +77,7 @@ public class CaptivePortalLoginActivity extends Activity { private WebView mWebView; private WebView mWebView; private MyWebViewClient mWebViewClient; private MyWebViewClient mWebViewClient; private boolean mLaunchBrowser = false; private boolean mLaunchBrowser = false; private Thread mTestingThread = null; @Override @Override protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) { Loading Loading @@ -127,8 +128,6 @@ public class CaptivePortalLoginActivity extends Activity { @Override @Override public void onDestroy() { public void onDestroy() { super.onDestroy(); releaseNetworkRequest(); if (mLaunchBrowser) { if (mLaunchBrowser) { // Give time for this network to become default. After 500ms just proceed. // Give time for this network to become default. After 500ms just proceed. for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) { Loading @@ -143,6 +142,13 @@ public class CaptivePortalLoginActivity extends Activity { if (DBG) logd("starting activity with intent ACTION_VIEW for " + url); if (DBG) logd("starting activity with intent ACTION_VIEW for " + url); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } } if (mTestingThread != null) { mTestingThread.interrupt(); } mWebView.destroy(); releaseNetworkRequest(); super.onDestroy(); } } // Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties. // Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties. Loading Loading @@ -215,13 +221,14 @@ public class CaptivePortalLoginActivity extends Activity { } } private void testForCaptivePortal() { private void testForCaptivePortal() { new Thread(new Runnable() { mTestingThread = new Thread(new Runnable() { public void run() { public void run() { // Give time for captive portal to open. // Give time for captive portal to open. try { try { Thread.sleep(1000); Thread.sleep(1000); } catch (InterruptedException e) { } catch (InterruptedException e) { } } if (isFinishing() || isDestroyed()) return; HttpURLConnection urlConnection = null; HttpURLConnection urlConnection = null; int httpResponseCode = 500; int httpResponseCode = 500; int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_PROBE); int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_PROBE); Loading @@ -244,7 +251,8 @@ public class CaptivePortalLoginActivity extends Activity { done(true); done(true); } } } } }).start(); }); mTestingThread.start(); } } private Network getNetworkForCaptivePortal() { private Network getNetworkForCaptivePortal() { Loading