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

Commit b55ba05c authored by Roshan Pius's avatar Roshan Pius
Browse files

WifiManager: Add @SystemApi for STA/AP MAC randomization

This ensures that we don't use wifi overlays in settings.

Bug: 143464763
Test: Verfied MAC randomization setting toggle via Wifi picker.
Change-Id: I24ec509be579ec9c1a3d5e18fdc8d5709d83886c
parent 3ab732bc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4828,6 +4828,8 @@ package android.net.wifi {
    method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public android.net.wifi.WifiConfiguration getWifiApConfiguration();
    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public int getWifiApState();
    method public boolean isApMacRandomizationSupported();
    method public boolean isConnectedMacRandomizationSupported();
    method @Deprecated public boolean isDeviceToDeviceRttSupported();
    method public boolean isPortableHotspotSupported();
    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isWifiApEnabled();
+22 −0
Original line number Diff line number Diff line
@@ -2220,6 +2220,10 @@ public class WifiManager {
    public static final long WIFI_FEATURE_DPP              = 0x80000000L; // DPP (Easy-Connect)
    /** @hide */
    public static final long WIFI_FEATURE_P2P_RAND_MAC    = 0x100000000L; // Random P2P MAC
    /** @hide */
    public static final long WIFI_FEATURE_CONNECTED_RAND_MAC    = 0x200000000L; // Random STA MAC
    /** @hide */
    public static final long WIFI_FEATURE_AP_RAND_MAC    = 0x400000000L; // Random AP MAC

    private long getSupportedFeatures() {
        try {
@@ -2344,6 +2348,24 @@ public class WifiManager {
        return isFeatureSupported(WIFI_FEATURE_LINK_LAYER_STATS);
    }

    /**
     * @return true if this device supports connected MAC randomization.
     * @hide
     */
    @SystemApi
    public boolean isConnectedMacRandomizationSupported() {
        return isFeatureSupported(WIFI_FEATURE_CONNECTED_RAND_MAC);
    }

    /**
     * @return true if this device supports connected MAC randomization.
     * @hide
     */
    @SystemApi
    public boolean isApMacRandomizationSupported() {
        return isFeatureSupported(WIFI_FEATURE_AP_RAND_MAC);
    }

    /**
     * Return the record of {@link WifiActivityEnergyInfo} object that
     * has the activity and energy info. This can be used to ascertain what