Loading api/system-current.txt +21 −5 Original line number Diff line number Diff line Loading @@ -8239,8 +8239,8 @@ package android.net.wifi.wificond { public final class NativeScanResult implements android.os.Parcelable { ctor public NativeScanResult(); method public int describeContents(); method @NonNull public byte[] getBssid(); method @NonNull public int getCapabilities(); method @Nullable public android.net.MacAddress getBssid(); method public int getCapabilities(); method public int getFrequencyMhz(); method @NonNull public byte[] getInformationElements(); method @NonNull public java.util.List<android.net.wifi.wificond.RadioChainInfo> getRadioChainInfos(); Loading @@ -8249,15 +8249,31 @@ package android.net.wifi.wificond { method public long getTsf(); method public boolean isAssociated(); method public void writeToParcel(@NonNull android.os.Parcel, int); field public static final int BSS_CAPABILITY_APSD = 2048; // 0x800 field public static final int BSS_CAPABILITY_CF_POLLABLE = 4; // 0x4 field public static final int BSS_CAPABILITY_CF_POLL_REQUEST = 8; // 0x8 field public static final int BSS_CAPABILITY_CHANNEL_AGILITY = 128; // 0x80 field public static final int BSS_CAPABILITY_DELAYED_BLOCK_ACK = 16384; // 0x4000 field public static final int BSS_CAPABILITY_DSSS_OFDM = 8192; // 0x2000 field public static final int BSS_CAPABILITY_ESS = 1; // 0x1 field public static final int BSS_CAPABILITY_IBSS = 2; // 0x2 field public static final int BSS_CAPABILITY_IMMEDIATE_BLOCK_ACK = 32768; // 0x8000 field public static final int BSS_CAPABILITY_PBCC = 64; // 0x40 field public static final int BSS_CAPABILITY_PRIVACY = 16; // 0x10 field public static final int BSS_CAPABILITY_QOS = 512; // 0x200 field public static final int BSS_CAPABILITY_RADIO_MANAGEMENT = 4096; // 0x1000 field public static final int BSS_CAPABILITY_SHORT_PREAMBLE = 32; // 0x20 field public static final int BSS_CAPABILITY_SHORT_SLOT_TIME = 1024; // 0x400 field public static final int BSS_CAPABILITY_SPECTRUM_MANAGEMENT = 256; // 0x100 field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.wificond.NativeScanResult> CREATOR; } public final class NativeWifiClient implements android.os.Parcelable { ctor public NativeWifiClient(@NonNull byte[]); ctor public NativeWifiClient(@Nullable android.net.MacAddress); method public int describeContents(); method @Nullable public android.net.MacAddress getMacAddress(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.wificond.NativeWifiClient> CREATOR; field @NonNull public final byte[] macAddress; } public final class PnoNetwork implements android.os.Parcelable { Loading Loading @@ -8302,7 +8318,7 @@ package android.net.wifi.wificond { public class WifiCondManager { method public void abortScan(@NonNull String); method public void enableVerboseLogging(boolean); method @NonNull public java.util.List<java.lang.Integer> getChannelsMhzForBand(int); method @NonNull public int[] getChannelsMhzForBand(int); method @Nullable public android.net.wifi.wificond.DeviceWiphyCapabilities getDeviceWiphyCapabilities(@NonNull String); method @NonNull public java.util.List<android.net.wifi.wificond.NativeScanResult> getScanResults(@NonNull String, int); method @Nullable public android.net.wifi.wificond.WifiCondManager.TxPacketCounters getTxPacketCounters(@NonNull String); wifi/java/android/net/wifi/wificond/NativeScanResult.java +109 −25 Original line number Diff line number Diff line Loading @@ -16,14 +16,21 @@ package android.net.wifi.wificond; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.MacAddress; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** Loading @@ -33,6 +40,8 @@ import java.util.List; */ @SystemApi public final class NativeScanResult implements Parcelable { private static final String TAG = "NativeScanResult"; /** @hide */ @VisibleForTesting public byte[] ssid; Loading @@ -53,7 +62,7 @@ public final class NativeScanResult implements Parcelable { public long tsf; /** @hide */ @VisibleForTesting public int capability; @BssCapabilityBits public int capability; /** @hide */ @VisibleForTesting public boolean associated; Loading @@ -71,14 +80,17 @@ public final class NativeScanResult implements Parcelable { } /** * Returns raw bytes representing the MAC address (BSSID) of the AP represented by this scan * result. * Returns the MAC address (BSSID) of the AP represented by this scan result. * * @return a byte array, possibly null or containing the incorrect number of bytes for a MAC * address. * @return a MacAddress or null on error. */ @NonNull public byte[] getBssid() { return bssid; @Nullable public MacAddress getBssid() { try { return MacAddress.fromBytes(bssid); } catch (IllegalArgumentException e) { Log.e(TAG, "Illegal argument " + Arrays.toString(bssid), e); return null; } } /** Loading Loading @@ -127,31 +139,103 @@ public final class NativeScanResult implements Parcelable { return associated; } /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, prefix = {"BSS_CAPABILITY_"}, value = {BSS_CAPABILITY_ESS, BSS_CAPABILITY_IBSS, BSS_CAPABILITY_CF_POLLABLE, BSS_CAPABILITY_CF_POLL_REQUEST, BSS_CAPABILITY_PRIVACY, BSS_CAPABILITY_SHORT_PREAMBLE, BSS_CAPABILITY_PBCC, BSS_CAPABILITY_CHANNEL_AGILITY, BSS_CAPABILITY_SPECTRUM_MANAGEMENT, BSS_CAPABILITY_QOS, BSS_CAPABILITY_SHORT_SLOT_TIME, BSS_CAPABILITY_APSD, BSS_CAPABILITY_RADIO_MANAGEMENT, BSS_CAPABILITY_DSSS_OFDM, BSS_CAPABILITY_DELAYED_BLOCK_ACK, BSS_CAPABILITY_IMMEDIATE_BLOCK_ACK }) public @interface BssCapabilityBits { } /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): ESS. */ public static final int BSS_CAPABILITY_ESS = 0x1 << 0; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): IBSS. */ public static final int BSS_CAPABILITY_IBSS = 0x1 << 1; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): CF Pollable. */ public static final int BSS_CAPABILITY_CF_POLLABLE = 0x1 << 2; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): CF-Poll Request. */ public static final int BSS_CAPABILITY_CF_POLL_REQUEST = 0x1 << 3; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Privacy. */ public static final int BSS_CAPABILITY_PRIVACY = 0x1 << 4; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Short Preamble. */ public static final int BSS_CAPABILITY_SHORT_PREAMBLE = 0x1 << 5; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): PBCC. */ public static final int BSS_CAPABILITY_PBCC = 0x1 << 6; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Channel Agility. */ public static final int BSS_CAPABILITY_CHANNEL_AGILITY = 0x1 << 7; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Spectrum Management. */ public static final int BSS_CAPABILITY_SPECTRUM_MANAGEMENT = 0x1 << 8; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): QoS. */ public static final int BSS_CAPABILITY_QOS = 0x1 << 9; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Short Slot Time. */ public static final int BSS_CAPABILITY_SHORT_SLOT_TIME = 0x1 << 10; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): APSD. */ public static final int BSS_CAPABILITY_APSD = 0x1 << 11; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Radio Management. */ public static final int BSS_CAPABILITY_RADIO_MANAGEMENT = 0x1 << 12; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): DSSS-OFDM. */ public static final int BSS_CAPABILITY_DSSS_OFDM = 0x1 << 13; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Delayed Block Ack. */ public static final int BSS_CAPABILITY_DELAYED_BLOCK_ACK = 0x1 << 14; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Immediate Block Ack. */ public static final int BSS_CAPABILITY_IMMEDIATE_BLOCK_ACK = 0x1 << 15; /** * Returns the capabilities of the AP repseresented by this scan result as advertised in the * received probe response or beacon. * * This is a bit mask describing the capabilities of a BSS. See IEEE Std 802.11: 9.4.1.4: * Bit 0 - ESS * Bit 1 - IBSS * Bit 2 - CF Pollable * Bit 3 - CF-Poll Request * Bit 4 - Privacy * Bit 5 - Short Preamble * Bit 6 - PBCC * Bit 7 - Channel Agility * Bit 8 - Spectrum Management * Bit 9 - QoS * Bit 10 - Short Slot Time * Bit 11 - APSD * Bit 12 - Radio Measurement * Bit 13 - DSSS-OFDM * Bit 14 - Delayed Block Ack * Bit 15 - Immediate Block Ack * This is a bit mask describing the capabilities of a BSS. See IEEE Std 802.11: 9.4.1.4: one * of the {@code BSS_CAPABILITY_*} flags. * * @return a bit mask of capabilities. */ @NonNull public int getCapabilities() { @BssCapabilityBits public int getCapabilities() { return capability; } Loading wifi/java/android/net/wifi/wificond/NativeWifiClient.java +20 −11 Original line number Diff line number Diff line Loading @@ -17,11 +17,13 @@ package android.net.wifi.wificond; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.MacAddress; import android.os.Parcel; import android.os.Parcelable; import java.util.Arrays; import java.util.Objects; /** * Structure providing information about clients (STAs) associated with a SoftAp. Loading @@ -30,16 +32,21 @@ import java.util.Arrays; */ @SystemApi public final class NativeWifiClient implements Parcelable { private final MacAddress mMacAddress; /** * The raw bytes of the MAC address of the client (STA) represented by this object. * The MAC address of the client (STA) represented by this object. The MAC address may be null * in case of an error. */ @NonNull public final byte[] macAddress; @Nullable public MacAddress getMacAddress() { return mMacAddress; } /** * Construct a native Wi-Fi client. */ public NativeWifiClient(@NonNull byte[] macAddress) { this.macAddress = macAddress; public NativeWifiClient(@Nullable MacAddress macAddress) { this.mMacAddress = macAddress; } /** override comparator */ Loading @@ -50,13 +57,13 @@ public final class NativeWifiClient implements Parcelable { return false; } NativeWifiClient other = (NativeWifiClient) rhs; return Arrays.equals(macAddress, other.macAddress); return Objects.equals(mMacAddress, other.mMacAddress); } /** override hash code */ @Override public int hashCode() { return Arrays.hashCode(macAddress); return mMacAddress.hashCode(); } /** implement Parcelable interface */ Loading @@ -71,7 +78,7 @@ public final class NativeWifiClient implements Parcelable { */ @Override public void writeToParcel(@NonNull Parcel out, int flags) { out.writeByteArray(macAddress); out.writeByteArray(mMacAddress.toByteArray()); } /** implement Parcelable interface */ Loading @@ -79,9 +86,11 @@ public final class NativeWifiClient implements Parcelable { new Parcelable.Creator<NativeWifiClient>() { @Override public NativeWifiClient createFromParcel(Parcel in) { byte[] macAddress = in.createByteArray(); if (macAddress == null) { macAddress = new byte[0]; MacAddress macAddress; try { macAddress = MacAddress.fromBytes(in.createByteArray()); } catch (IllegalArgumentException e) { macAddress = null; } return new NativeWifiClient(macAddress); } Loading wifi/java/android/net/wifi/wificond/WifiCondManager.java +8 −11 Original line number Diff line number Diff line Loading @@ -41,19 +41,16 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; /** * This class encapsulates the interface the wificond (Wi-Fi Conductor) daemon presents to the * Wi-Fi framework. The interface is only for use by the Wi-Fi framework and access is protected * by SELinux permissions: only the system server and wpa_supplicant can use WifiCondManager. * This class encapsulates the interface the wificond daemon presents to the Wi-Fi framework. The * interface is only for use by the Wi-Fi framework and access is protected by SELinux permissions. * * @hide */ Loading Loading @@ -371,7 +368,7 @@ public class WifiCondManager { public void onConnectedClientsChanged(NativeWifiClient client, boolean isConnected) { if (mVerboseLoggingEnabled) { Log.d(TAG, "onConnectedClientsChanged called with " + client.macAddress + " isConnected: " + isConnected); + client.getMacAddress() + " isConnected: " + isConnected); } Binder.clearCallingIdentity(); Loading Loading @@ -1046,13 +1043,13 @@ public class WifiCondManager { * WifiScanner.WIFI_BAND_5_GHZ * WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY * WifiScanner.WIFI_BAND_6_GHZ * @return frequencies List of valid frequencies (MHz), or an empty list for error. * @return frequencies vector of valid frequencies (MHz), or an empty array for error. * @throws IllegalArgumentException if band is not recognized. */ public @NonNull List<Integer> getChannelsMhzForBand(@WifiAnnotations.WifiBandBasic int band) { public @NonNull int[] getChannelsMhzForBand(@WifiAnnotations.WifiBandBasic int band) { if (mWificond == null) { Log.e(TAG, "No valid wificond scanner interface handler"); return Collections.emptyList(); return new int[0]; } int[] result = null; try { Loading @@ -1076,9 +1073,9 @@ public class WifiCondManager { Log.e(TAG, "Failed to request getChannelsForBand due to remote exception"); } if (result == null) { return Collections.emptyList(); result = new int[0]; } return Arrays.stream(result).boxed().collect(Collectors.toList()); return result; } /** Helper function to look up the interface handle using name */ Loading wifi/tests/src/android/net/wifi/wificond/WifiCondManagerTest.java +4 −36 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import static org.mockito.Mockito.when; import android.app.AlarmManager; import android.app.test.TestAlarmManager; import android.content.Context; import android.net.MacAddress; import android.net.wifi.ScanResult; import android.net.wifi.SoftApInfo; import android.net.wifi.WifiConfiguration; Loading Loading @@ -65,8 +66,6 @@ import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; Loading Loading @@ -121,7 +120,8 @@ public class WifiCondManagerTest { private static final String TEST_QUOTED_SSID_2 = "\"testSsid2\""; private static final int[] TEST_FREQUENCIES_1 = {}; private static final int[] TEST_FREQUENCIES_2 = {2500, 5124}; private static final byte[] TEST_RAW_MAC_BYTES = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}; private static final MacAddress TEST_RAW_MAC_BYTES = MacAddress.fromBytes( new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}); private static final List<byte[]> SCAN_HIDDEN_NETWORK_SSID_LIST = new ArrayList<byte[]>() {{ Loading Loading @@ -742,42 +742,10 @@ public class WifiCondManagerTest { verify(deathHandler).run(); // The handles should be cleared after death. assertEquals(0, mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_5_GHZ).size()); assertEquals(0, mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_5_GHZ).length); verify(mWificond, never()).getAvailable5gNonDFSChannels(); } /** * Verify primitive array to list translation of channel API. */ @Test public void testGetChannels() throws Exception { int[] resultsEmpty = new int[0]; int[] resultsSingle = new int[]{100}; int[] resultsMore = new int[]{100, 200}; List<Integer> emptyList = Collections.emptyList(); List<Integer> singleList = Arrays.asList(100); List<Integer> moreList = Arrays.asList(100, 200); when(mWificond.getAvailable2gChannels()).thenReturn(null); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), emptyList); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_5_GHZ), emptyList); when(mWificond.getAvailable2gChannels()).thenReturn(resultsEmpty); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), emptyList); when(mWificond.getAvailable2gChannels()).thenReturn(resultsSingle); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), singleList); when(mWificond.getAvailable2gChannels()).thenReturn(resultsMore); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), moreList); } /** * sendMgmtFrame() should fail if a null callback is passed in. */ Loading Loading
api/system-current.txt +21 −5 Original line number Diff line number Diff line Loading @@ -8239,8 +8239,8 @@ package android.net.wifi.wificond { public final class NativeScanResult implements android.os.Parcelable { ctor public NativeScanResult(); method public int describeContents(); method @NonNull public byte[] getBssid(); method @NonNull public int getCapabilities(); method @Nullable public android.net.MacAddress getBssid(); method public int getCapabilities(); method public int getFrequencyMhz(); method @NonNull public byte[] getInformationElements(); method @NonNull public java.util.List<android.net.wifi.wificond.RadioChainInfo> getRadioChainInfos(); Loading @@ -8249,15 +8249,31 @@ package android.net.wifi.wificond { method public long getTsf(); method public boolean isAssociated(); method public void writeToParcel(@NonNull android.os.Parcel, int); field public static final int BSS_CAPABILITY_APSD = 2048; // 0x800 field public static final int BSS_CAPABILITY_CF_POLLABLE = 4; // 0x4 field public static final int BSS_CAPABILITY_CF_POLL_REQUEST = 8; // 0x8 field public static final int BSS_CAPABILITY_CHANNEL_AGILITY = 128; // 0x80 field public static final int BSS_CAPABILITY_DELAYED_BLOCK_ACK = 16384; // 0x4000 field public static final int BSS_CAPABILITY_DSSS_OFDM = 8192; // 0x2000 field public static final int BSS_CAPABILITY_ESS = 1; // 0x1 field public static final int BSS_CAPABILITY_IBSS = 2; // 0x2 field public static final int BSS_CAPABILITY_IMMEDIATE_BLOCK_ACK = 32768; // 0x8000 field public static final int BSS_CAPABILITY_PBCC = 64; // 0x40 field public static final int BSS_CAPABILITY_PRIVACY = 16; // 0x10 field public static final int BSS_CAPABILITY_QOS = 512; // 0x200 field public static final int BSS_CAPABILITY_RADIO_MANAGEMENT = 4096; // 0x1000 field public static final int BSS_CAPABILITY_SHORT_PREAMBLE = 32; // 0x20 field public static final int BSS_CAPABILITY_SHORT_SLOT_TIME = 1024; // 0x400 field public static final int BSS_CAPABILITY_SPECTRUM_MANAGEMENT = 256; // 0x100 field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.wificond.NativeScanResult> CREATOR; } public final class NativeWifiClient implements android.os.Parcelable { ctor public NativeWifiClient(@NonNull byte[]); ctor public NativeWifiClient(@Nullable android.net.MacAddress); method public int describeContents(); method @Nullable public android.net.MacAddress getMacAddress(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.wificond.NativeWifiClient> CREATOR; field @NonNull public final byte[] macAddress; } public final class PnoNetwork implements android.os.Parcelable { Loading Loading @@ -8302,7 +8318,7 @@ package android.net.wifi.wificond { public class WifiCondManager { method public void abortScan(@NonNull String); method public void enableVerboseLogging(boolean); method @NonNull public java.util.List<java.lang.Integer> getChannelsMhzForBand(int); method @NonNull public int[] getChannelsMhzForBand(int); method @Nullable public android.net.wifi.wificond.DeviceWiphyCapabilities getDeviceWiphyCapabilities(@NonNull String); method @NonNull public java.util.List<android.net.wifi.wificond.NativeScanResult> getScanResults(@NonNull String, int); method @Nullable public android.net.wifi.wificond.WifiCondManager.TxPacketCounters getTxPacketCounters(@NonNull String);
wifi/java/android/net/wifi/wificond/NativeScanResult.java +109 −25 Original line number Diff line number Diff line Loading @@ -16,14 +16,21 @@ package android.net.wifi.wificond; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.MacAddress; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** Loading @@ -33,6 +40,8 @@ import java.util.List; */ @SystemApi public final class NativeScanResult implements Parcelable { private static final String TAG = "NativeScanResult"; /** @hide */ @VisibleForTesting public byte[] ssid; Loading @@ -53,7 +62,7 @@ public final class NativeScanResult implements Parcelable { public long tsf; /** @hide */ @VisibleForTesting public int capability; @BssCapabilityBits public int capability; /** @hide */ @VisibleForTesting public boolean associated; Loading @@ -71,14 +80,17 @@ public final class NativeScanResult implements Parcelable { } /** * Returns raw bytes representing the MAC address (BSSID) of the AP represented by this scan * result. * Returns the MAC address (BSSID) of the AP represented by this scan result. * * @return a byte array, possibly null or containing the incorrect number of bytes for a MAC * address. * @return a MacAddress or null on error. */ @NonNull public byte[] getBssid() { return bssid; @Nullable public MacAddress getBssid() { try { return MacAddress.fromBytes(bssid); } catch (IllegalArgumentException e) { Log.e(TAG, "Illegal argument " + Arrays.toString(bssid), e); return null; } } /** Loading Loading @@ -127,31 +139,103 @@ public final class NativeScanResult implements Parcelable { return associated; } /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, prefix = {"BSS_CAPABILITY_"}, value = {BSS_CAPABILITY_ESS, BSS_CAPABILITY_IBSS, BSS_CAPABILITY_CF_POLLABLE, BSS_CAPABILITY_CF_POLL_REQUEST, BSS_CAPABILITY_PRIVACY, BSS_CAPABILITY_SHORT_PREAMBLE, BSS_CAPABILITY_PBCC, BSS_CAPABILITY_CHANNEL_AGILITY, BSS_CAPABILITY_SPECTRUM_MANAGEMENT, BSS_CAPABILITY_QOS, BSS_CAPABILITY_SHORT_SLOT_TIME, BSS_CAPABILITY_APSD, BSS_CAPABILITY_RADIO_MANAGEMENT, BSS_CAPABILITY_DSSS_OFDM, BSS_CAPABILITY_DELAYED_BLOCK_ACK, BSS_CAPABILITY_IMMEDIATE_BLOCK_ACK }) public @interface BssCapabilityBits { } /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): ESS. */ public static final int BSS_CAPABILITY_ESS = 0x1 << 0; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): IBSS. */ public static final int BSS_CAPABILITY_IBSS = 0x1 << 1; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): CF Pollable. */ public static final int BSS_CAPABILITY_CF_POLLABLE = 0x1 << 2; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): CF-Poll Request. */ public static final int BSS_CAPABILITY_CF_POLL_REQUEST = 0x1 << 3; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Privacy. */ public static final int BSS_CAPABILITY_PRIVACY = 0x1 << 4; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Short Preamble. */ public static final int BSS_CAPABILITY_SHORT_PREAMBLE = 0x1 << 5; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): PBCC. */ public static final int BSS_CAPABILITY_PBCC = 0x1 << 6; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Channel Agility. */ public static final int BSS_CAPABILITY_CHANNEL_AGILITY = 0x1 << 7; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Spectrum Management. */ public static final int BSS_CAPABILITY_SPECTRUM_MANAGEMENT = 0x1 << 8; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): QoS. */ public static final int BSS_CAPABILITY_QOS = 0x1 << 9; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Short Slot Time. */ public static final int BSS_CAPABILITY_SHORT_SLOT_TIME = 0x1 << 10; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): APSD. */ public static final int BSS_CAPABILITY_APSD = 0x1 << 11; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Radio Management. */ public static final int BSS_CAPABILITY_RADIO_MANAGEMENT = 0x1 << 12; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): DSSS-OFDM. */ public static final int BSS_CAPABILITY_DSSS_OFDM = 0x1 << 13; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Delayed Block Ack. */ public static final int BSS_CAPABILITY_DELAYED_BLOCK_ACK = 0x1 << 14; /** * BSS capability bit (see IEEE Std 802.11: 9.4.1.4): Immediate Block Ack. */ public static final int BSS_CAPABILITY_IMMEDIATE_BLOCK_ACK = 0x1 << 15; /** * Returns the capabilities of the AP repseresented by this scan result as advertised in the * received probe response or beacon. * * This is a bit mask describing the capabilities of a BSS. See IEEE Std 802.11: 9.4.1.4: * Bit 0 - ESS * Bit 1 - IBSS * Bit 2 - CF Pollable * Bit 3 - CF-Poll Request * Bit 4 - Privacy * Bit 5 - Short Preamble * Bit 6 - PBCC * Bit 7 - Channel Agility * Bit 8 - Spectrum Management * Bit 9 - QoS * Bit 10 - Short Slot Time * Bit 11 - APSD * Bit 12 - Radio Measurement * Bit 13 - DSSS-OFDM * Bit 14 - Delayed Block Ack * Bit 15 - Immediate Block Ack * This is a bit mask describing the capabilities of a BSS. See IEEE Std 802.11: 9.4.1.4: one * of the {@code BSS_CAPABILITY_*} flags. * * @return a bit mask of capabilities. */ @NonNull public int getCapabilities() { @BssCapabilityBits public int getCapabilities() { return capability; } Loading
wifi/java/android/net/wifi/wificond/NativeWifiClient.java +20 −11 Original line number Diff line number Diff line Loading @@ -17,11 +17,13 @@ package android.net.wifi.wificond; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.MacAddress; import android.os.Parcel; import android.os.Parcelable; import java.util.Arrays; import java.util.Objects; /** * Structure providing information about clients (STAs) associated with a SoftAp. Loading @@ -30,16 +32,21 @@ import java.util.Arrays; */ @SystemApi public final class NativeWifiClient implements Parcelable { private final MacAddress mMacAddress; /** * The raw bytes of the MAC address of the client (STA) represented by this object. * The MAC address of the client (STA) represented by this object. The MAC address may be null * in case of an error. */ @NonNull public final byte[] macAddress; @Nullable public MacAddress getMacAddress() { return mMacAddress; } /** * Construct a native Wi-Fi client. */ public NativeWifiClient(@NonNull byte[] macAddress) { this.macAddress = macAddress; public NativeWifiClient(@Nullable MacAddress macAddress) { this.mMacAddress = macAddress; } /** override comparator */ Loading @@ -50,13 +57,13 @@ public final class NativeWifiClient implements Parcelable { return false; } NativeWifiClient other = (NativeWifiClient) rhs; return Arrays.equals(macAddress, other.macAddress); return Objects.equals(mMacAddress, other.mMacAddress); } /** override hash code */ @Override public int hashCode() { return Arrays.hashCode(macAddress); return mMacAddress.hashCode(); } /** implement Parcelable interface */ Loading @@ -71,7 +78,7 @@ public final class NativeWifiClient implements Parcelable { */ @Override public void writeToParcel(@NonNull Parcel out, int flags) { out.writeByteArray(macAddress); out.writeByteArray(mMacAddress.toByteArray()); } /** implement Parcelable interface */ Loading @@ -79,9 +86,11 @@ public final class NativeWifiClient implements Parcelable { new Parcelable.Creator<NativeWifiClient>() { @Override public NativeWifiClient createFromParcel(Parcel in) { byte[] macAddress = in.createByteArray(); if (macAddress == null) { macAddress = new byte[0]; MacAddress macAddress; try { macAddress = MacAddress.fromBytes(in.createByteArray()); } catch (IllegalArgumentException e) { macAddress = null; } return new NativeWifiClient(macAddress); } Loading
wifi/java/android/net/wifi/wificond/WifiCondManager.java +8 −11 Original line number Diff line number Diff line Loading @@ -41,19 +41,16 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; /** * This class encapsulates the interface the wificond (Wi-Fi Conductor) daemon presents to the * Wi-Fi framework. The interface is only for use by the Wi-Fi framework and access is protected * by SELinux permissions: only the system server and wpa_supplicant can use WifiCondManager. * This class encapsulates the interface the wificond daemon presents to the Wi-Fi framework. The * interface is only for use by the Wi-Fi framework and access is protected by SELinux permissions. * * @hide */ Loading Loading @@ -371,7 +368,7 @@ public class WifiCondManager { public void onConnectedClientsChanged(NativeWifiClient client, boolean isConnected) { if (mVerboseLoggingEnabled) { Log.d(TAG, "onConnectedClientsChanged called with " + client.macAddress + " isConnected: " + isConnected); + client.getMacAddress() + " isConnected: " + isConnected); } Binder.clearCallingIdentity(); Loading Loading @@ -1046,13 +1043,13 @@ public class WifiCondManager { * WifiScanner.WIFI_BAND_5_GHZ * WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY * WifiScanner.WIFI_BAND_6_GHZ * @return frequencies List of valid frequencies (MHz), or an empty list for error. * @return frequencies vector of valid frequencies (MHz), or an empty array for error. * @throws IllegalArgumentException if band is not recognized. */ public @NonNull List<Integer> getChannelsMhzForBand(@WifiAnnotations.WifiBandBasic int band) { public @NonNull int[] getChannelsMhzForBand(@WifiAnnotations.WifiBandBasic int band) { if (mWificond == null) { Log.e(TAG, "No valid wificond scanner interface handler"); return Collections.emptyList(); return new int[0]; } int[] result = null; try { Loading @@ -1076,9 +1073,9 @@ public class WifiCondManager { Log.e(TAG, "Failed to request getChannelsForBand due to remote exception"); } if (result == null) { return Collections.emptyList(); result = new int[0]; } return Arrays.stream(result).boxed().collect(Collectors.toList()); return result; } /** Helper function to look up the interface handle using name */ Loading
wifi/tests/src/android/net/wifi/wificond/WifiCondManagerTest.java +4 −36 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import static org.mockito.Mockito.when; import android.app.AlarmManager; import android.app.test.TestAlarmManager; import android.content.Context; import android.net.MacAddress; import android.net.wifi.ScanResult; import android.net.wifi.SoftApInfo; import android.net.wifi.WifiConfiguration; Loading Loading @@ -65,8 +66,6 @@ import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; Loading Loading @@ -121,7 +120,8 @@ public class WifiCondManagerTest { private static final String TEST_QUOTED_SSID_2 = "\"testSsid2\""; private static final int[] TEST_FREQUENCIES_1 = {}; private static final int[] TEST_FREQUENCIES_2 = {2500, 5124}; private static final byte[] TEST_RAW_MAC_BYTES = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}; private static final MacAddress TEST_RAW_MAC_BYTES = MacAddress.fromBytes( new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}); private static final List<byte[]> SCAN_HIDDEN_NETWORK_SSID_LIST = new ArrayList<byte[]>() {{ Loading Loading @@ -742,42 +742,10 @@ public class WifiCondManagerTest { verify(deathHandler).run(); // The handles should be cleared after death. assertEquals(0, mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_5_GHZ).size()); assertEquals(0, mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_5_GHZ).length); verify(mWificond, never()).getAvailable5gNonDFSChannels(); } /** * Verify primitive array to list translation of channel API. */ @Test public void testGetChannels() throws Exception { int[] resultsEmpty = new int[0]; int[] resultsSingle = new int[]{100}; int[] resultsMore = new int[]{100, 200}; List<Integer> emptyList = Collections.emptyList(); List<Integer> singleList = Arrays.asList(100); List<Integer> moreList = Arrays.asList(100, 200); when(mWificond.getAvailable2gChannels()).thenReturn(null); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), emptyList); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_5_GHZ), emptyList); when(mWificond.getAvailable2gChannels()).thenReturn(resultsEmpty); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), emptyList); when(mWificond.getAvailable2gChannels()).thenReturn(resultsSingle); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), singleList); when(mWificond.getAvailable2gChannels()).thenReturn(resultsMore); assertEquals(mWificondControl.getChannelsMhzForBand(WifiScanner.WIFI_BAND_24_GHZ), moreList); } /** * sendMgmtFrame() should fail if a null callback is passed in. */ Loading