Merge changes If970d851,I5bd11574

* changes:
  WifiManager: API upates for O
  WifiConfiguration: Remove priority field
This commit is contained in:
Treehugger Robot
2017-02-08 20:38:12 +00:00
committed by Gerrit Code Review
5 changed files with 54 additions and 38 deletions

View File

@@ -24632,7 +24632,7 @@ package android.net.wifi {
field public boolean isHomeProviderNetwork; field public boolean isHomeProviderNetwork;
field public int networkId; field public int networkId;
field public java.lang.String preSharedKey; field public java.lang.String preSharedKey;
field public int priority; field public deprecated int priority;
field public java.lang.String providerFriendlyName; field public java.lang.String providerFriendlyName;
field public long[] roamingConsortiumIds; field public long[] roamingConsortiumIds;
field public int status; field public int status;
@@ -24788,13 +24788,13 @@ package android.net.wifi {
method public boolean isScanAlwaysAvailable(); method public boolean isScanAlwaysAvailable();
method public boolean isTdlsSupported(); method public boolean isTdlsSupported();
method public boolean isWifiEnabled(); method public boolean isWifiEnabled();
method public boolean pingSupplicant(); method public deprecated boolean pingSupplicant();
method public void queryPasspointIcon(long, java.lang.String); method public void queryPasspointIcon(long, java.lang.String);
method public boolean reassociate(); method public boolean reassociate();
method public boolean reconnect(); method public boolean reconnect();
method public boolean removeNetwork(int); method public boolean removeNetwork(int);
method public boolean removePasspointConfiguration(java.lang.String); method public boolean removePasspointConfiguration(java.lang.String);
method public boolean saveConfiguration(); method public deprecated boolean saveConfiguration();
method public void setTdlsEnabled(java.net.InetAddress, boolean); method public void setTdlsEnabled(java.net.InetAddress, boolean);
method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean); method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
method public boolean setWifiEnabled(boolean); method public boolean setWifiEnabled(boolean);

View File

@@ -26988,7 +26988,7 @@ package android.net.wifi {
field public int numScorerOverride; field public int numScorerOverride;
field public int numScorerOverrideAndSwitchedNetwork; field public int numScorerOverrideAndSwitchedNetwork;
field public java.lang.String preSharedKey; field public java.lang.String preSharedKey;
field public int priority; field public deprecated int priority;
field public java.lang.String providerFriendlyName; field public java.lang.String providerFriendlyName;
field public long[] roamingConsortiumIds; field public long[] roamingConsortiumIds;
field public int status; field public int status;
@@ -27172,13 +27172,13 @@ package android.net.wifi {
method public boolean isWifiApEnabled(); method public boolean isWifiApEnabled();
method public boolean isWifiEnabled(); method public boolean isWifiEnabled();
method public boolean isWifiScannerSupported(); method public boolean isWifiScannerSupported();
method public boolean pingSupplicant(); method public deprecated boolean pingSupplicant();
method public void queryPasspointIcon(long, java.lang.String); method public void queryPasspointIcon(long, java.lang.String);
method public boolean reassociate(); method public boolean reassociate();
method public boolean reconnect(); method public boolean reconnect();
method public boolean removeNetwork(int); method public boolean removeNetwork(int);
method public boolean removePasspointConfiguration(java.lang.String); method public boolean removePasspointConfiguration(java.lang.String);
method public boolean saveConfiguration(); method public deprecated boolean saveConfiguration();
method public void setTdlsEnabled(java.net.InetAddress, boolean); method public void setTdlsEnabled(java.net.InetAddress, boolean);
method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean); method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration); method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);

View File

