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

Commit c0785026 authored by Vinit Deshpande's avatar Vinit Deshpande Committed by Android (Google) Code Review
Browse files

Merge "Unhide WifiAdapter APIs"

parents a228ae95 81e32da9
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -17341,6 +17341,23 @@ package android.net.wifi {
    enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED;
    enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED;
  }
  }
  public class WifiAdapter implements android.os.Parcelable {
    method public int describeContents();
    method public java.lang.String getName();
    method public boolean is5GHzBandSupported();
    method public boolean isDeviceToApRttSupported();
    method public boolean isDeviceToDeviceRttSupported();
    method public boolean isEnhancedPowerReportingSupported();
    method public boolean isOffChannelTdlsSupported();
    method public boolean isP2pSupported();
    method public boolean isPasspointSupported();
    method public boolean isPortableHotspotSupported();
    method public boolean isPreferredNetworkOffloadSupported();
    method public boolean isTdlsSupported();
    method public boolean isWifiScannerSupported();
    method public void writeToParcel(android.os.Parcel, int);
  }
  public class WifiConfiguration implements android.os.Parcelable {
  public class WifiConfiguration implements android.os.Parcelable {
    ctor public WifiConfiguration();
    ctor public WifiConfiguration();
    method public int describeContents();
    method public int describeContents();
@@ -17479,6 +17496,7 @@ package android.net.wifi {
    method public boolean disableNetwork(int);
    method public boolean disableNetwork(int);
    method public boolean disconnect();
    method public boolean disconnect();
    method public boolean enableNetwork(int, boolean);
    method public boolean enableNetwork(int, boolean);
    method public java.util.List<android.net.wifi.WifiAdapter> getAdapters();
    method public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
    method public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
    method public android.net.wifi.WifiInfo getConnectionInfo();
    method public android.net.wifi.WifiInfo getConnectionInfo();
    method public android.net.DhcpInfo getDhcpInfo();
    method public android.net.DhcpInfo getDhcpInfo();
+83 −7
Original line number Original line Diff line number Diff line
@@ -19,34 +19,57 @@ package android.net.wifi;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;


/** @hide */
/**
 * Represents local wifi adapter. Different devices have different kinds of
 * wifi adapters; each with different capabilities. Use this class to find out
 * which capabilites are supported by the wifi adapter on the device.
 */
public class WifiAdapter implements Parcelable {
public class WifiAdapter implements Parcelable {


    /* Keep this list in sync with wifi_hal.h */
    /* Keep this list in sync with wifi_hal.h */
    /** @hide */
    public static final int WIFI_FEATURE_INFRA            = 0x0001;  // Basic infrastructure mode
    public static final int WIFI_FEATURE_INFRA            = 0x0001;  // Basic infrastructure mode
    /** @hide */
    public static final int WIFI_FEATURE_INFRA_5G         = 0x0002;  // Support for 5 GHz Band
    public static final int WIFI_FEATURE_INFRA_5G         = 0x0002;  // Support for 5 GHz Band
    /** @hide */
    public static final int WIFI_FEATURE_PASSPOINT        = 0x0004;  // Support for GAS/ANQP
    public static final int WIFI_FEATURE_PASSPOINT        = 0x0004;  // Support for GAS/ANQP
    /** @hide */
    public static final int WIFI_FEATURE_P2P              = 0x0008;  // Wifi-Direct
    public static final int WIFI_FEATURE_P2P              = 0x0008;  // Wifi-Direct
    /** @hide */
    public static final int WIFI_FEATURE_MOBILE_HOTSPOT   = 0x0010;  // Soft AP
    public static final int WIFI_FEATURE_MOBILE_HOTSPOT   = 0x0010;  // Soft AP
    /** @hide */
    public static final int WIFI_FEATURE_SCANNER          = 0x0020;  // WifiScanner APIs
    public static final int WIFI_FEATURE_SCANNER          = 0x0020;  // WifiScanner APIs
    /** @hide */
    public static final int WIFI_FEATURE_NAN              = 0x0040;  // Neighbor Awareness Networking
    public static final int WIFI_FEATURE_NAN              = 0x0040;  // Neighbor Awareness Networking
    /** @hide */
    public static final int WIFI_FEATURE_D2D_RTT          = 0x0080;  // Device-to-device RTT
    public static final int WIFI_FEATURE_D2D_RTT          = 0x0080;  // Device-to-device RTT
    /** @hide */
    public static final int WIFI_FEATURE_D2AP_RTT         = 0x0100;  // Device-to-AP RTT
    public static final int WIFI_FEATURE_D2AP_RTT         = 0x0100;  // Device-to-AP RTT
    /** @hide */
    public static final int WIFI_FEATURE_BATCH_SCAN       = 0x0200;  // Batched Scan (deprecated)
    public static final int WIFI_FEATURE_BATCH_SCAN       = 0x0200;  // Batched Scan (deprecated)
    /** @hide */
    public static final int WIFI_FEATURE_PNO              = 0x0400;  // Preferred network offload
    public static final int WIFI_FEATURE_PNO              = 0x0400;  // Preferred network offload
    /** @hide */
    public static final int WIFI_FEATURE_ADDITIONAL_STA   = 0x0800;  // Support for two STAs
    public static final int WIFI_FEATURE_ADDITIONAL_STA   = 0x0800;  // Support for two STAs
    /** @hide */
    public static final int WIFI_FEATURE_TDLS             = 0x1000;  // Tunnel directed link setup
    public static final int WIFI_FEATURE_TDLS             = 0x1000;  // Tunnel directed link setup
    /** @hide */
    public static final int WIFI_FEATURE_TDLS_OFFCHANNEL  = 0x2000;  // Support for TDLS off channel
    public static final int WIFI_FEATURE_TDLS_OFFCHANNEL  = 0x2000;  // Support for TDLS off channel
    /** @hide */
    public static final int WIFI_FEATURE_EPR              = 0x4000;  // Enhanced power reporting
    public static final int WIFI_FEATURE_EPR              = 0x4000;  // Enhanced power reporting


    private String name;
    private String name;
    private int    supportedFeatures;
    private int    supportedFeatures;


    /** @hide */
    public WifiAdapter(String name, int supportedFeatures) {
    public WifiAdapter(String name, int supportedFeatures) {
        this.name = name;
        this.name = name;
        this.supportedFeatures = supportedFeatures;
        this.supportedFeatures = supportedFeatures;
    }
    }


    /**
     * @return name of the adapter
     */
    public String getName() {
    public String getName() {
        return name;
        return name;
    }
    }
@@ -59,68 +82,121 @@ public class WifiAdapter implements Parcelable {
        return (supportedFeatures & feature) == feature;
        return (supportedFeatures & feature) == feature;
    }
    }


    /**
     * @return true if this adapter supports 5 GHz band
     */
    public boolean is5GHzBandSupported() {
        return isFeatureSupported(WIFI_FEATURE_INFRA_5G);
    }

    /**
     * @return true if this adapter supports passpoint
     */
    public boolean isPasspointSupported() {
    public boolean isPasspointSupported() {
        return isFeatureSupported(WIFI_FEATURE_PASSPOINT);
        return isFeatureSupported(WIFI_FEATURE_PASSPOINT);
    }
    }


    public boolean isWifiDirectSupported() {
    /**
     * @return true if this adapter supports WifiP2pManager (Wi-Fi Direct)
     */
    public boolean isP2pSupported() {
        return isFeatureSupported(WIFI_FEATURE_P2P);
        return isFeatureSupported(WIFI_FEATURE_P2P);
    }
    }


    public boolean isMobileHotstpoSupported() {
    /**
     * @return true if this adapter supports portable Wi-Fi hotspot
     */
    public boolean isPortableHotspotSupported() {
        return isFeatureSupported(WIFI_FEATURE_MOBILE_HOTSPOT);
        return isFeatureSupported(WIFI_FEATURE_MOBILE_HOTSPOT);
    }
    }


    /**
     * @return true if this adapter supports WifiScanner APIs
     */
    public boolean isWifiScannerSupported() {
    public boolean isWifiScannerSupported() {
        return isFeatureSupported(WIFI_FEATURE_SCANNER);
        return isFeatureSupported(WIFI_FEATURE_SCANNER);
    }
    }


    /**
     * @return true if this adapter supports Neighbour Awareness Network APIs
     * @hide
     */
    public boolean isNanSupported() {
    public boolean isNanSupported() {
        return isFeatureSupported(WIFI_FEATURE_NAN);
        return isFeatureSupported(WIFI_FEATURE_NAN);
    }
    }


    /**
     * @return true if this adapter supports Device-to-device RTT
     */
    public boolean isDeviceToDeviceRttSupported() {
    public boolean isDeviceToDeviceRttSupported() {
        return isFeatureSupported(WIFI_FEATURE_D2D_RTT);
        return isFeatureSupported(WIFI_FEATURE_D2D_RTT);
    }
    }


    /**
     * @return true if this adapter supports Device-to-AP RTT
     */
    public boolean isDeviceToApRttSupported() {
    public boolean isDeviceToApRttSupported() {
        return isFeatureSupported(WIFI_FEATURE_D2AP_RTT);
        return isFeatureSupported(WIFI_FEATURE_D2AP_RTT);
    }
    }


    /**
     * @return true if this adapter supports offloaded connectivity scan
     */
    public boolean isPreferredNetworkOffloadSupported() {
    public boolean isPreferredNetworkOffloadSupported() {
        return isFeatureSupported(WIFI_FEATURE_PNO);
        return isFeatureSupported(WIFI_FEATURE_PNO);
    }
    }


    /**
     * @return true if this adapter supports multiple simultaneous connections
     * @hide
     */
    public boolean isAdditionalStaSupported() {
    public boolean isAdditionalStaSupported() {
        return isFeatureSupported(WIFI_FEATURE_ADDITIONAL_STA);
        return isFeatureSupported(WIFI_FEATURE_ADDITIONAL_STA);
    }
    }


    /**
     * @return true if this adapter supports Tunnel Directed Link Setup
     */
    public boolean isTdlsSupported() {
    public boolean isTdlsSupported() {
        return isFeatureSupported(WIFI_FEATURE_TDLS);
        return isFeatureSupported(WIFI_FEATURE_TDLS);
    }
    }


    /**
     * @return true if this adapter supports Off Channel Tunnel Directed Link Setup
     */
    public boolean isOffChannelTdlsSupported() {
    public boolean isOffChannelTdlsSupported() {
        return isFeatureSupported(WIFI_FEATURE_TDLS_OFFCHANNEL);
        return isFeatureSupported(WIFI_FEATURE_TDLS_OFFCHANNEL);
    }
    }


    /**
     * @return true if this adapter supports advanced power/performance counters
     */
    public boolean isEnhancedPowerReportingSupported() {
    public boolean isEnhancedPowerReportingSupported() {
        return isFeatureSupported(WIFI_FEATURE_EPR);
        return isFeatureSupported(WIFI_FEATURE_EPR);
    }
    }


    /* Parcelable implementation */
    /* Parcelable implementation */

    /**
    /** Implement the Parcelable interface {@hide} */
     * Implement the Parcelable interface
     * {@hide}
     */
    public int describeContents() {
    public int describeContents() {
        return 0;
        return 0;
    }
    }


    /** Implement the Parcelable interface {@hide} */
    /**
     * Implement the Parcelable interface
     * {@hide}
     */
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(name);
        dest.writeInt(supportedFeatures);
        dest.writeInt(supportedFeatures);
    }
    }


    /** Implement the Parcelable interface {@hide} */
    /**
     * Implement the Parcelable interface
     * {@hide}
     */
    public static final Creator<WifiAdapter> CREATOR =
    public static final Creator<WifiAdapter> CREATOR =
            new Creator<WifiAdapter>() {
            new Creator<WifiAdapter>() {
                public WifiAdapter createFromParcel(Parcel in) {
                public WifiAdapter createFromParcel(Parcel in) {
+3 −2
Original line number Original line Diff line number Diff line
@@ -568,9 +568,10 @@ public class WifiManager {
    }
    }


    /**
    /**
     * @hide
     * Retrieve all wifi adapters available on this device
     * @return list of adapters
     */
     */
    public List<WifiAdapter> getAdaptors() {
    public List<WifiAdapter> getAdapters() {
        try {
        try {
            return mService.getAdaptors();
            return mService.getAdaptors();
        } catch (RemoteException e) {
        } catch (RemoteException e) {