diff options
author | Quang Luong <qal@google.com> | 2020-06-15 19:27:22 -0700 |
---|---|---|
committer | Quang Luong <qal@google.com> | 2020-06-17 18:22:27 -0700 |
commit | fb7f215d863627f325f101a3356bf2cfc65f7e58 (patch) | |
tree | 3bd4ae0feb4c8198d24306384282a1ca90dd32d0 /libs | |
parent | 5b205ac7658ec00c538fe8a2a3a08a4c62db791a (diff) |
[WifiTrackerLib] Implement Passpoint isMetered() and getMacAddress()
Adds correct functionality for PasspointWifiEntry.isMetered() and
getMacAddress().
Bug: 159074196
Test: atest WifiTrackerLibTests
Change-Id: I098b9210fb49d2be5f892d3ede3e59dc399e381b
Diffstat (limited to 'libs')
-rw-r--r-- | libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java index 3e8db7fcf..c7439301f 100644 --- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java +++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java @@ -277,14 +277,22 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry @Override public String getMacAddress() { - // TODO(b/70983952): Fill this method in - return null; + if (mWifiConfig == null || getPrivacy() != PRIVACY_RANDOMIZED_MAC) { + final String[] factoryMacs = mWifiManager.getFactoryMacAddresses(); + if (factoryMacs.length > 0) { + return factoryMacs[0]; + } else { + return null; + } + } else { + return mWifiConfig.getRandomizedMacAddress().toString(); + } } @Override public boolean isMetered() { - // TODO(b/70983952): Fill this method in - return false; + return getMeteredChoice() == METERED_CHOICE_METERED + || (mWifiConfig != null && mWifiConfig.meteredHint); } @Override @@ -358,7 +366,7 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry @Override public boolean canForget() { - return mPasspointConfig != null; + return !isSuggestion() && mPasspointConfig != null; } @Override @@ -405,7 +413,7 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry @Override public boolean canSetMeteredChoice() { - return mPasspointConfig != null; + return !isSuggestion() && mPasspointConfig != null; } @Override @@ -434,7 +442,7 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry @Override public boolean canSetPrivacy() { - return mPasspointConfig != null; + return !isSuggestion() && mPasspointConfig != null; } @Override |