diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/WifiNetworkSuggestion.java | 26 | ||||
| -rw-r--r-- | wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java | 8 |
3 files changed, 18 insertions, 18 deletions
diff --git a/api/current.txt b/api/current.txt index ad5553dd99e2..345ae1425c52 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30654,11 +30654,11 @@ 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 setCredentialSharedWithUser(boolean); 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 setIsUserAllowedToManuallyConnect(boolean); method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired(boolean); method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPasspointConfig(@NonNull android.net.wifi.hotspot2.PasspointConfiguration); method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(@IntRange(from=0) int); diff --git a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java index 9c1475ffc8cd..c0e089090dc9 100644 --- a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java +++ b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java @@ -116,12 +116,12 @@ public final class WifiNetworkSuggestion implements Parcelable { /** * Whether this network is shared credential with user to allow user manually connect. */ - private boolean mIsUserAllowed; + private boolean mIsSharedWithUser; /** - * Whether the setIsUserAllowedToManuallyConnect have been called. + * Whether the setCredentialSharedWithUser have been called. */ - private boolean mIsUserAllowedBeenSet; + private boolean mIsSharedWithUserSet; /** * Pre-shared key for use with WAPI-PSK networks. */ @@ -146,8 +146,8 @@ public final class WifiNetworkSuggestion implements Parcelable { mIsAppInteractionRequired = false; mIsUserInteractionRequired = false; mIsMetered = false; - mIsUserAllowed = true; - mIsUserAllowedBeenSet = false; + mIsSharedWithUser = true; + mIsSharedWithUserSet = false; mPriority = UNASSIGNED_PRIORITY; mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID; mWapiPskPassphrase = null; @@ -430,13 +430,13 @@ public final class WifiNetworkSuggestion implements Parcelable { * <li>If not set, defaults to true (i.e. allow user to manually connect) for secure * networks and false for open networks.</li> * - * @param isAllowed {@code true} to indicate that the credentials may be used by the user to + * @param isShared {@code true} to indicate that the credentials may be used by the user to * manually connect to the network, {@code false} otherwise. * @return Instance of {@link Builder} to enable chaining of the builder method. */ - public @NonNull Builder setIsUserAllowedToManuallyConnect(boolean isAllowed) { - mIsUserAllowed = isAllowed; - mIsUserAllowedBeenSet = true; + public @NonNull Builder setCredentialSharedWithUser(boolean isShared) { + mIsSharedWithUser = isShared; + mIsSharedWithUserSet = true; return this; } @@ -602,11 +602,11 @@ public final class WifiNetworkSuggestion implements Parcelable { } wifiConfiguration = buildWifiConfiguration(); if (wifiConfiguration.isOpenNetwork()) { - if (mIsUserAllowedBeenSet && mIsUserAllowed) { + if (mIsSharedWithUserSet && mIsSharedWithUser) { throw new IllegalStateException("Open network should not be " - + "setIsUserAllowedToManuallyConnect to true"); + + "setCredentialSharedWithUser to true"); } - mIsUserAllowed = false; + mIsSharedWithUser = false; } } @@ -615,7 +615,7 @@ public final class WifiNetworkSuggestion implements Parcelable { mPasspointConfiguration, mIsAppInteractionRequired, mIsUserInteractionRequired, - mIsUserAllowed); + mIsSharedWithUser); } } diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java index 4cdc4bc2ad48..ac915447f3c4 100644 --- a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java +++ b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java @@ -76,7 +76,7 @@ public class WifiNetworkSuggestionTest { .setSsid(TEST_SSID) .setWpa2Passphrase(TEST_PRESHARED_KEY) .setIsAppInteractionRequired(true) - .setIsUserAllowedToManuallyConnect(false) + .setCredentialSharedWithUser(false) .setPriority(0) .build(); @@ -151,7 +151,7 @@ public class WifiNetworkSuggestionTest { WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder() .setSsid(TEST_SSID) .setWpa3Passphrase(TEST_PRESHARED_KEY) - .setIsUserAllowedToManuallyConnect(true) + .setCredentialSharedWithUser(true) .build(); assertEquals("\"" + TEST_SSID + "\"", suggestion.wifiConfiguration.SSID); @@ -709,14 +709,14 @@ public class WifiNetworkSuggestionTest { /** * Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception - * when {@link WifiNetworkSuggestion.Builder#setIsUserAllowedToManuallyConnect(boolean)} to + * when {@link WifiNetworkSuggestion.Builder#setCredentialSharedWithUser(boolean)} to * true on a open network suggestion. */ @Test(expected = IllegalStateException.class) public void testSetIsUserAllowedToManuallyConnectToWithOpenNetwork() { WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder() .setSsid(TEST_SSID) - .setIsUserAllowedToManuallyConnect(true) + .setCredentialSharedWithUser(true) .build(); } } |