@@ -24705,7 +24705,7 @@ package android.net.wifi {
field public boolean isHomeProviderNetwork; field public boolean isHomeProviderNetwork;
field public int networkId; field public int networkId;
field public java.lang.String preSharedKey; field public java.lang.String preSharedKey;
field public int priority; field public deprecated int priority;
field public java.lang.String providerFriendlyName; field public java.lang.String providerFriendlyName;
field public long[] roamingConsortiumIds; field public long[] roamingConsortiumIds;
field public int status; field public int status;
@@ -24861,13 +24861,13 @@ package android.net.wifi {
method public boolean isScanAlwaysAvailable(); method public boolean isScanAlwaysAvailable();
method public boolean isTdlsSupported(); method public boolean isTdlsSupported();
method public boolean isWifiEnabled(); method public boolean isWifiEnabled();
method public boolean pingSupplicant(); method public deprecated boolean pingSupplicant();
method public void queryPasspointIcon(long, java.lang.String); method public void queryPasspointIcon(long, java.lang.String);
method public boolean reassociate(); method public boolean reassociate();
method public boolean reconnect(); method public boolean reconnect();
method public boolean removeNetwork(int); method public boolean removeNetwork(int);
method public boolean removePasspointConfiguration(java.lang.String); method public boolean removePasspointConfiguration(java.lang.String);
method public boolean saveConfiguration(); method public deprecated boolean saveConfiguration();
method public void setTdlsEnabled(java.net.InetAddress, boolean); method public void setTdlsEnabled(java.net.InetAddress, boolean);
method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean); method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
method public boolean setWifiEnabled(boolean); method public boolean setWifiEnabled(boolean);

View File

@@ -305,7 +305,9 @@ public class WifiConfiguration implements Parcelable {
/** /**
* Priority determines the preference given to a network by {@code wpa_supplicant} * Priority determines the preference given to a network by {@code wpa_supplicant}
* when choosing an access point with which to associate. * when choosing an access point with which to associate.
* @deprecated Priority is no longer used.
*/ */
@Deprecated
public int priority; public int priority;
/** /**

View File

@@ -838,7 +838,8 @@ public class WifiManager {
} }
/** /**
* Return a list of all the networks configured in the supplicant. * Return a list of all the networks configured for the current foreground
* user.
* Not all fields of WifiConfiguration are returned. Only the following * Not all fields of WifiConfiguration are returned. Only the following
* fields are filled in: * fields are filled in:
* <ul> * <ul>
@@ -1057,8 +1058,12 @@ public class WifiManager {
* Remove the specified network from the list of configured networks. * Remove the specified network from the list of configured networks.
* This may result in the asynchronous delivery of state change * This may result in the asynchronous delivery of state change
* events. * events.
* @param netId the integer that identifies the network configuration *
* to the supplicant * Applications are not allowed to remove networks created by other
* applications.
*
* @param netId the ID of the network as returned by {@link #addNetwork} or {@link
* #getConfiguredNetworks}.
* @return {@code true} if the operation succeeded * @return {@code true} if the operation succeeded
*/ */
public boolean removeNetwork(int netId) { public boolean removeNetwork(int netId) {
@@ -1071,8 +1076,7 @@ public class WifiManager {
/** /**
* Allow a previously configured network to be associated with. If * Allow a previously configured network to be associated with. If
* <code>disableOthers</code> is true, then all other configured * <code>attemptConnect</code> is true, an attempt to connect to the selected
* networks are disabled, and an attempt to connect to the selected
* network is initiated. This may result in the asynchronous delivery * network is initiated. This may result in the asynchronous delivery
* of state change events. * of state change events.
* <p> * <p>
@@ -1089,14 +1093,17 @@ public class WifiManager {
* {@link Network#openConnection(java.net.URL)}, or * {@link Network#openConnection(java.net.URL)}, or
* {@link ConnectivityManager#bindProcessToNetwork} to do so. * {@link ConnectivityManager#bindProcessToNetwork} to do so.
* *
* @param netId the ID of the network in the list of configured networks * Applications are not allowed to enable networks created by other
* @param disableOthers if true, disable all other networks. The way to * applications.
* select a particular network to connect to is specify {@code true} *
* for this parameter. * @param netId the ID of the network as returned by {@link #addNetwork} or {@link
* #getConfiguredNetworks}.
* @param attemptConnect The way to select a particular network to connect to is specify
* {@code true} for this parameter.
* @return {@code true} if the operation succeeded * @return {@code true} if the operation succeeded
*/ */
public boolean enableNetwork(int netId, boolean disableOthers) { public boolean enableNetwork(int netId, boolean attemptConnect) {
final boolean pin = disableOthers && mTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP; final boolean pin = attemptConnect && mTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP;
if (pin) { if (pin) {
NetworkRequest request = new NetworkRequest.Builder() NetworkRequest request = new NetworkRequest.Builder()
.clearCapabilities() .clearCapabilities()
@@ -1107,7 +1114,7 @@ public class WifiManager {
boolean success; boolean success;
try { try {
success = mService.enableNetwork(netId, disableOthers); success = mService.enableNetwork(netId, attemptConnect);
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer();
} }
@@ -1123,7 +1130,12 @@ public class WifiManager {
* Disable a configured network. The specified network will not be * Disable a configured network. The specified network will not be
* a candidate for associating. This may result in the asynchronous * a candidate for associating. This may result in the asynchronous
* delivery of state change events. * delivery of state change events.
* @param netId the ID of the network as returned by {@link #addNetwork}. *
* Applications are not allowed to disable networks created by other
* applications.
*
* @param netId the ID of the network as returned by {@link #addNetwork} or {@link
* #getConfiguredNetworks}.
* @return {@code true} if the operation succeeded * @return {@code true} if the operation succeeded
*/ */
public boolean disableNetwork(int netId) { public boolean disableNetwork(int netId) {
@@ -1182,15 +1194,11 @@ public class WifiManager {
* Check that the supplicant daemon is responding to requests. * Check that the supplicant daemon is responding to requests.
* @return {@code true} if we were able to communicate with the supplicant and * @return {@code true} if we were able to communicate with the supplicant and
* it returned the expected response to the PING message. * it returned the expected response to the PING message.
* @deprecated Will return the output of {@link #isWifiEnabled()} instead.
*/ */
@Deprecated
public boolean pingSupplicant() { public boolean pingSupplicant() {
if (mService == null) return isWifiEnabled();
return false;
try {
return mService.pingSupplicant();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
} }
/** @hide */ /** @hide */
@@ -1509,14 +1517,18 @@ public class WifiManager {
} }
/** /**
* Tell the supplicant to persist the current list of configured networks. * Tell the device to persist the current list of configured networks.
* <p> * <p>
* Note: It is possible for this method to change the network IDs of * Note: It is possible for this method to change the network IDs of
* existing networks. You should assume the network IDs can be different * existing networks. You should assume the network IDs can be different
* after calling this method. * after calling this method.
* *
* @return {@code true} if the operation succeeded * @return {@code true} if the operation succeeded
* @deprecated There is no need to call this method -
* {@link #addNetwork(WifiConfiguration)}, {@link #updateNetwork(WifiConfiguration)}
* and {@link #removeNetwork(int)} already persist the configurations automatically.
*/ */
@Deprecated
public boolean saveConfiguration() { public boolean saveConfiguration() {
try { try {
return mService.saveConfiguration(); return mService.saveConfiguration();
@@ -2095,7 +2107,7 @@ public class WifiManager {
/** /**
* Connect to a network with the given configuration. The network also * Connect to a network with the given configuration. The network also
* gets added to the supplicant configuration. * gets added to the list of configured networks for the foreground user.
* *
* For a new network, this function is used instead of a * For a new network, this function is used instead of a
* sequence of addNetwork(), enableNetwork(), saveConfiguration() and * sequence of addNetwork(), enableNetwork(), saveConfiguration() and
@@ -2124,8 +2136,8 @@ public class WifiManager {
* This function is used instead of a enableNetwork(), saveConfiguration() and * This function is used instead of a enableNetwork(), saveConfiguration() and
* reconnect() * reconnect()
* *
* @param networkId the network id identifiying the network in the * @param networkId the ID of the network as returned by {@link #addNetwork} or {@link
* supplicant configuration list * getConfiguredNetworks}.
* @param listener for callbacks on success or failure. Can be null. * @param listener for callbacks on success or failure. Can be null.
* @throws IllegalStateException if the WifiManager instance needs to be * @throws IllegalStateException if the WifiManager instance needs to be
* initialized again * initialized again
@@ -2137,9 +2149,9 @@ public class WifiManager {
} }
/** /**
* Save the given network in the supplicant config. If the network already * Save the given network to the list of configured networks for the
* exists, the configuration is updated. A new network is enabled * foreground user. If the network already exists, the configuration
* by default. * is updated. Any new network is enabled by default.
* *
* For a new network, this function is used instead of a * For a new network, this function is used instead of a
* sequence of addNetwork(), enableNetwork() and saveConfiguration(). * sequence of addNetwork(), enableNetwork() and saveConfiguration().
@@ -2160,7 +2172,8 @@ public class WifiManager {
} }
/** /**
* Delete the network in the supplicant config. * Delete the network from the list of configured networks for the
* foreground user.
* *
* This function is used instead of a sequence of removeNetwork() * This function is used instead of a sequence of removeNetwork()
* and saveConfiguration(). * and saveConfiguration().
@@ -2851,7 +2864,8 @@ public class WifiManager {
/** /**
* Restore state from the older version of back up data. * Restore state from the older version of back up data.
* The old backup data was essentially a backup of wpa_supplicant.conf & ipconfig.txt file. * The old backup data was essentially a backup of wpa_supplicant.conf
* and ipconfig.txt file.
* @hide * @hide
*/ */
public void restoreSupplicantBackupData(byte[] supplicantData, byte[] ipConfigData) { public void restoreSupplicantBackupData(byte[] supplicantData, byte[] ipConfigData) {