use of java.lang.InterruptedException in project android_frameworks_base by ResurrectionRemix.
the class CaptivePortalLoginActivity method onDestroy.
@Override
public void onDestroy() {
super.onDestroy();
if (mNetworkCallback != null) {
mCm.unregisterNetworkCallback(mNetworkCallback);
mNetworkCallback = null;
}
if (mLaunchBrowser) {
// Give time for this network to become default. After 500ms just proceed.
for (int i = 0; i < 5; i++) {
// TODO: This misses when mNetwork underlies a VPN.
if (mNetwork.equals(mCm.getActiveNetwork()))
break;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
final String url = mUrl.toString();
if (DBG) {
Log.d(TAG, "starting activity with intent ACTION_VIEW for " + url);
}
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
}
use of java.lang.InterruptedException in project android_frameworks_base by DirtyUnicorns.
the class CaptivePortalLoginActivity method onDestroy.
@Override
public void onDestroy() {
super.onDestroy();
if (mNetworkCallback != null) {
mCm.unregisterNetworkCallback(mNetworkCallback);
mNetworkCallback = null;
}
if (mLaunchBrowser) {
// Give time for this network to become default. After 500ms just proceed.
for (int i = 0; i < 5; i++) {
// TODO: This misses when mNetwork underlies a VPN.
if (mNetwork.equals(mCm.getActiveNetwork()))
break;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
final String url = mUrl.toString();
if (DBG) {
Log.d(TAG, "starting activity with intent ACTION_VIEW for " + url);
}
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
}
use of java.lang.InterruptedException in project platform_frameworks_base by android.
the class CaptivePortalLoginActivity method onDestroy.
@Override
public void onDestroy() {
super.onDestroy();
if (mNetworkCallback != null) {
mCm.unregisterNetworkCallback(mNetworkCallback);
mNetworkCallback = null;
}
if (mLaunchBrowser) {
// Give time for this network to become default. After 500ms just proceed.
for (int i = 0; i < 5; i++) {
// TODO: This misses when mNetwork underlies a VPN.
if (mNetwork.equals(mCm.getActiveNetwork()))
break;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
final String url = mUrl.toString();
if (DBG) {
Log.d(TAG, "starting activity with intent ACTION_VIEW for " + url);
}
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
}
use of java.lang.InterruptedException in project wonderdog by infochimps-labs.
the class ElasticSearchStorage method getNext.
@Override
public Tuple getNext() throws IOException {
try {
Tuple tuple = TupleFactory.getInstance().newTuple(2);
if (reader.nextKeyValue()) {
Text docId = (Text) reader.getCurrentKey();
Text docContent = (Text) reader.getCurrentValue();
tuple.set(0, new DataByteArray(docId.toString()));
tuple.set(1, new DataByteArray(docContent.toString()));
return tuple;
}
} catch (InterruptedException e) {
throw new IOException(e);
}
return null;
}
use of java.lang.InterruptedException in project platform_frameworks_base by android.
the class CaptivePortalLoginActivity method testForCaptivePortal.
private void testForCaptivePortal() {
// TODO: reuse NetworkMonitor facilities for consistent captive portal detection.
new Thread(new Runnable() {
public void run() {
// Give time for captive portal to open.
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
HttpURLConnection urlConnection = null;
int httpResponseCode = 500;
try {
urlConnection = (HttpURLConnection) mNetwork.openConnection(mUrl);
urlConnection.setInstanceFollowRedirects(false);
urlConnection.setConnectTimeout(SOCKET_TIMEOUT_MS);
urlConnection.setReadTimeout(SOCKET_TIMEOUT_MS);
urlConnection.setUseCaches(false);
if (mUserAgent != null) {
urlConnection.setRequestProperty("User-Agent", mUserAgent);
}
// cannot read request header after connection
String requestHeader = urlConnection.getRequestProperties().toString();
urlConnection.getInputStream();
httpResponseCode = urlConnection.getResponseCode();
if (DBG) {
Log.d(TAG, "probe at " + mUrl + " ret=" + httpResponseCode + " request=" + requestHeader + " headers=" + urlConnection.getHeaderFields());
}
} catch (IOException e) {
} finally {
if (urlConnection != null)
urlConnection.disconnect();
}
if (httpResponseCode == 204) {
done(Result.DISMISSED);
}
}
}).start();
}
Aggregations