diff options
| author | 2020-02-11 14:29:05 -0800 | |
|---|---|---|
| committer | 2020-02-11 16:22:27 -0800 | |
| commit | 697e02a3b80c8f3eb897ba5918e3071ef55262a5 (patch) | |
| tree | db39efe5a1e1ccc4dabb807e3dc19d3a9a98baa3 | |
| parent | 488cc7721c820f1444a9a794ff2164383446dfd6 (diff) | |
[Passpoint] Fix connected network not showing in Wi-Fi picker
Newly added network by OSU does not appear in Wi-Fi picker even
when connected.
Root cause: newly added unique identifier included the certs and
key material in the hash, but after the profile is installed,
the certs and keys are moved to keystore and removed from the
configuration, hence the change in hash.
Bug: 149322822
Test: Manual OSU connection and provisioning successfully,
verifying connected network appears in Wi-Fi picker
Test: atest PasspointConfigurationTest
Change-Id: Idec09bc77cb3562bb6bfe9e586a3aa7b2dce85bd
3 files changed, 38 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java index 9f581849efca..7d56585b6b71 100644 --- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java +++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java @@ -909,8 +909,8 @@ public final class PasspointConfiguration implements Parcelable {          }          StringBuilder sb = new StringBuilder(); -        sb.append(String.format("%s_%x%x", mHomeSp.getFqdn(), mHomeSp.hashCode(), -                mCredential.hashCode())); +        sb.append(String.format("%s_%x%x", mHomeSp.getFqdn(), mHomeSp.getUniqueId(), +                mCredential.getUniqueId()));          return sb.toString();      }  } diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java index b037703ca056..99901808ec3e 100644 --- a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java +++ b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java @@ -1020,6 +1020,28 @@ public final class Credential implements Parcelable {                  Arrays.hashCode(mClientCertificateChain));      } +    /** +     * Get a unique identifier for Credential. This identifier depends only on items that remain +     * constant throughout the lifetime of a subscription's credentials. +     * +     * @hide +     * @return a Unique identifier for a Credential object +     */ +    public int getUniqueId() { +        int usedCredential; + +        // Initialize usedCredential based on the credential type of the profile +        if (mUserCredential != null) { +            usedCredential = 0; +        } else if (mCertCredential != null) { +            usedCredential = 1; +        } else { +            usedCredential = 2; +        } + +        return Objects.hash(usedCredential, mRealm); +    } +      @Override      public String toString() {          StringBuilder builder = new StringBuilder(); diff --git a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java index a5de3318f454..224c4bed9d5b 100644 --- a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java +++ b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java @@ -305,6 +305,20 @@ public final class HomeSp implements Parcelable {                  Arrays.hashCode(mRoamingConsortiumOis));      } +    /** +     * Get a unique identifier for HomeSp. This identifier depends only on items that remain +     * constant throughout the lifetime of a subscription. +     * +     * @hide +     * @return a Unique identifier for a HomeSp object +     */ +    public int getUniqueId() { +        return Objects.hash(mFqdn, mFriendlyName, mHomeNetworkIds, Arrays.hashCode(mMatchAllOis), +                Arrays.hashCode(mMatchAnyOis), Arrays.hashCode(mOtherHomePartners), +                Arrays.hashCode(mRoamingConsortiumOis)); +    } + +      @Override      public String toString() {          StringBuilder builder = new StringBuilder();  |