-- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -369,6 +369,26 @@ public final class LinkProperties implements Parcelable {
* this link.
*/
public List<InetAddress> getDnsServers() {
+ //Sheldon add patch begin
+ int index = 0;
+ boolean isSortDone = true;
+ for (InetAddress addr : mDnses) {
+ boolean isIpv4 = (addr instanceof Inet4Address);
+ if(index==0 && !isIpv4){
+ isSortDone = false;
+ }
+
+ //Log.v(TAG, "Get DNS : " + addr.getHostAddress() + ", isIpv4 : " + isIpv4 + ", index = " + index + ", isSortDone : "+ isSortDone);
+
+ if(!isSortDone && isIpv4){
+ Collections.swap(mDnses,0,index);
+ //Log.d(TAG, "Put ipv4 dns first ~");
+ isSortDone = true;
+ }
+
+ index++;
+ }
+ //Sheldon add patch end
return Collections.unmodifiableList(mDnses);
}
@@ -781,7 +801,7 @@ public final class LinkProperties implements Parcelable {
* @hide
*/
public boolean isProvisioned() {
- return (isIPv4Provisioned() || isIPv6Provisioned());
+ return isIPv4Provisioned();//(isIPv4Provisioned() || isIPv6Provisioned());
}
/**
默认wifi是ipv4,ipv6放在第二位
最新推荐文章于 2024-08-18 23:46:40 发布