Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff488b07 authored by David Su's avatar David Su
Browse files

Promote WifiConfiguration.configKey() to @SystemApi

Bug: 143614759
Test: atest FrameworksWifiApiTests
Change-Id: I08c201add76545d64a75b16375afcb072367c7aa
parent 58bea80f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
+13 −34
Original line number Diff line number Diff line
@@ -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();
    @NonNull
    public String getKey() {
        String key = providerFriendlyName == null
                ? getSsidAndSecurityTypeString()
                : FQDN + KeyMgmt.strings[KeyMgmt.WPA_EAP];
        if (!shared) {
                key += "-" + Integer.toString(UserHandle.getUserId(creatorUid));
            }
            mCachedConfigKey = key;
            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;