summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-01-19 05:18:56 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-01-19 05:18:56 +0000
commit2c5ca138c7f61b55cea53e028fb14d4c3b6d51a8 (patch)
treea8dff322ae958d5e735b5ff1c07875866182d3f8
parent0a5e31ee3f3006112a0c9f255a2e1a730eaa1503 (diff)
parent8d4ef86d72a6d8e61af2eabd9c5dc399410fd007 (diff)
Merge "set SharedWithUser and IsAutoJoinEnabled both to false is not allowed"
-rw-r--r--wifi/java/android/net/wifi/WifiNetworkSuggestion.java12
-rw-r--r--wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java16
2 files changed, 21 insertions, 7 deletions
diff --git a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
index 2fba5a3f4624..7ecad9ee1031 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
@@ -635,14 +635,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
}
mIsSharedWithUser = false;
}
-
- if (!mIsSharedWithUser && !mIsInitialAutoJoinEnabled) {
- throw new IllegalStateException("Should have not a network with both "
- + "setIsUserAllowedToManuallyConnect and "
- + "setIsAutoJoinEnabled set to false");
- }
}
-
+ if (!mIsSharedWithUser && !mIsInitialAutoJoinEnabled) {
+ throw new IllegalStateException("Should have not a network with both "
+ + "setCredentialSharedWithUser and "
+ + "setIsAutoJoinEnabled set to false");
+ }
return new WifiNetworkSuggestion(
wifiConfiguration,
mPasspointConfiguration,
diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java
index cb1b7747798d..e778b9ad47a3 100644
--- a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java
@@ -758,4 +758,20 @@ public class WifiNetworkSuggestionTest {
.setIsInitialAutoJoinEnabled(false)
.build();
}
+
+ /**
+ * Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception
+ * when set both {@link WifiNetworkSuggestion.Builder#setIsInitialAutoJoinEnabled(boolean)}
+ * and {@link WifiNetworkSuggestion.Builder#setCredentialSharedWithUser(boolean)} (boolean)}
+ * to false on a passpoint suggestion.
+ */
+ @Test(expected = IllegalStateException.class)
+ public void testSetIsAutoJoinDisabledWithSecureNetworkNotSharedWithUserForPasspoint() {
+ PasspointConfiguration passpointConfiguration = PasspointTestUtils.createConfig();
+ new WifiNetworkSuggestion.Builder()
+ .setPasspointConfig(passpointConfiguration)
+ .setCredentialSharedWithUser(false)
+ .setIsInitialAutoJoinEnabled(false)
+ .build();
+ }
}