am 50f86448: am 59a9884b: Merge "Do not change NetworkInfo.DetailedState." into jb-mr2-dev

* commit '50f864480d6e9cf9e4d83b4533e3764753b4d408':
  Do not change NetworkInfo.DetailedState.
diff --git a/core/java/android/net/NetworkConfig.java b/core/java/android/net/NetworkConfig.java
index 3cc0bc5..5d95f41 100644
--- a/core/java/android/net/NetworkConfig.java
+++ b/core/java/android/net/NetworkConfig.java
@@ -17,6 +17,7 @@
 package android.net;
 
 import android.util.Log;
+import java.util.Locale;
 
 /**
  * Describes the buildtime configuration of a network.
@@ -63,7 +64,7 @@
      */
     public NetworkConfig(String init) {
         String fragments[] = init.split(",");
-        name = fragments[0].trim().toLowerCase();
+        name = fragments[0].trim().toLowerCase(Locale.ROOT);
         type = Integer.parseInt(fragments[1]);
         radio = Integer.parseInt(fragments[2]);
         priority = Integer.parseInt(fragments[3]);
diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java
index cd799da..9c4772b 100644
--- a/core/java/android/net/ProxyProperties.java
+++ b/core/java/android/net/ProxyProperties.java
@@ -25,6 +25,7 @@
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
+import java.util.Locale;
 
 /**
  * A container class for the http proxy info
@@ -87,7 +88,7 @@
         if (mExclusionList == null) {
             mParsedExclusionList = new String[0];
         } else {
-            String splitExclusionList[] = exclusionList.toLowerCase().split(",");
+            String splitExclusionList[] = exclusionList.toLowerCase(Locale.ROOT).split(",");
             mParsedExclusionList = new String[splitExclusionList.length * 2];
             for (int i = 0; i < splitExclusionList.length; i++) {
                 String s = splitExclusionList[i].trim();
diff --git a/services/java/com/android/server/connectivity/Nat464Xlat.java b/services/java/com/android/server/connectivity/Nat464Xlat.java
index 59403c5..a15d678 100644
--- a/services/java/com/android/server/connectivity/Nat464Xlat.java
+++ b/services/java/com/android/server/connectivity/Nat464Xlat.java
@@ -147,17 +147,24 @@
                    " added, mIsRunning = " + mIsRunning + " -> true");
             mIsRunning = true;
 
-            // Get the network configuration of the clat interface, store it
-            // in our link properties, and stack it on top of the interface
-            // it's running on.
+            // Create the LinkProperties for the clat interface by fetching the
+            // IPv4 address for the interface and adding an IPv4 default route,
+            // then stack the LinkProperties on top of the link it's running on.
+            // Although the clat interface is a point-to-point tunnel, we don't
+            // point the route directly at the interface because some apps don't
+            // understand routes without gateways (see, e.g., http://b/9597256
+            // http://b/9597516). Instead, set the next hop of the route to the
+            // clat IPv4 address itself (for those apps, it doesn't matter what
+            // the IP of the gateway is, only that there is one).
             try {
                 InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
+                LinkAddress clatAddress = config.getLinkAddress();
                 mLP.clear();
                 mLP.setInterfaceName(iface);
-                RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0), null,
-                                                      iface);
+                RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0),
+                                                      clatAddress.getAddress(), iface);
                 mLP.addRoute(ipv4Default);
-                mLP.addLinkAddress(config.getLinkAddress());
+                mLP.addLinkAddress(clatAddress);
                 mTracker.addStackedLink(mLP);
                 Slog.i(TAG, "Adding stacked link. tracker LP: " +
                        mTracker.getLinkProperties());