diff options
| author | 2019-11-25 18:27:49 -0800 | |
|---|---|---|
| committer | 2019-11-25 18:54:24 -0800 | |
| commit | ff488b07097c94b47525fdcdc4f1279286e4858a (patch) | |
| tree | cc46b53ad6aefa50416d3f15914234757679f8fa | |
| parent | 58bea80fd242676a0303de4c9c387be9949ed465 (diff) | |
Promote WifiConfiguration.configKey() to @SystemApi
Bug: 143614759
Test: atest FrameworksWifiApiTests
Change-Id: I08c201add76545d64a75b16375afcb072367c7aa
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 47 |
2 files changed, 14 insertions, 34 deletions
diff --git a/api/current.txt b/api/current.txt index f1c03a4e576d..effc13a78952 100644 --- a/api/current.txt +++ b/api/current.txt @@ -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); diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index dfdc075043f6..e08a11e0b924 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -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. - */ - String mCachedConfigKey; - - /** @hide - * return the string used to calculate the hash in WifiConfigStore - * and uniquely identify this WifiConfiguration + /** + * 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. */ - 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; |