Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1aeb383d authored by Paul Stewart's avatar Paul Stewart
Browse files

Don't display an invalid Wi-Fi MAC address

Only display the WifiInfo MAC address if it is a valid address.
Otherwise, display "Unavailable".  The underlying WifiInfo class
now has a default value, and a method that can be used to test
whether or not the contained address is valid.  This change uses
this test and avoids having the confusing default address displayed.

Bug: 32478606
Test: Manual: Turn off WiFi and reboot -- make sure "Unavailable"
      is displayed as the Wi-Fi MAC Address as opposed to "02:00:00:00:00:00"

Change-Id: I912804eb65735375e0ca3c4618a6399543f33b57
parent 363c529d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -280,7 +280,8 @@ public class Status extends SettingsPreferenceFragment {

    private void setWifiStatus() {
        WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
        String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
        boolean hasMacAddress = wifiInfo != null && wifiInfo.hasRealMacAddress();
        String macAddress = hasMacAddress ? wifiInfo.getMacAddress() : null;
        mWifiMacAddress.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress : mUnavailable);
    }