Loading packages/OsuLogin/src/com/android/hotspot2/osu/OsuLoginActivity.java +13 −9 Original line number Diff line number Diff line Loading @@ -46,8 +46,6 @@ import com.android.hotspot2.R; import java.net.MalformedURLException; import java.net.URL; /** * Online Sign Up Login Web View launched during Provision Process of Hotspot 2.0 rel2. */ Loading @@ -64,6 +62,7 @@ public class OsuLoginActivity extends Activity { private WebView mWebView; private SwipeRefreshLayout mSwipeRefreshLayout; private ProgressBar mProgressBar; private boolean mForceDisconnect = true; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { Loading Loading @@ -141,6 +140,7 @@ public class OsuLoginActivity extends Activity { if (DBG) { Log.d(TAG, "Lost for the current Network, close the browser"); } mForceDisconnect = false; // It is already disconnected. if (mNetwork.equals(network)) { finishAndRemoveTask(); } Loading Loading @@ -193,12 +193,6 @@ public class OsuLoginActivity extends Activity { mWebView.goBack(); return true; } // In case of back key, it needs to disconnect current connection with OSU AP to // abort current Provisioning flow. if (mWifiManager != null) { mWifiManager.disconnect(); } } return super.onKeyDown(keyCode, event); } Loading @@ -207,6 +201,11 @@ public class OsuLoginActivity extends Activity { protected void onDestroy() { if (mNetworkCallback != null) { mCm.unregisterNetworkCallback(mNetworkCallback); mNetworkCallback = null; } if (mWifiManager != null && mForceDisconnect) { mWifiManager.disconnect(); mWifiManager = null; } super.onDestroy(); } Loading @@ -232,6 +231,7 @@ public class OsuLoginActivity extends Activity { private class OsuWebViewClient extends WebViewClient { boolean mPageError = false; boolean mRedirectResponseReceived = false; @Override public void onPageStarted(WebView view, String urlString, Bitmap favicon) { Loading @@ -247,6 +247,10 @@ public class OsuLoginActivity extends Activity { // Do not show the page error on UI. if (mPageError) { if (mRedirectResponseReceived) { // Do not disconnect current connection while provisioning is in progress. mForceDisconnect = false; } finishAndRemoveTask(); } } Loading @@ -255,6 +259,7 @@ public class OsuLoginActivity extends Activity { public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { if (request.getUrl().toString().startsWith("http://127.0.0.1")) { mRedirectResponseReceived = true; view.stopLoading(); } Loading @@ -266,5 +271,4 @@ public class OsuLoginActivity extends Activity { } } } } Loading
packages/OsuLogin/src/com/android/hotspot2/osu/OsuLoginActivity.java +13 −9 Original line number Diff line number Diff line Loading @@ -46,8 +46,6 @@ import com.android.hotspot2.R; import java.net.MalformedURLException; import java.net.URL; /** * Online Sign Up Login Web View launched during Provision Process of Hotspot 2.0 rel2. */ Loading @@ -64,6 +62,7 @@ public class OsuLoginActivity extends Activity { private WebView mWebView; private SwipeRefreshLayout mSwipeRefreshLayout; private ProgressBar mProgressBar; private boolean mForceDisconnect = true; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { Loading Loading @@ -141,6 +140,7 @@ public class OsuLoginActivity extends Activity { if (DBG) { Log.d(TAG, "Lost for the current Network, close the browser"); } mForceDisconnect = false; // It is already disconnected. if (mNetwork.equals(network)) { finishAndRemoveTask(); } Loading Loading @@ -193,12 +193,6 @@ public class OsuLoginActivity extends Activity { mWebView.goBack(); return true; } // In case of back key, it needs to disconnect current connection with OSU AP to // abort current Provisioning flow. if (mWifiManager != null) { mWifiManager.disconnect(); } } return super.onKeyDown(keyCode, event); } Loading @@ -207,6 +201,11 @@ public class OsuLoginActivity extends Activity { protected void onDestroy() { if (mNetworkCallback != null) { mCm.unregisterNetworkCallback(mNetworkCallback); mNetworkCallback = null; } if (mWifiManager != null && mForceDisconnect) { mWifiManager.disconnect(); mWifiManager = null; } super.onDestroy(); } Loading @@ -232,6 +231,7 @@ public class OsuLoginActivity extends Activity { private class OsuWebViewClient extends WebViewClient { boolean mPageError = false; boolean mRedirectResponseReceived = false; @Override public void onPageStarted(WebView view, String urlString, Bitmap favicon) { Loading @@ -247,6 +247,10 @@ public class OsuLoginActivity extends Activity { // Do not show the page error on UI. if (mPageError) { if (mRedirectResponseReceived) { // Do not disconnect current connection while provisioning is in progress. mForceDisconnect = false; } finishAndRemoveTask(); } } Loading @@ -255,6 +259,7 @@ public class OsuLoginActivity extends Activity { public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { if (request.getUrl().toString().startsWith("http://127.0.0.1")) { mRedirectResponseReceived = true; view.stopLoading(); } Loading @@ -266,5 +271,4 @@ public class OsuLoginActivity extends Activity { } } } }