Merge changes from topics "string_suggestion_notification", "disconnect_blacklist", "api_modify"
* changes: wifi: Fix runtest.sh strings.xml: Modify suggestion notification strings WifiConfiguration: Add a new temp blacklist reason for disconnect WifiManager: Fix javadocs WifiNetworkSpecifier/Suggestion: Address API council comments
This commit is contained in:
@@ -30141,8 +30141,8 @@ package android.net.wifi {
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier build();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssid(@NonNull android.net.MacAddress);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssidPattern(@NonNull android.net.MacAddress, @NonNull android.net.MacAddress);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsid(@NonNull String);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsidPattern(@NonNull android.os.PatternMatcher);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
|
||||
@@ -30161,12 +30161,12 @@ package android.net.wifi {
|
||||
ctor public WifiNetworkSuggestion.Builder();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion build();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setBssid(@NonNull android.net.MacAddress);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired();
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(int);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(@IntRange(from=0) int);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setSsid(@NonNull String);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2Passphrase(@NonNull String);
|
||||
|
||||
@@ -3374,9 +3374,9 @@
|
||||
<string name="wifi_available_action_all_networks">All networks</string>
|
||||
|
||||
<!-- Notification title for a connection to a app suggested wireless network.-->
|
||||
<string name="wifi_suggestion_title">A Wi\u2011Fi network proposed by <xliff:g id="name" example="App123">%s</xliff:g> is available</string>
|
||||
<string name="wifi_suggestion_title">Connect to Wi\u2011Fi networks?</string>
|
||||
<!-- Notification content for a connection to a app suggested wireless network.-->
|
||||
<string name="wifi_suggestion_content">Do you want to connect to networks proposed by <xliff:g id="name" example="App123">%s</xliff:g>?</string>
|
||||
<string name="wifi_suggestion_content">Suggested by <xliff:g id="name" example="App123">%s</xliff:g></string>
|
||||
<!-- Notification action for allowing app specified in the notification body.-->
|
||||
<string name="wifi_suggestion_action_allow_app">Yes</string>
|
||||
<!-- Notification action for disallowing app specified in the notification body.-->
|
||||
|
||||
@@ -1171,39 +1171,49 @@ public class WifiConfiguration implements Parcelable {
|
||||
* This network is disabled because EAP-TLS failure
|
||||
*/
|
||||
public static final int DISABLED_TLS_VERSION_MISMATCH = 8;
|
||||
/**
|
||||
* This network is disabled due to WifiManager.disconnect() call.
|
||||
*/
|
||||
public static final int DISABLED_BY_WIFI_MANAGER_DISCONNECT = 9;
|
||||
|
||||
// Values above are for temporary disablement; values below are for permanent disablement.
|
||||
/**
|
||||
* The starting index for permanent network selection disabled reasons
|
||||
*/
|
||||
public static final int NETWORK_SELECTION_DISABLED_PERMANENT_STARTING_INDEX = 10;
|
||||
/**
|
||||
* This network is disabled due to absence of user credentials
|
||||
*/
|
||||
public static final int DISABLED_AUTHENTICATION_NO_CREDENTIALS = 9;
|
||||
public static final int DISABLED_AUTHENTICATION_NO_CREDENTIALS = 10;
|
||||
/**
|
||||
* This network is permanently disabled because it has no Internet access and user does not
|
||||
* want to stay connected.
|
||||
*/
|
||||
public static final int DISABLED_NO_INTERNET_PERMANENT = 10;
|
||||
public static final int DISABLED_NO_INTERNET_PERMANENT = 11;
|
||||
/**
|
||||
* This network is disabled due to WifiManager disable it explicitly
|
||||
* This network is disabled due to WifiManager.disable() call.
|
||||
*/
|
||||
public static final int DISABLED_BY_WIFI_MANAGER = 11;
|
||||
public static final int DISABLED_BY_WIFI_MANAGER = 12;
|
||||
/**
|
||||
* This network is disabled due to user switching
|
||||
*/
|
||||
public static final int DISABLED_DUE_TO_USER_SWITCH = 12;
|
||||
public static final int DISABLED_DUE_TO_USER_SWITCH = 13;
|
||||
/**
|
||||
* This network is disabled due to wrong password
|
||||
*/
|
||||
public static final int DISABLED_BY_WRONG_PASSWORD = 13;
|
||||
public static final int DISABLED_BY_WRONG_PASSWORD = 14;
|
||||
/**
|
||||
* This network is disabled because service is not subscribed
|
||||
*/
|
||||
public static final int DISABLED_AUTHENTICATION_NO_SUBSCRIPTION = 14;
|
||||
public static final int DISABLED_AUTHENTICATION_NO_SUBSCRIPTION = 15;
|
||||
/**
|
||||
* This Maximum disable reason value
|
||||
*/
|
||||
public static final int NETWORK_SELECTION_DISABLED_MAX = 15;
|
||||
public static final int NETWORK_SELECTION_DISABLED_MAX = 16;
|
||||
|
||||
/**
|
||||
* Quality network selection disable reason String (for debug purpose)
|
||||
* Quality network selection disable reason String (for debug purposes & configuration
|
||||
* storage)
|
||||
*/
|
||||
public static final String[] QUALITY_NETWORK_SELECTION_DISABLE_REASON = {
|
||||
"NETWORK_SELECTION_ENABLE",
|
||||
@@ -1215,6 +1225,7 @@ public class WifiConfiguration implements Parcelable {
|
||||
"NETWORK_SELECTION_DISABLED_NO_INTERNET_TEMPORARY",
|
||||
"NETWORK_SELECTION_DISABLED_WPS_START",
|
||||
"NETWORK_SELECTION_DISABLED_TLS_VERSION",
|
||||
"NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER_DISCONNECT",
|
||||
"NETWORK_SELECTION_DISABLED_AUTHENTICATION_NO_CREDENTIALS",
|
||||
"NETWORK_SELECTION_DISABLED_NO_INTERNET_PERMANENT",
|
||||
"NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER",
|
||||
|
||||
@@ -948,7 +948,8 @@ public class WifiManager {
|
||||
/**
|
||||
* Directed broadcast intent action indicating that the device has connected to one of the
|
||||
* network suggestions provided by the app. This will be sent post connection to a network
|
||||
* which was created with {@link WifiNetworkSuggestion.Builder#setIsAppInteractionRequired()}
|
||||
* which was created with {@link WifiNetworkSuggestion.Builder#setIsAppInteractionRequired(
|
||||
* boolean)}
|
||||
* flag set.
|
||||
* <p>
|
||||
* Note: The broadcast is sent to the app only if it holds
|
||||
|
||||
@@ -183,10 +183,12 @@ public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parc
|
||||
/**
|
||||
* Specifies whether this represents an Enhanced Open (OWE) network.
|
||||
*
|
||||
* @param isEnhancedOpen {@code true} to indicate that the network uses enhanced open,
|
||||
* {@code false} otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsEnhancedOpen() {
|
||||
mIsEnhancedOpen = true;
|
||||
public @NonNull Builder setIsEnhancedOpen(boolean isEnhancedOpen) {
|
||||
mIsEnhancedOpen = isEnhancedOpen;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -261,10 +263,12 @@ public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parc
|
||||
* hidden networks need to be explicitly probed for.</li>
|
||||
* <li>If not set, defaults to false (i.e not a hidden network).</li>
|
||||
*
|
||||
* @param isHiddenSsid {@code true} to indicate that the network is hidden, {@code false}
|
||||
* otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsHiddenSsid() {
|
||||
mIsHiddenSSID = true;
|
||||
public @NonNull Builder setIsHiddenSsid(boolean isHiddenSsid) {
|
||||
mIsHiddenSSID = isHiddenSsid;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.net.wifi;
|
||||
|
||||
import static com.android.internal.util.Preconditions.checkNotNull;
|
||||
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityThread;
|
||||
@@ -159,10 +160,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
/**
|
||||
* Specifies whether this represents an Enhanced Open (OWE) network.
|
||||
*
|
||||
* @param isEnhancedOpen {@code true} to indicate that the network used enhanced open,
|
||||
* {@code false} otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsEnhancedOpen() {
|
||||
mIsEnhancedOpen = true;
|
||||
public @NonNull Builder setIsEnhancedOpen(boolean isEnhancedOpen) {
|
||||
mIsEnhancedOpen = isEnhancedOpen;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -235,10 +238,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
* <p>
|
||||
* <li>If not set, defaults to false (i.e not a hidden network).</li>
|
||||
*
|
||||
* @param isHiddenSsid {@code true} to indicate that the network is hidden, {@code false}
|
||||
* otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsHiddenSsid() {
|
||||
mIsHiddenSSID = true;
|
||||
public @NonNull Builder setIsHiddenSsid(boolean isHiddenSsid) {
|
||||
mIsHiddenSSID = isHiddenSsid;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -253,10 +258,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
* <p>
|
||||
* <li>If not set, defaults to false (i.e no app interaction required).</li>
|
||||
*
|
||||
* @param isAppInteractionRequired {@code true} to indicate that app interaction is
|
||||
* required, {@code false} otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsAppInteractionRequired() {
|
||||
mIsAppInteractionRequired = true;
|
||||
public @NonNull Builder setIsAppInteractionRequired(boolean isAppInteractionRequired) {
|
||||
mIsAppInteractionRequired = isAppInteractionRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -265,10 +272,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
* <p>
|
||||
* <li>If not set, defaults to false (i.e no user interaction required).</li>
|
||||
*
|
||||
* @param isUserInteractionRequired {@code true} to indicate that user interaction is
|
||||
* required, {@code false} otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsUserInteractionRequired() {
|
||||
mIsUserInteractionRequired = true;
|
||||
public @NonNull Builder setIsUserInteractionRequired(boolean isUserInteractionRequired) {
|
||||
mIsUserInteractionRequired = isUserInteractionRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -283,7 +292,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
* @throws IllegalArgumentException if the priority value is negative.
|
||||
*/
|
||||
public @NonNull Builder setPriority(int priority) {
|
||||
public @NonNull Builder setPriority(@IntRange(from = 0) int priority) {
|
||||
if (priority < 0) {
|
||||
throw new IllegalArgumentException("Invalid priority value " + priority);
|
||||
}
|
||||
@@ -296,10 +305,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
* <p>
|
||||
* <li>If not set, defaults to false (i.e not metered).</li>
|
||||
*
|
||||
* @param isMetered {@code true} to indicate that the network is metered, {@code false}
|
||||
* otherwise.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsMetered() {
|
||||
mIsMetered = true;
|
||||
public @NonNull Builder setIsMetered(boolean isMetered) {
|
||||
mIsMetered = isMetered;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ set -x # print commands
|
||||
adb root
|
||||
adb wait-for-device
|
||||
|
||||
adb install -r -g "$OUT/data/app/FrameworksWifiApiTests/FrameworksWifiApiTests.apk"
|
||||
adb install -r -g "$OUT/testcases/FrameworksWifiApiTests/arm64/FrameworksWifiApiTests.apk"
|
||||
|
||||
adb shell am instrument --no-hidden-api-checks -w "$@" \
|
||||
'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'
|
||||
|
||||
@@ -114,7 +114,7 @@ public class WifiNetworkSpecifierTest {
|
||||
.setSsid(TEST_SSID)
|
||||
.setBssid(MacAddress.fromString(TEST_BSSID))
|
||||
.setWpa2EnterpriseConfig(enterpriseConfig)
|
||||
.setIsHiddenSsid()
|
||||
.setIsHiddenSsid(true)
|
||||
.build();
|
||||
|
||||
assertTrue(specifier instanceof WifiNetworkSpecifier);
|
||||
@@ -278,7 +278,7 @@ public class WifiNetworkSpecifierTest {
|
||||
new WifiNetworkSpecifier.Builder()
|
||||
.setBssidPattern(MacAddress.fromString(TEST_BSSID_OUI_BASE_ADDRESS),
|
||||
MacAddress.fromString(TEST_BSSID_OUI_MASK))
|
||||
.setIsHiddenSsid()
|
||||
.setIsHiddenSsid(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ public class WifiNetworkSpecifierTest {
|
||||
public void testWifiNetworkSpecifierBuilderWithSsidMatchPatternForHiddenNetwork() {
|
||||
new WifiNetworkSpecifier.Builder()
|
||||
.setSsidPattern(new PatternMatcher(TEST_SSID, PATTERN_PREFIX))
|
||||
.setIsHiddenSsid()
|
||||
.setIsHiddenSsid(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -341,14 +341,14 @@ public class WifiNetworkSpecifierTest {
|
||||
/**
|
||||
* Ensure {@link WifiNetworkSpecifier.Builder#build()} throws an exception
|
||||
* when both {@link WifiNetworkSpecifier.Builder#setWpa3Passphrase(String)} and
|
||||
* {@link WifiNetworkSpecifier.Builder#setIsEnhancedOpen()} are invoked.
|
||||
* {@link WifiNetworkSpecifier.Builder#setIsEnhancedOpen(boolean)} are invoked.
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testWifiNetworkSpecifierBuilderWithBothWpa3PasphraseAndEnhancedOpen() {
|
||||
new WifiNetworkSpecifier.Builder()
|
||||
.setSsidPattern(new PatternMatcher(TEST_SSID, PATTERN_LITERAL))
|
||||
.setWpa3Passphrase(TEST_PRESHARED_KEY)
|
||||
.setIsEnhancedOpen()
|
||||
.setIsEnhancedOpen(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WifiNetworkSuggestionTest {
|
||||
public void testWifiNetworkSuggestionBuilderForOpenNetworkWithReqAppInteraction() {
|
||||
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setIsAppInteractionRequired()
|
||||
.setIsAppInteractionRequired(true)
|
||||
.build();
|
||||
|
||||
assertEquals(Process.myUid(), suggestion.suggestorUid);
|
||||
@@ -74,7 +74,7 @@ public class WifiNetworkSuggestionTest {
|
||||
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setWpa2Passphrase(TEST_PRESHARED_KEY)
|
||||
.setIsAppInteractionRequired()
|
||||
.setIsAppInteractionRequired(true)
|
||||
.setPriority(0)
|
||||
.build();
|
||||
|
||||
@@ -101,8 +101,8 @@ public class WifiNetworkSuggestionTest {
|
||||
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setWpa2Passphrase(TEST_PRESHARED_KEY)
|
||||
.setIsUserInteractionRequired()
|
||||
.setIsMetered()
|
||||
.setIsUserInteractionRequired(true)
|
||||
.setIsMetered(true)
|
||||
.build();
|
||||
|
||||
assertEquals("\"" + TEST_SSID + "\"", suggestion.wifiConfiguration.SSID);
|
||||
@@ -126,7 +126,7 @@ public class WifiNetworkSuggestionTest {
|
||||
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setBssid(MacAddress.fromString(TEST_BSSID))
|
||||
.setIsEnhancedOpen()
|
||||
.setIsEnhancedOpen(true)
|
||||
.build();
|
||||
|
||||
assertEquals("\"" + TEST_SSID + "\"", suggestion.wifiConfiguration.SSID);
|
||||
@@ -265,7 +265,7 @@ public class WifiNetworkSuggestionTest {
|
||||
public void testWifiNetworkSuggestionBuilderWithInvalidPriority() {
|
||||
new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setPriority(-1)
|
||||
.setPriority(-2)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -301,14 +301,14 @@ public class WifiNetworkSuggestionTest {
|
||||
/**
|
||||
* Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception
|
||||
* when both {@link WifiNetworkSuggestion.Builder#setWpa3Passphrase(String)} and
|
||||
* {@link WifiNetworkSuggestion.Builder#setIsEnhancedOpen()} are invoked.
|
||||
* {@link WifiNetworkSuggestion.Builder#setIsEnhancedOpen(boolean)} are invoked.
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testWifiNetworkSuggestionBuilderWithBothWpa3PasphraseAndEnhancedOpen() {
|
||||
new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setWpa3Passphrase(TEST_PRESHARED_KEY)
|
||||
.setIsEnhancedOpen()
|
||||
.setIsEnhancedOpen(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user