Merge "Wifi: Clean up APIs" into rvc-dev
This commit is contained in:
@@ -31106,6 +31106,7 @@ package android.net.wifi {
|
|||||||
|
|
||||||
public class ScanResult implements android.os.Parcelable {
|
public class ScanResult implements android.os.Parcelable {
|
||||||
ctor public ScanResult(@NonNull android.net.wifi.ScanResult);
|
ctor public ScanResult(@NonNull android.net.wifi.ScanResult);
|
||||||
|
ctor public ScanResult();
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method @NonNull public java.util.List<android.net.wifi.ScanResult.InformationElement> getInformationElements();
|
method @NonNull public java.util.List<android.net.wifi.ScanResult.InformationElement> getInformationElements();
|
||||||
method public int getWifiStandard();
|
method public int getWifiStandard();
|
||||||
@@ -31377,6 +31378,15 @@ package android.net.wifi {
|
|||||||
field public static final int LINK_SPEED_UNKNOWN = -1; // 0xffffffff
|
field public static final int LINK_SPEED_UNKNOWN = -1; // 0xffffffff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class WifiInfo.Builder {
|
||||||
|
ctor public WifiInfo.Builder();
|
||||||
|
method @NonNull public android.net.wifi.WifiInfo build();
|
||||||
|
method @NonNull public android.net.wifi.WifiInfo.Builder setBssid(@NonNull String);
|
||||||
|
method @NonNull public android.net.wifi.WifiInfo.Builder setNetworkId(int);
|
||||||
|
method @NonNull public android.net.wifi.WifiInfo.Builder setRssi(int);
|
||||||
|
method @NonNull public android.net.wifi.WifiInfo.Builder setSsid(@NonNull byte[]);
|
||||||
|
}
|
||||||
|
|
||||||
public class WifiManager {
|
public class WifiManager {
|
||||||
method @Deprecated public int addNetwork(android.net.wifi.WifiConfiguration);
|
method @Deprecated public int addNetwork(android.net.wifi.WifiConfiguration);
|
||||||
method @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public int addNetworkSuggestions(@NonNull java.util.List<android.net.wifi.WifiNetworkSuggestion>);
|
method @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public int addNetworkSuggestions(@NonNull java.util.List<android.net.wifi.WifiNetworkSuggestion>);
|
||||||
@@ -31560,6 +31570,20 @@ package android.net.wifi {
|
|||||||
|
|
||||||
public final class WifiNetworkSuggestion implements android.os.Parcelable {
|
public final class WifiNetworkSuggestion implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
|
method @Nullable public android.net.MacAddress getBssid();
|
||||||
|
method @Nullable public android.net.wifi.WifiEnterpriseConfig getEnterpriseConfig();
|
||||||
|
method @Nullable public String getPassphrase();
|
||||||
|
method @Nullable public android.net.wifi.hotspot2.PasspointConfiguration getPasspointConfig();
|
||||||
|
method @IntRange(from=0) public int getPriority();
|
||||||
|
method @Nullable public String getSsid();
|
||||||
|
method public boolean isAppInteractionRequired();
|
||||||
|
method public boolean isCredentialSharedWithUser();
|
||||||
|
method public boolean isEnhancedOpen();
|
||||||
|
method public boolean isHiddenSsid();
|
||||||
|
method public boolean isInitialAutojoinEnabled();
|
||||||
|
method public boolean isMetered();
|
||||||
|
method public boolean isUntrusted();
|
||||||
|
method public boolean isUserInteractionRequired();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkSuggestion> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkSuggestion> CREATOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7171,7 +7171,6 @@ package android.net.wifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ScanResult implements android.os.Parcelable {
|
public class ScanResult implements android.os.Parcelable {
|
||||||
ctor public ScanResult();
|
|
||||||
field public static final int CIPHER_CCMP = 3; // 0x3
|
field public static final int CIPHER_CCMP = 3; // 0x3
|
||||||
field public static final int CIPHER_GCMP_256 = 4; // 0x4
|
field public static final int CIPHER_GCMP_256 = 4; // 0x4
|
||||||
field public static final int CIPHER_NONE = 0; // 0x0
|
field public static final int CIPHER_NONE = 0; // 0x0
|
||||||
@@ -7379,15 +7378,6 @@ package android.net.wifi {
|
|||||||
field public static final int INVALID_RSSI = -127; // 0xffffff81
|
field public static final int INVALID_RSSI = -127; // 0xffffff81
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class WifiInfo.Builder {
|
|
||||||
ctor public WifiInfo.Builder();
|
|
||||||
method @NonNull public android.net.wifi.WifiInfo build();
|
|
||||||
method @NonNull public android.net.wifi.WifiInfo.Builder setBssid(@NonNull String);
|
|
||||||
method @NonNull public android.net.wifi.WifiInfo.Builder setNetworkId(int);
|
|
||||||
method @NonNull public android.net.wifi.WifiInfo.Builder setRssi(int);
|
|
||||||
method @NonNull public android.net.wifi.WifiInfo.Builder setSsid(@NonNull byte[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class WifiManager {
|
public class WifiManager {
|
||||||
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
|
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
|
||||||
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoin(int, boolean);
|
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoin(int, boolean);
|
||||||
@@ -7618,7 +7608,6 @@ package android.net.wifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class WifiNetworkSuggestion implements android.os.Parcelable {
|
public final class WifiNetworkSuggestion implements android.os.Parcelable {
|
||||||
method @Nullable public android.net.wifi.hotspot2.PasspointConfiguration getPasspointConfiguration();
|
|
||||||
method @NonNull public android.net.wifi.WifiConfiguration getWifiConfiguration();
|
method @NonNull public android.net.wifi.WifiConfiguration getWifiConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import android.compat.annotation.UnsupportedAppUsage;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@@ -861,19 +859,7 @@ public class ScanResult implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Construct an empty scan result. */
|
||||||
* Construct an empty scan result.
|
|
||||||
*
|
|
||||||
* Test code has a need to construct a ScanResult in a specific state.
|
|
||||||
* (Note that mocking using Mockito does not work if the object needs to be parceled and
|
|
||||||
* unparceled.)
|
|
||||||
* Export a @SystemApi default constructor to allow tests to construct an empty ScanResult
|
|
||||||
* object. The test can then directly set the fields it cares about.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@SystemApi
|
|
||||||
@VisibleForTesting
|
|
||||||
public ScanResult() {
|
public ScanResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
|
||||||
|
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
@@ -380,20 +378,7 @@ public class WifiInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Builder for WifiInfo */
|
||||||
* WifiInfo exports an immutable public API.
|
|
||||||
* However, test code has a need to construct a WifiInfo in a specific state.
|
|
||||||
* (Note that mocking using Mockito does not work if the object needs to be parceled and
|
|
||||||
* unparceled.)
|
|
||||||
* Export a @SystemApi Builder to allow tests to construct a WifiInfo object
|
|
||||||
* in the desired state, without sacrificing WifiInfo's immutability.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
// This builder was not made public to reduce confusion for external developers as there are
|
|
||||||
// no legitimate uses for this builder except for testing.
|
|
||||||
@SystemApi
|
|
||||||
@VisibleForTesting
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private final WifiInfo mWifiInfo = new WifiInfo();
|
private final WifiInfo mWifiInfo = new WifiInfo();
|
||||||
|
|
||||||
|
|||||||
@@ -857,14 +857,107 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
|||||||
return wifiConfiguration;
|
return wifiConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the BSSID, or null if unset.
|
||||||
|
* @see Builder#setBssid(MacAddress)
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public MacAddress getBssid() {
|
||||||
|
if (wifiConfiguration.BSSID == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return MacAddress.fromString(wifiConfiguration.BSSID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setCredentialSharedWithUser(boolean) */
|
||||||
|
public boolean isCredentialSharedWithUser() {
|
||||||
|
return isUserAllowedToManuallyConnect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setIsAppInteractionRequired(boolean) */
|
||||||
|
public boolean isAppInteractionRequired() {
|
||||||
|
return isAppInteractionRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setIsEnhancedOpen(boolean) */
|
||||||
|
public boolean isEnhancedOpen() {
|
||||||
|
return wifiConfiguration.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.OWE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setIsHiddenSsid(boolean) */
|
||||||
|
public boolean isHiddenSsid() {
|
||||||
|
return wifiConfiguration.hiddenSSID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setIsInitialAutojoinEnabled(boolean) */
|
||||||
|
public boolean isInitialAutojoinEnabled() {
|
||||||
|
return isInitialAutoJoinEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setIsMetered(boolean) */
|
||||||
|
public boolean isMetered() {
|
||||||
|
return wifiConfiguration.meteredOverride == WifiConfiguration.METERED_OVERRIDE_METERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setIsUserInteractionRequired(boolean) */
|
||||||
|
public boolean isUserInteractionRequired() {
|
||||||
|
return isUserInteractionRequired;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link PasspointConfiguration} associated with this Suggestion, or null if this
|
* Get the {@link PasspointConfiguration} associated with this Suggestion, or null if this
|
||||||
* Suggestion is not for a Passpoint network.
|
* Suggestion is not for a Passpoint network.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public PasspointConfiguration getPasspointConfiguration() {
|
public PasspointConfiguration getPasspointConfig() {
|
||||||
return passpointConfiguration;
|
return passpointConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setPriority(int) */
|
||||||
|
@IntRange(from = 0)
|
||||||
|
public int getPriority() {
|
||||||
|
return wifiConfiguration.priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the SSID of the network, or null if this is a Passpoint network.
|
||||||
|
* @see Builder#setSsid(String)
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public String getSsid() {
|
||||||
|
if (wifiConfiguration.SSID == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return WifiInfo.sanitizeSsid(wifiConfiguration.SSID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see Builder#setUntrusted(boolean) */
|
||||||
|
public boolean isUntrusted() {
|
||||||
|
return isNetworkUntrusted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the WifiEnterpriseConfig, or null if unset.
|
||||||
|
* @see Builder#setWapiEnterpriseConfig(WifiEnterpriseConfig)
|
||||||
|
* @see Builder#setWpa2EnterpriseConfig(WifiEnterpriseConfig)
|
||||||
|
* @see Builder#setWpa3EnterpriseConfig(WifiEnterpriseConfig)
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public WifiEnterpriseConfig getEnterpriseConfig() {
|
||||||
|
return wifiConfiguration.enterpriseConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the passphrase, or null if unset.
|
||||||
|
* @see Builder#setWapiPassphrase(String)
|
||||||
|
* @see Builder#setWpa2Passphrase(String)
|
||||||
|
* @see Builder#setWpa3Passphrase(String)
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public String getPassphrase() {
|
||||||
|
if (wifiConfiguration.preSharedKey == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return WifiInfo.removeDoubleQuotes(wifiConfiguration.preSharedKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user