summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2010-01-12 22:39:16 +0000
committerAndrei Popescu <andreip@google.com>2010-01-15 20:03:29 +0000
commit56199cc25e7ee0455ec2a8099098b66b8554f677 (patch)
treeedc5e608d3e8d21173cd758cf26ed040dda7052d /src/com
parent1e5bad97ca8fb9b12501f4f747941d02f03e1362 (diff)
downloadpackages_apps_Browser-56199cc25e7ee0455ec2a8099098b66b8554f677.tar.gz
packages_apps_Browser-56199cc25e7ee0455ec2a8099098b66b8554f677.tar.bz2
packages_apps_Browser-56199cc25e7ee0455ec2a8099098b66b8554f677.zip
Detect if the current network is wifi or not and update webkit.
This info is passed to youtube.com via a custom HTTP header. Fixes b:2368650
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/BrowserActivity.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 9b6fb7128..a4580871f 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -44,6 +44,7 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
import android.net.Uri;
import android.net.WebAddress;
import android.net.http.SslCertificate;
@@ -296,6 +297,14 @@ public class BrowserActivity extends Activity
ConnectivityManager.CONNECTIVITY_ACTION)) {
boolean noConnectivity = intent.getBooleanExtra(
ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
+ if (!noConnectivity) {
+ NetworkInfo info = intent.getParcelableExtra(
+ ConnectivityManager.EXTRA_NETWORK_INFO);
+ String typeName = info.getTypeName();
+ String subtypeName = info.getSubtypeName();
+ sendNetworkType(typeName.toLowerCase(),
+ (subtypeName != null ? subtypeName.toLowerCase() : ""));
+ }
onNetworkToggle(!noConnectivity);
}
}
@@ -3620,6 +3629,14 @@ public class BrowserActivity extends Activity
getWindow().setFlags(flag, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
+
+ private void sendNetworkType(String type, String subtype) {
+ WebView w = mTabControl.getCurrentWebView();
+ if (w != null) {
+ w.setNetworkType(type, subtype);
+ }
+ }
+
final static int LOCK_ICON_UNSECURE = 0;
final static int LOCK_ICON_SECURE = 1;
final static int LOCK_ICON_MIXED = 2;