diff options
author | Chiachang Wang <chiachangwang@google.com> | 2021-02-03 18:32:26 +0800 |
---|---|---|
committer | Chiachang Wang <chiachangwang@google.com> | 2021-02-03 18:37:33 +0800 |
commit | 7e1b226066725b7a23e22227e4f9e1fcf75df1ab (patch) | |
tree | 6568c4d7df05c4a16981690f3bd5329bf7b9149c /libs/WifiTrackerLib/src | |
parent | 343ac5ed38cd7fa34f28556b26e42bd5ab5ebb81 (diff) | |
download | frameworks_opt_net_wifi-7e1b226066725b7a23e22227e4f9e1fcf75df1ab.tar.gz frameworks_opt_net_wifi-7e1b226066725b7a23e22227e4f9e1fcf75df1ab.tar.bz2 frameworks_opt_net_wifi-7e1b226066725b7a23e22227e4f9e1fcf75df1ab.zip |
Replace network utils method
The getNetworkPart() method is used by Setting and wifi lib.
NetworkUtils is moved to incoming connectivity mainline. It's
not accessible outside the module, so move the method to share
lib and update the usage in the callers side.
Bug: 172183305
Test: atest WifiTrackerLibTests
Change-Id: Id7bc015ef569d6f7b2116da5cfee82649e3315e9
Diffstat (limited to 'libs/WifiTrackerLib/src')
-rw-r--r-- | libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java index 675c80d0a..09a2a3ffe 100644 --- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java +++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java @@ -26,7 +26,6 @@ import android.net.LinkAddress; import android.net.LinkProperties; import android.net.NetworkCapabilities; import android.net.NetworkInfo; -import android.net.NetworkUtils; import android.net.RouteInfo; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; @@ -42,6 +41,8 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; +import com.android.net.module.util.NetUtils; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.net.Inet4Address; @@ -689,7 +690,7 @@ public abstract class WifiEntry implements Comparable<WifiEntry> { try { InetAddress all = InetAddress.getByAddress( new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255}); - mConnectedInfo.subnetMask = NetworkUtils.getNetworkPart( + mConnectedInfo.subnetMask = NetUtils.getNetworkPart( all, addr.getPrefixLength()).getHostAddress(); } catch (UnknownHostException e) { // Leave subnet null; |