OSDN Git Service

Support WiFi only device at runtime.
authorWink Saville <wink@google.com>
Tue, 23 Apr 2013 21:26:51 +0000 (14:26 -0700)
committerWink Saville <wink@google.com>
Tue, 23 Apr 2013 21:26:51 +0000 (14:26 -0700)
To date WiFi only devices were defined by the list of networkAttributes
in config.xml overriden in on a per-device basis. This change is the
simplest change needed to determine this at runtime and therefore allowing
a single build to support the two different configurations.

Bug: 8562845
Change-Id: I34de5c6accc718b199c13815537de1debfe3dc91

services/java/com/android/server/ConnectivityService.java

index 01625dd..3eeef9e 100644 (file)
@@ -432,6 +432,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
             mRadioAttributes[r.mType] = r;
         }
 
+        // TODO: What is the "correct" way to do determine if this is a wifi only device?
+        boolean wifiOnly = SystemProperties.getBoolean("ro.radio.noril", false);
+        log("wifiOnly=" + wifiOnly);
         String[] naStrings = context.getResources().getStringArray(
                 com.android.internal.R.array.networkAttributes);
         for (String naString : naStrings) {
@@ -442,6 +445,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                             n.type);
                     continue;
                 }
+                if (wifiOnly && ConnectivityManager.isNetworkTypeMobile(n.type)) {
+                    log("networkAttributes - ignoring mobile as this dev is wifiOnly " +
+                            n.type);
+                    continue;
+                }
                 if (mNetConfigs[n.type] != null) {
                     loge("Error in networkAttributes - ignoring attempt to redefine type " +
                             n.type);