Merge "Make autojoin consistent"
This commit is contained in:
@@ -31426,7 +31426,7 @@ package android.net.wifi {
|
||||
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 setIsInitialAutoJoinEnabled(boolean);
|
||||
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsInitialAutojoinEnabled(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 setPasspointConfig(@NonNull android.net.wifi.hotspot2.PasspointConfiguration);
|
||||
|
||||
@@ -8046,7 +8046,7 @@ package android.net.wifi.hotspot2 {
|
||||
|
||||
public final class PasspointConfiguration implements android.os.Parcelable {
|
||||
method public int getMeteredOverride();
|
||||
method public boolean isAutoJoinEnabled();
|
||||
method public boolean isAutojoinEnabled();
|
||||
method public boolean isMacRandomizationEnabled();
|
||||
}
|
||||
|
||||
|
||||
@@ -4309,16 +4309,16 @@ public class WifiManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the OEM to enable/disable auto-join globally.
|
||||
* Enable/disable auto-join globally.
|
||||
*
|
||||
* @param choice true to allow autojoin, false to disallow autojoin
|
||||
* @param allowAutojoin true to allow auto-join, false to disallow auto-join
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
|
||||
public void allowAutojoinGlobal(boolean choice) {
|
||||
public void allowAutojoinGlobal(boolean allowAutojoin) {
|
||||
try {
|
||||
mService.allowAutojoinGlobal(choice);
|
||||
mService.allowAutojoinGlobal(allowAutojoin);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -4330,15 +4330,15 @@ public class WifiManager {
|
||||
* The updated choice will be made available through the updated config supplied by the
|
||||
* CONFIGURED_NETWORKS_CHANGED broadcast.
|
||||
*
|
||||
* @param netId the id of the network to allow/disallow autojoin for.
|
||||
* @param choice true to allow autojoin, false to disallow autojoin
|
||||
* @param netId the id of the network to allow/disallow auto-join for.
|
||||
* @param allowAutojoin true to allow auto-join, false to disallow auto-join
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
|
||||
public void allowAutojoin(int netId, boolean choice) {
|
||||
public void allowAutojoin(int netId, boolean allowAutojoin) {
|
||||
try {
|
||||
mService.allowAutojoin(netId, choice);
|
||||
mService.allowAutojoin(netId, allowAutojoin);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -4348,14 +4348,14 @@ public class WifiManager {
|
||||
* Configure auto-join settings for a Passpoint profile.
|
||||
*
|
||||
* @param fqdn the FQDN (fully qualified domain name) of the passpoint profile.
|
||||
* @param enableAutoJoin true to enable autojoin, false to disable autojoin.
|
||||
* @param allowAutojoin true to enable auto-join, false to disable auto-join.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
|
||||
public void allowAutojoinPasspoint(@NonNull String fqdn, boolean enableAutoJoin) {
|
||||
public void allowAutojoinPasspoint(@NonNull String fqdn, boolean allowAutojoin) {
|
||||
try {
|
||||
mService.allowAutojoinPasspoint(fqdn, enableAutoJoin);
|
||||
mService.allowAutojoinPasspoint(fqdn, allowAutojoin);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
/**
|
||||
* Whether this network is initialized with auto-join enabled (the default) or not.
|
||||
*/
|
||||
private boolean mIsInitialAutoJoinEnabled;
|
||||
private boolean mIsInitialAutojoinEnabled;
|
||||
|
||||
/**
|
||||
* Pre-shared key for use with WAPI-PSK networks.
|
||||
@@ -159,7 +159,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
mIsMetered = false;
|
||||
mIsSharedWithUser = true;
|
||||
mIsSharedWithUserSet = false;
|
||||
mIsInitialAutoJoinEnabled = true;
|
||||
mIsInitialAutojoinEnabled = true;
|
||||
mPriority = UNASSIGNED_PRIORITY;
|
||||
mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
|
||||
mWapiPskPassphrase = null;
|
||||
@@ -467,10 +467,10 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
*
|
||||
* @param enabled true for initializing with auto-join enabled (the default), false to
|
||||
* initializing with auto-join disabled.
|
||||
* @return Instance of (@link {@link Builder} to enable chaining of the builder method.
|
||||
* @return Instance of {@link Builder} to enable chaining of the builder method.
|
||||
*/
|
||||
public @NonNull Builder setIsInitialAutoJoinEnabled(boolean enabled) {
|
||||
mIsInitialAutoJoinEnabled = enabled;
|
||||
public @NonNull Builder setIsInitialAutojoinEnabled(boolean enabled) {
|
||||
mIsInitialAutojoinEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -664,10 +664,10 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
mIsSharedWithUser = false;
|
||||
}
|
||||
}
|
||||
if (!mIsSharedWithUser && !mIsInitialAutoJoinEnabled) {
|
||||
if (!mIsSharedWithUser && !mIsInitialAutojoinEnabled) {
|
||||
throw new IllegalStateException("Should have not a network with both "
|
||||
+ "setCredentialSharedWithUser and "
|
||||
+ "setIsAutoJoinEnabled set to false");
|
||||
+ "setIsAutojoinEnabled set to false");
|
||||
}
|
||||
if (mIsNetworkUntrusted) {
|
||||
if (mIsSharedWithUserSet && mIsSharedWithUser) {
|
||||
@@ -683,7 +683,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
mIsAppInteractionRequired,
|
||||
mIsUserInteractionRequired,
|
||||
mIsSharedWithUser,
|
||||
mIsInitialAutoJoinEnabled,
|
||||
mIsInitialAutojoinEnabled,
|
||||
mIsNetworkUntrusted);
|
||||
}
|
||||
}
|
||||
@@ -774,7 +774,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
|
||||
in.readBoolean(), // isAppInteractionRequired
|
||||
in.readBoolean(), // isUserInteractionRequired
|
||||
in.readBoolean(), // isSharedCredentialWithUser
|
||||
in.readBoolean(), // isAutoJoinEnabled
|
||||
in.readBoolean(), // isAutojoinEnabled
|
||||
in.readBoolean()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
* considered for auto-connection. If true then yes, if false then it isn't considered as part
|
||||
* of auto-connection - but can still be manually connected to.
|
||||
*/
|
||||
private boolean mIsAutoJoinEnabled = true;
|
||||
private boolean mIsAutojoinEnabled = true;
|
||||
|
||||
/**
|
||||
* The mac randomization setting specifies whether a randomized or device MAC address will
|
||||
@@ -459,11 +459,11 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
* indicates that only manual connection will work - the framework will not auto-associate to
|
||||
* this Passpoint network.
|
||||
*
|
||||
* @param autoJoinEnabled true to be considered for framework auto-connection, false otherwise.
|
||||
* @param autojoinEnabled true to be considered for framework auto-connection, false otherwise.
|
||||
* @hide
|
||||
*/
|
||||
public void setAutoJoinEnabled(boolean autoJoinEnabled) {
|
||||
mIsAutoJoinEnabled = autoJoinEnabled;
|
||||
public void setAutojoinEnabled(boolean autojoinEnabled) {
|
||||
mIsAutojoinEnabled = autojoinEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -499,8 +499,8 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean isAutoJoinEnabled() {
|
||||
return mIsAutoJoinEnabled;
|
||||
public boolean isAutojoinEnabled() {
|
||||
return mIsAutojoinEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,7 +570,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
mServiceFriendlyNames = source.mServiceFriendlyNames;
|
||||
mAaaServerTrustedNames = source.mAaaServerTrustedNames;
|
||||
mCarrierId = source.mCarrierId;
|
||||
mIsAutoJoinEnabled = source.mIsAutoJoinEnabled;
|
||||
mIsAutojoinEnabled = source.mIsAutojoinEnabled;
|
||||
mIsMacRandomizationEnabled = source.mIsMacRandomizationEnabled;
|
||||
mMeteredOverride = source.mMeteredOverride;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
(HashMap<String, String>) mServiceFriendlyNames);
|
||||
dest.writeBundle(bundle);
|
||||
dest.writeInt(mCarrierId);
|
||||
dest.writeBoolean(mIsAutoJoinEnabled);
|
||||
dest.writeBoolean(mIsAutojoinEnabled);
|
||||
dest.writeBoolean(mIsMacRandomizationEnabled);
|
||||
dest.writeInt(mMeteredOverride);
|
||||
}
|
||||
@@ -635,7 +635,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
&& mUsageLimitDataLimit == that.mUsageLimitDataLimit
|
||||
&& mUsageLimitTimeLimitInMinutes == that.mUsageLimitTimeLimitInMinutes
|
||||
&& mCarrierId == that.mCarrierId
|
||||
&& mIsAutoJoinEnabled == that.mIsAutoJoinEnabled
|
||||
&& mIsAutojoinEnabled == that.mIsAutojoinEnabled
|
||||
&& mIsMacRandomizationEnabled == that.mIsMacRandomizationEnabled
|
||||
&& mMeteredOverride == that.mMeteredOverride
|
||||
&& (mServiceFriendlyNames == null ? that.mServiceFriendlyNames == null
|
||||
@@ -648,7 +648,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
mUpdateIdentifier, mCredentialPriority, mSubscriptionCreationTimeInMillis,
|
||||
mSubscriptionExpirationTimeInMillis, mUsageLimitUsageTimePeriodInMinutes,
|
||||
mUsageLimitStartTimeInMillis, mUsageLimitDataLimit, mUsageLimitTimeLimitInMinutes,
|
||||
mServiceFriendlyNames, mCarrierId, mIsAutoJoinEnabled, mIsMacRandomizationEnabled,
|
||||
mServiceFriendlyNames, mCarrierId, mIsAutojoinEnabled, mIsMacRandomizationEnabled,
|
||||
mMeteredOverride);
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
builder.append("ServiceFriendlyNames: ").append(mServiceFriendlyNames);
|
||||
}
|
||||
builder.append("CarrierId:" + mCarrierId);
|
||||
builder.append("IsAutoJoinEnabled:" + mIsAutoJoinEnabled);
|
||||
builder.append("IsAutojoinEnabled:" + mIsAutojoinEnabled);
|
||||
builder.append("mIsMacRandomizationEnabled:" + mIsMacRandomizationEnabled);
|
||||
builder.append("mMeteredOverride:" + mMeteredOverride);
|
||||
return builder.toString();
|
||||
@@ -811,7 +811,7 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
"serviceFriendlyNames");
|
||||
config.setServiceFriendlyNames(friendlyNamesMap);
|
||||
config.mCarrierId = in.readInt();
|
||||
config.mIsAutoJoinEnabled = in.readBoolean();
|
||||
config.mIsAutojoinEnabled = in.readBoolean();
|
||||
config.mIsMacRandomizationEnabled = in.readBoolean();
|
||||
config.mMeteredOverride = in.readInt();
|
||||
return config;
|
||||
|
||||
@@ -105,7 +105,7 @@ public class WifiNetworkSuggestionTest {
|
||||
.setSsid(TEST_SSID)
|
||||
.setWpa2Passphrase(TEST_PRESHARED_KEY)
|
||||
.setIsUserInteractionRequired(true)
|
||||
.setIsInitialAutoJoinEnabled(false)
|
||||
.setIsInitialAutojoinEnabled(false)
|
||||
.setIsMetered(true)
|
||||
.build();
|
||||
|
||||
@@ -155,7 +155,7 @@ public class WifiNetworkSuggestionTest {
|
||||
.setSsid(TEST_SSID)
|
||||
.setWpa3Passphrase(TEST_PRESHARED_KEY)
|
||||
.setCredentialSharedWithUser(true)
|
||||
.setIsInitialAutoJoinEnabled(false)
|
||||
.setIsInitialAutojoinEnabled(false)
|
||||
.build();
|
||||
|
||||
assertEquals("\"" + TEST_SSID + "\"", suggestion.wifiConfiguration.SSID);
|
||||
@@ -732,20 +732,20 @@ public class WifiNetworkSuggestionTest {
|
||||
|
||||
/**
|
||||
* Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception
|
||||
* when {@link WifiNetworkSuggestion.Builder#setIsInitialAutoJoinEnabled(boolean)} to
|
||||
* when {@link WifiNetworkSuggestion.Builder#setIsInitialAutojoinEnabled(boolean)} to
|
||||
* false on a open network suggestion.
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testSetIsAutoJoinDisabledWithOpenNetwork() {
|
||||
new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(TEST_SSID)
|
||||
.setIsInitialAutoJoinEnabled(false)
|
||||
.setIsInitialAutojoinEnabled(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception
|
||||
* when set both {@link WifiNetworkSuggestion.Builder#setIsInitialAutoJoinEnabled(boolean)}
|
||||
* when set both {@link WifiNetworkSuggestion.Builder#setIsInitialAutojoinEnabled(boolean)}
|
||||
* and {@link WifiNetworkSuggestion.Builder#setCredentialSharedWithUser(boolean)} (boolean)}
|
||||
* to false on a network suggestion.
|
||||
*/
|
||||
@@ -755,7 +755,7 @@ public class WifiNetworkSuggestionTest {
|
||||
.setSsid(TEST_SSID)
|
||||
.setWpa2Passphrase(TEST_PRESHARED_KEY)
|
||||
.setCredentialSharedWithUser(false)
|
||||
.setIsInitialAutoJoinEnabled(false)
|
||||
.setIsInitialAutojoinEnabled(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -808,7 +808,7 @@ public class WifiNetworkSuggestionTest {
|
||||
|
||||
/**
|
||||
* Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception
|
||||
* when set both {@link WifiNetworkSuggestion.Builder#setIsInitialAutoJoinEnabled(boolean)}
|
||||
* when set both {@link WifiNetworkSuggestion.Builder#setIsInitialAutojoinEnabled(boolean)}
|
||||
* and {@link WifiNetworkSuggestion.Builder#setCredentialSharedWithUser(boolean)} (boolean)}
|
||||
* to false on a passpoint suggestion.
|
||||
*/
|
||||
@@ -818,7 +818,7 @@ public class WifiNetworkSuggestionTest {
|
||||
new WifiNetworkSuggestion.Builder()
|
||||
.setPasspointConfig(passpointConfiguration)
|
||||
.setCredentialSharedWithUser(false)
|
||||
.setIsInitialAutoJoinEnabled(false)
|
||||
.setIsInitialAutojoinEnabled(false)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class PasspointConfigurationTest {
|
||||
|
||||
assertFalse(config.validate());
|
||||
assertFalse(config.validateForR2());
|
||||
assertTrue(config.isAutoJoinEnabled());
|
||||
assertTrue(config.isAutojoinEnabled());
|
||||
assertTrue(config.isMacRandomizationEnabled());
|
||||
assertTrue(config.getMeteredOverride() == METERED_OVERRIDE_NONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user