Merge "WifiManager: Update doc for new metered change behavior" into rvc-dev
This commit is contained in:
@@ -1887,12 +1887,20 @@ public class WifiManager {
|
|||||||
* <li> If user reset network settings, all added suggestions will be discarded. Apps can use
|
* <li> If user reset network settings, all added suggestions will be discarded. Apps can use
|
||||||
* {@link #getNetworkSuggestions()} to check if their suggestions are in the device.</li>
|
* {@link #getNetworkSuggestions()} to check if their suggestions are in the device.</li>
|
||||||
* <li> In-place modification of existing suggestions are allowed.
|
* <li> In-place modification of existing suggestions are allowed.
|
||||||
* If the provided suggestions {@link WifiNetworkSuggestion#equals(Object)} any previously
|
* <li>If the provided suggestions includes any previously provided suggestions by the app,
|
||||||
* provided suggestions by the app. Previous suggestions will be updated</li>
|
* previous suggestions will be updated.</li>
|
||||||
|
* <li>If one of the provided suggestions marks a previously unmetered suggestion as metered and
|
||||||
|
* the device is currently connected to that suggested network, then the device will disconnect
|
||||||
|
* from that network. The system will immediately re-evaluate all the network candidates
|
||||||
|
* and possibly reconnect back to the same suggestion. This disconnect is to make sure that any
|
||||||
|
* traffic flowing over unmetered networks isn't accidentally continued over a metered network.
|
||||||
|
* </li>
|
||||||
|
* </li>
|
||||||
*
|
*
|
||||||
* @param networkSuggestions List of network suggestions provided by the app.
|
* @param networkSuggestions List of network suggestions provided by the app.
|
||||||
* @return Status code for the operation. One of the STATUS_NETWORK_SUGGESTIONS_ values.
|
* @return Status code for the operation. One of the STATUS_NETWORK_SUGGESTIONS_ values.
|
||||||
* @throws {@link SecurityException} if the caller is missing required permissions.
|
* @throws {@link SecurityException} if the caller is missing required permissions.
|
||||||
|
* @see WifiNetworkSuggestion#equals(Object)
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE)
|
@RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE)
|
||||||
public @NetworkSuggestionsStatusCode int addNetworkSuggestions(
|
public @NetworkSuggestionsStatusCode int addNetworkSuggestions(
|
||||||
@@ -4152,6 +4160,10 @@ public class WifiManager {
|
|||||||
*
|
*
|
||||||
* This function is used instead of a enableNetwork() and reconnect()
|
* This function is used instead of a enableNetwork() and reconnect()
|
||||||
*
|
*
|
||||||
|
* <li> This API will cause reconnect if the credentials of the current active
|
||||||
|
* connection has been changed.</li>
|
||||||
|
* <li> This API will cause reconnect if the current active connection is marked metered.</li>
|
||||||
|
*
|
||||||
* @param networkId the ID of the network as returned by {@link #addNetwork} or {@link
|
* @param networkId the ID of the network as returned by {@link #addNetwork} or {@link
|
||||||
* getConfiguredNetworks}.
|
* getConfiguredNetworks}.
|
||||||
* @param listener for callbacks on success or failure. Can be null.
|
* @param listener for callbacks on success or failure. Can be null.
|
||||||
@@ -4180,8 +4192,9 @@ public class WifiManager {
|
|||||||
*
|
*
|
||||||
* For an existing network, it accomplishes the task of updateNetwork()
|
* For an existing network, it accomplishes the task of updateNetwork()
|
||||||
*
|
*
|
||||||
* This API will cause reconnect if the crecdentials of the current active
|
* <li> This API will cause reconnect if the credentials of the current active
|
||||||
* connection has been changed.
|
* connection has been changed.</li>
|
||||||
|
* <li> This API will cause disconnect if the current active connection is marked metered.</li>
|
||||||
*
|
*
|
||||||
* @param config the set of variables that describe the configuration,
|
* @param config the set of variables that describe the configuration,
|
||||||
* contained in a {@link WifiConfiguration} object.
|
* contained in a {@link WifiConfiguration} object.
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
|||||||
wifiConfiguration.priority = mPriority;
|
wifiConfiguration.priority = mPriority;
|
||||||
wifiConfiguration.meteredOverride =
|
wifiConfiguration.meteredOverride =
|
||||||
mIsMetered ? WifiConfiguration.METERED_OVERRIDE_METERED
|
mIsMetered ? WifiConfiguration.METERED_OVERRIDE_METERED
|
||||||
: WifiConfiguration.METERED_OVERRIDE_NONE;
|
: WifiConfiguration.METERED_OVERRIDE_NOT_METERED;
|
||||||
wifiConfiguration.carrierId = mCarrierId;
|
wifiConfiguration.carrierId = mCarrierId;
|
||||||
wifiConfiguration.trusted = !mIsNetworkUntrusted;
|
wifiConfiguration.trusted = !mIsNetworkUntrusted;
|
||||||
return wifiConfiguration;
|
return wifiConfiguration;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class WifiNetworkSuggestionTest {
|
|||||||
.get(WifiConfiguration.KeyMgmt.NONE));
|
.get(WifiConfiguration.KeyMgmt.NONE));
|
||||||
assertTrue(suggestion.isAppInteractionRequired);
|
assertTrue(suggestion.isAppInteractionRequired);
|
||||||
assertFalse(suggestion.isUserInteractionRequired);
|
assertFalse(suggestion.isUserInteractionRequired);
|
||||||
assertEquals(WifiConfiguration.METERED_OVERRIDE_NONE,
|
assertEquals(WifiConfiguration.METERED_OVERRIDE_NOT_METERED,
|
||||||
suggestion.wifiConfiguration.meteredOverride);
|
suggestion.wifiConfiguration.meteredOverride);
|
||||||
assertEquals(-1, suggestion.wifiConfiguration.priority);
|
assertEquals(-1, suggestion.wifiConfiguration.priority);
|
||||||
assertFalse(suggestion.isUserAllowedToManuallyConnect);
|
assertFalse(suggestion.isUserAllowedToManuallyConnect);
|
||||||
@@ -86,7 +86,7 @@ public class WifiNetworkSuggestionTest {
|
|||||||
suggestion.wifiConfiguration.preSharedKey);
|
suggestion.wifiConfiguration.preSharedKey);
|
||||||
assertTrue(suggestion.isAppInteractionRequired);
|
assertTrue(suggestion.isAppInteractionRequired);
|
||||||
assertFalse(suggestion.isUserInteractionRequired);
|
assertFalse(suggestion.isUserInteractionRequired);
|
||||||
assertEquals(WifiConfiguration.METERED_OVERRIDE_NONE,
|
assertEquals(WifiConfiguration.METERED_OVERRIDE_NOT_METERED,
|
||||||
suggestion.wifiConfiguration.meteredOverride);
|
suggestion.wifiConfiguration.meteredOverride);
|
||||||
assertEquals(0, suggestion.wifiConfiguration.priority);
|
assertEquals(0, suggestion.wifiConfiguration.priority);
|
||||||
assertFalse(suggestion.isUserAllowedToManuallyConnect);
|
assertFalse(suggestion.isUserAllowedToManuallyConnect);
|
||||||
|
|||||||
Reference in New Issue
Block a user