Merge "Promote WifiConfiguration.configKey() to @SystemApi"

This commit is contained in:
David Su
2019-11-27 20:24:34 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 34 deletions

View File

@@ -29889,6 +29889,7 @@ package android.net.wifi {
ctor @Deprecated public WifiConfiguration();
method public int describeContents();
method @Deprecated public android.net.ProxyInfo getHttpProxy();
method @Deprecated @NonNull public String getKey();
method @Deprecated @NonNull public android.net.MacAddress getRandomizedMacAddress();
method @Deprecated public boolean isPasspoint();
method @Deprecated public void setHttpProxy(android.net.ProxyInfo);

View File

@@ -1984,8 +1984,8 @@ public class WifiConfiguration implements Parcelable {
public boolean isLinked(WifiConfiguration config) {
if (config != null) {
if (config.linkedConfigurations != null && linkedConfigurations != null) {
if (config.linkedConfigurations.get(configKey()) != null
&& linkedConfigurations.get(config.configKey()) != null) {
if (config.linkedConfigurations.get(getKey()) != null
&& linkedConfigurations.get(config.getKey()) != null) {
return true;
}
}
@@ -2344,31 +2344,18 @@ public class WifiConfiguration implements Parcelable {
return KeyMgmt.NONE;
}
/* @hide
* Cache the config key, this seems useful as a speed up since a lot of
* lookups in the config store are done and based on this key.
/**
* Return a String that can be used to uniquely identify this WifiConfiguration.
* <br />
* Note: Do not persist this value! This value is not guaranteed to remain backwards compatible.
*/
String mCachedConfigKey;
/** @hide
* return the string used to calculate the hash in WifiConfigStore
* and uniquely identify this WifiConfiguration
*/
public String configKey(boolean allowCached) {
String key;
if (allowCached && mCachedConfigKey != null) {
key = mCachedConfigKey;
} else if (providerFriendlyName != null) {
key = FQDN + KeyMgmt.strings[KeyMgmt.WPA_EAP];
if (!shared) {
key += "-" + Integer.toString(UserHandle.getUserId(creatorUid));
}
} else {
key = getSsidAndSecurityTypeString();
if (!shared) {
key += "-" + Integer.toString(UserHandle.getUserId(creatorUid));
}
mCachedConfigKey = key;
@NonNull
public String getKey() {
String key = providerFriendlyName == null
? getSsidAndSecurityTypeString()
: FQDN + KeyMgmt.strings[KeyMgmt.WPA_EAP];
if (!shared) {
key += "-" + UserHandle.getUserId(creatorUid);
}
return key;
}
@@ -2397,13 +2384,6 @@ public class WifiConfiguration implements Parcelable {
return key;
}
/** @hide
* get configKey, force calculating the config string
*/
public String configKey() {
return configKey(false);
}
/** @hide */
@UnsupportedAppUsage
public IpConfiguration getIpConfiguration() {
@@ -2589,7 +2569,6 @@ public class WifiConfiguration implements Parcelable {
linkedConfigurations = new HashMap<String, Integer>();
linkedConfigurations.putAll(source.linkedConfigurations);
}
mCachedConfigKey = null; //force null configKey
validatedInternetAccess = source.validatedInternetAccess;
isLegacyPasspointConfig = source.isLegacyPasspointConfig;
ephemeral = source.ephemeral;