Add randomized MAC (last used)

Makes it clear that when a network is disconnected, the randomized MAC
address shown is the last used one. (ie. it could change in the next
connection depending on whether enhanced MAC randomization is active)

Bug: 170166681
Test: Manually verified that the new text is shown for disconnected
networks.

Change-Id: I4aec47b2de68c077e6fdc7efa96d39e6666d4c86
This commit is contained in:
xshu
2020-10-05 18:57:27 -07:00
parent ab45ca09bc
commit 19eabbff63
3 changed files with 30 additions and 5 deletions

View File

@@ -738,10 +738,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
}
mMacAddressPref.setVisible(true);
mMacAddressPref.setTitle((mWifiEntry.getPrivacy() == WifiEntry.PRIVACY_RANDOMIZED_MAC)
? R.string.wifi_advanced_randomized_mac_address_title
: R.string.wifi_advanced_device_mac_address_title);
mMacAddressPref.setTitle(getMacAddressTitle());
if (macAddress.equals(WifiInfo.DEFAULT_MAC_ADDRESS)) {
mMacAddressPref.setSummary(R.string.device_info_not_available);
@@ -750,6 +747,15 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
}
}
private int getMacAddressTitle() {
if (mWifiEntry.getPrivacy() == WifiEntry.PRIVACY_RANDOMIZED_MAC) {
return mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED
? R.string.wifi_advanced_randomized_mac_address_title
: R.string.wifi_advanced_randomized_mac_address_disconnected_title;
}
return R.string.wifi_advanced_device_mac_address_title;
}
private void updatePreference(Preference pref, String detailText) {
if (!TextUtils.isEmpty(detailText)) {
pref.setSummary(detailText);