Merge "Cache NetworkScorerAppData in the ScoringServiceConnection."
diff --git a/api/current.txt b/api/current.txt
index 2a33d6e..eac0653 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -25738,6 +25738,7 @@
 
   public class WifiManager {
     method public int addNetwork(android.net.wifi.WifiConfiguration);
+    method public boolean addOrUpdatePasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
     method public static int calculateSignalLevel(int, int);
     method public void cancelWps(android.net.wifi.WifiManager.WpsCallback);
     method public static int compareSignalLevel(int, int);
@@ -25750,6 +25751,7 @@
     method public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
     method public android.net.wifi.WifiInfo getConnectionInfo();
     method public android.net.DhcpInfo getDhcpInfo();
+    method public java.util.List<android.net.wifi.hotspot2.PasspointConfiguration> getPasspointConfigurations();
     method public java.util.List<android.net.wifi.ScanResult> getScanResults();
     method public int getWifiState();
     method public boolean is5GHzBandSupported();
@@ -25765,6 +25767,7 @@
     method public boolean reassociate();
     method public boolean reconnect();
     method public boolean removeNetwork(int);
+    method public boolean removePasspointConfiguration(java.lang.String);
     method public boolean saveConfiguration();
     method public void setTdlsEnabled(java.net.InetAddress, boolean);
     method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
@@ -25979,6 +25982,241 @@
 
 }
 
+package android.net.wifi.hotspot2 {
+
+  public final class ConfigParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parsePasspointConfig(java.lang.String, byte[]);
+  }
+
+  public final class PasspointConfiguration implements android.os.Parcelable {
+    ctor public PasspointConfiguration();
+    ctor public PasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
+    method public int describeContents();
+    method public android.net.wifi.hotspot2.pps.Credential getCredential();
+    method public int getCredentialPriority();
+    method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
+    method public android.net.wifi.hotspot2.pps.Policy getPolicy();
+    method public long getSubscriptionCreationTimeInMs();
+    method public long getSubscriptionExpirationTimeInMs();
+    method public java.lang.String getSubscriptionType();
+    method public android.net.wifi.hotspot2.pps.UpdateParameter getSubscriptionUpdate();
+    method public java.util.Map<java.lang.String, byte[]> getTrustRootCertList();
+    method public int getUpdateIdentififer();
+    method public long getUsageLimitDataLimit();
+    method public long getUsageLimitStartTimeInMs();
+    method public long getUsageLimitTimeLimitInMinutes();
+    method public long getUsageLimitUsageTimePeriodInMinutes();
+    method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
+    method public void setCredentialPriority(int);
+    method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public void setPolicy(android.net.wifi.hotspot2.pps.Policy);
+    method public void setSubscriptionCreationTimeInMs(long);
+    method public void setSubscriptionExpirationTimeInMs(long);
+    method public void setSubscriptionType(java.lang.String);
+    method public void setSubscriptionUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public void setTrustRootCertList(java.util.Map<java.lang.String, byte[]>);
+    method public void setUpdateIdentifier(int);
+    method public void setUsageLimitDataLimit(long);
+    method public void setUsageLimitStartTimeInMs(long);
+    method public void setUsageLimitTimeLimitInMinutes(long);
+    method public void setUsageLimitUsageTimePeriodInMinutes(long);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.PasspointConfiguration> CREATOR;
+  }
+
+}
+
+package android.net.wifi.hotspot2.omadm {
+
+  public final class PpsMoParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parseMoText(java.lang.String);
+  }
+
+}
+
+package android.net.wifi.hotspot2.pps {
+
+  public final class Credential implements android.os.Parcelable {
+    ctor public Credential();
+    ctor public Credential(android.net.wifi.hotspot2.pps.Credential);
+    method public int describeContents();
+    method public java.security.cert.X509Certificate getCaCertificate();
+    method public android.net.wifi.hotspot2.pps.Credential.CertificateCredential getCertCredential();
+    method public boolean getCheckAaaServerStatus();
+    method public java.security.cert.X509Certificate[] getClientCertificateChain();
+    method public java.security.PrivateKey getClientPrivateKey();
+    method public long getCreationTimeInMs();
+    method public long getExpirationTimeInMs();
+    method public java.lang.String getRealm();
+    method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
+    method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
+    method public void setCaCertificate(java.security.cert.X509Certificate);
+    method public void setCertCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public void setCheckAaaServerCertStatus(boolean);
+    method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
+    method public void setClientPrivateKey(java.security.PrivateKey);
+    method public void setCreationTimeInMs(long);
+    method public void setExpirationTimeInMs(long);
+    method public void setRealm(java.lang.String);
+    method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential> CREATOR;
+  }
+
+  public static final class Credential.CertificateCredential implements android.os.Parcelable {
+    ctor public Credential.CertificateCredential();
+    ctor public Credential.CertificateCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public int describeContents();
+    method public byte[] getCertSha256Fingerprint();
+    method public java.lang.String getCertType();
+    method public void setCertSha256Fingerprint(byte[]);
+    method public void setCertType(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.CertificateCredential> CREATOR;
+  }
+
+  public static final class Credential.SimCredential implements android.os.Parcelable {
+    ctor public Credential.SimCredential();
+    ctor public Credential.SimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public int describeContents();
+    method public int getEapType();
+    method public java.lang.String getImsi();
+    method public void setEapType(int);
+    method public void setImsi(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.SimCredential> CREATOR;
+  }
+
+  public static final class Credential.UserCredential implements android.os.Parcelable {
+    ctor public Credential.UserCredential();
+    ctor public Credential.UserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public int describeContents();
+    method public boolean getAbleToShare();
+    method public int getEapType();
+    method public boolean getMachineManaged();
+    method public java.lang.String getNonEapInnerMethod();
+    method public java.lang.String getPassword();
+    method public java.lang.String getSoftTokenApp();
+    method public java.lang.String getUsername();
+    method public void setAbleToShare(boolean);
+    method public void setEapType(int);
+    method public void setMachineManaged(boolean);
+    method public void setNonEapInnerMethod(java.lang.String);
+    method public void setPassword(java.lang.String);
+    method public void setSoftTokenApp(java.lang.String);
+    method public void setUsername(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.UserCredential> CREATOR;
+  }
+
+  public final class HomeSp implements android.os.Parcelable {
+    ctor public HomeSp();
+    ctor public HomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public int describeContents();
+    method public java.lang.String getFqdn();
+    method public java.lang.String getFriendlyName();
+    method public java.util.Map<java.lang.String, java.lang.Long> getHomeNetworkIds();
+    method public java.lang.String getIconUrl();
+    method public long[] getMatchAllOis();
+    method public long[] getMatchAnysOis();
+    method public java.lang.String[] getOtherHomePartners();
+    method public long[] getRoamingConsortiumOis();
+    method public void setFqdn(java.lang.String);
+    method public void setFriendlyName(java.lang.String);
+    method public void setHomeNetworkIds(java.util.Map<java.lang.String, java.lang.Long>);
+    method public void setIconUrl(java.lang.String);
+    method public void setMatchAllOis(long[]);
+    method public void setMatchAnyOis(long[]);
+    method public void setOtherHomePartners(java.lang.String[]);
+    method public void setRoamingConsortiumOis(long[]);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.HomeSp> CREATOR;
+  }
+
+  public final class Policy implements android.os.Parcelable {
+    ctor public Policy();
+    ctor public Policy(android.net.wifi.hotspot2.pps.Policy);
+    method public int describeContents();
+    method public java.lang.String[] getExcludedSsidList();
+    method public int getMaximumBssLoadValue();
+    method public long getMinHomeDownlinkBandWidht();
+    method public long getMinHomeUplinkBandwidth();
+    method public long getMinRoamingDownlinkBandwidth();
+    method public long getMinRoamingUplinkBandwidth();
+    method public android.net.wifi.hotspot2.pps.UpdateParameter getPolicyUpdate();
+    method public java.util.List<android.net.wifi.hotspot2.pps.Policy.RoamingPartner> getPreferredRoamingPartnerList();
+    method public java.util.Map<java.lang.Integer, java.lang.String> getRequiredProtoPortMap();
+    method public void setExcludedSsidList(java.lang.String[]);
+    method public void setMaximumBssLoadValue(int);
+    method public void setMinHomeDownlinkBandwidth(long);
+    method public void setMinHomeUplinkBandwidth(long);
+    method public void setMinRoamingDownlinkBandwidth(long);
+    method public void setMinRoamingUplinkBandwidth(long);
+    method public void setPolicyUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public void setPreferredRoamingPartnerList(java.util.List<android.net.wifi.hotspot2.pps.Policy.RoamingPartner>);
+    method public void setRequiredProtoPortMap(java.util.Map<java.lang.Integer, java.lang.String>);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Policy> CREATOR;
+  }
+
+  public static final class Policy.RoamingPartner implements android.os.Parcelable {
+    ctor public Policy.RoamingPartner();
+    ctor public Policy.RoamingPartner(android.net.wifi.hotspot2.pps.Policy.RoamingPartner);
+    method public int describeContents();
+    method public java.lang.String getCountries();
+    method public java.lang.String getFqdn();
+    method public boolean getFqdnExactMatch();
+    method public int getPriority();
+    method public void setCountries(java.lang.String);
+    method public void setFqdn(java.lang.String);
+    method public void setFqdnExactMatch(boolean);
+    method public void setPriority(int);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Policy.RoamingPartner> CREATOR;
+  }
+
+  public final class UpdateParameter implements android.os.Parcelable {
+    ctor public UpdateParameter();
+    ctor public UpdateParameter(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public int describeContents();
+    method public java.lang.String getBase64EncodedPassword();
+    method public java.lang.String getRestriction();
+    method public java.lang.String getServerUri();
+    method public byte[] getTrustRootCertSha256Fingerprint();
+    method public java.lang.String getTrustRootCertUrl();
+    method public long getUpdateIntervalInMinutes();
+    method public java.lang.String getUpdateMethod();
+    method public java.lang.String getUsername();
+    method public void setBase64EncodedPassword(java.lang.String);
+    method public void setRestriction(java.lang.String);
+    method public void setServerUri(java.lang.String);
+    method public void setTrustRootCertSha256Fingerprint(byte[]);
+    method public void setTrustRootCertUrl(java.lang.String);
+    method public void setUpdateIntervalInMinutes(long);
+    method public void setUpdateMethod(java.lang.String);
+    method public void setUsername(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.UpdateParameter> CREATOR;
+    field public static final long UPDATE_CHECK_INTERVAL_NEVER = 4294967295L; // 0xffffffffL
+    field public static final java.lang.String UPDATE_METHOD_OMADM = "OMA-DM-ClientInitiated";
+    field public static final java.lang.String UPDATE_METHOD_SSP = "SSP-ClientInitiated";
+    field public static final java.lang.String UPDATE_RESTRICTION_HOMESP = "HomeSP";
+    field public static final java.lang.String UPDATE_RESTRICTION_ROAMING_PARTNER = "RoamingPartner";
+    field public static final java.lang.String UPDATE_RESTRICTION_UNRESTRICTED = "Unrestricted";
+  }
+
+}
+
 package android.net.wifi.p2p {
 
   public class WifiP2pConfig implements android.os.Parcelable {
diff --git a/api/system-current.txt b/api/system-current.txt
index e2502b6..3b2ad3f 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -28254,6 +28254,7 @@
 
   public class WifiManager {
     method public int addNetwork(android.net.wifi.WifiConfiguration);
+    method public boolean addOrUpdatePasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
     method public static int calculateSignalLevel(int, int);
     method public void cancelWps(android.net.wifi.WifiManager.WpsCallback);
     method public static int compareSignalLevel(int, int);
@@ -28269,6 +28270,7 @@
     method public android.net.wifi.WifiInfo getConnectionInfo();
     method public android.net.wifi.WifiConnectionStatistics getConnectionStatistics();
     method public android.net.DhcpInfo getDhcpInfo();
+    method public java.util.List<android.net.wifi.hotspot2.PasspointConfiguration> getPasspointConfigurations();
     method public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
     method public java.util.List<android.net.wifi.ScanResult> getScanResults();
     method public android.net.wifi.WifiConfiguration getWifiApConfiguration();
@@ -28292,6 +28294,7 @@
     method public boolean reassociate();
     method public boolean reconnect();
     method public boolean removeNetwork(int);
+    method public boolean removePasspointConfiguration(java.lang.String);
     method public boolean saveConfiguration();
     method public void setTdlsEnabled(java.net.InetAddress, boolean);
     method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
@@ -28675,6 +28678,241 @@
 
 }
 
+package android.net.wifi.hotspot2 {
+
+  public final class ConfigParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parsePasspointConfig(java.lang.String, byte[]);
+  }
+
+  public final class PasspointConfiguration implements android.os.Parcelable {
+    ctor public PasspointConfiguration();
+    ctor public PasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
+    method public int describeContents();
+    method public android.net.wifi.hotspot2.pps.Credential getCredential();
+    method public int getCredentialPriority();
+    method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
+    method public android.net.wifi.hotspot2.pps.Policy getPolicy();
+    method public long getSubscriptionCreationTimeInMs();
+    method public long getSubscriptionExpirationTimeInMs();
+    method public java.lang.String getSubscriptionType();
+    method public android.net.wifi.hotspot2.pps.UpdateParameter getSubscriptionUpdate();
+    method public java.util.Map<java.lang.String, byte[]> getTrustRootCertList();
+    method public int getUpdateIdentififer();
+    method public long getUsageLimitDataLimit();
+    method public long getUsageLimitStartTimeInMs();
+    method public long getUsageLimitTimeLimitInMinutes();
+    method public long getUsageLimitUsageTimePeriodInMinutes();
+    method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
+    method public void setCredentialPriority(int);
+    method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public void setPolicy(android.net.wifi.hotspot2.pps.Policy);
+    method public void setSubscriptionCreationTimeInMs(long);
+    method public void setSubscriptionExpirationTimeInMs(long);
+    method public void setSubscriptionType(java.lang.String);
+    method public void setSubscriptionUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public void setTrustRootCertList(java.util.Map<java.lang.String, byte[]>);
+    method public void setUpdateIdentifier(int);
+    method public void setUsageLimitDataLimit(long);
+    method public void setUsageLimitStartTimeInMs(long);
+    method public void setUsageLimitTimeLimitInMinutes(long);
+    method public void setUsageLimitUsageTimePeriodInMinutes(long);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.PasspointConfiguration> CREATOR;
+  }
+
+}
+
+package android.net.wifi.hotspot2.omadm {
+
+  public final class PpsMoParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parseMoText(java.lang.String);
+  }
+
+}
+
+package android.net.wifi.hotspot2.pps {
+
+  public final class Credential implements android.os.Parcelable {
+    ctor public Credential();
+    ctor public Credential(android.net.wifi.hotspot2.pps.Credential);
+    method public int describeContents();
+    method public java.security.cert.X509Certificate getCaCertificate();
+    method public android.net.wifi.hotspot2.pps.Credential.CertificateCredential getCertCredential();
+    method public boolean getCheckAaaServerStatus();
+    method public java.security.cert.X509Certificate[] getClientCertificateChain();
+    method public java.security.PrivateKey getClientPrivateKey();
+    method public long getCreationTimeInMs();
+    method public long getExpirationTimeInMs();
+    method public java.lang.String getRealm();
+    method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
+    method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
+    method public void setCaCertificate(java.security.cert.X509Certificate);
+    method public void setCertCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public void setCheckAaaServerCertStatus(boolean);
+    method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
+    method public void setClientPrivateKey(java.security.PrivateKey);
+    method public void setCreationTimeInMs(long);
+    method public void setExpirationTimeInMs(long);
+    method public void setRealm(java.lang.String);
+    method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential> CREATOR;
+  }
+
+  public static final class Credential.CertificateCredential implements android.os.Parcelable {
+    ctor public Credential.CertificateCredential();
+    ctor public Credential.CertificateCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public int describeContents();
+    method public byte[] getCertSha256Fingerprint();
+    method public java.lang.String getCertType();
+    method public void setCertSha256Fingerprint(byte[]);
+    method public void setCertType(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.CertificateCredential> CREATOR;
+  }
+
+  public static final class Credential.SimCredential implements android.os.Parcelable {
+    ctor public Credential.SimCredential();
+    ctor public Credential.SimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public int describeContents();
+    method public int getEapType();
+    method public java.lang.String getImsi();
+    method public void setEapType(int);
+    method public void setImsi(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.SimCredential> CREATOR;
+  }
+
+  public static final class Credential.UserCredential implements android.os.Parcelable {
+    ctor public Credential.UserCredential();
+    ctor public Credential.UserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public int describeContents();
+    method public boolean getAbleToShare();
+    method public int getEapType();
+    method public boolean getMachineManaged();
+    method public java.lang.String getNonEapInnerMethod();
+    method public java.lang.String getPassword();
+    method public java.lang.String getSoftTokenApp();
+    method public java.lang.String getUsername();
+    method public void setAbleToShare(boolean);
+    method public void setEapType(int);
+    method public void setMachineManaged(boolean);
+    method public void setNonEapInnerMethod(java.lang.String);
+    method public void setPassword(java.lang.String);
+    method public void setSoftTokenApp(java.lang.String);
+    method public void setUsername(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.UserCredential> CREATOR;
+  }
+
+  public final class HomeSp implements android.os.Parcelable {
+    ctor public HomeSp();
+    ctor public HomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public int describeContents();
+    method public java.lang.String getFqdn();
+    method public java.lang.String getFriendlyName();
+    method public java.util.Map<java.lang.String, java.lang.Long> getHomeNetworkIds();
+    method public java.lang.String getIconUrl();
+    method public long[] getMatchAllOis();
+    method public long[] getMatchAnysOis();
+    method public java.lang.String[] getOtherHomePartners();
+    method public long[] getRoamingConsortiumOis();
+    method public void setFqdn(java.lang.String);
+    method public void setFriendlyName(java.lang.String);
+    method public void setHomeNetworkIds(java.util.Map<java.lang.String, java.lang.Long>);
+    method public void setIconUrl(java.lang.String);
+    method public void setMatchAllOis(long[]);
+    method public void setMatchAnyOis(long[]);
+    method public void setOtherHomePartners(java.lang.String[]);
+    method public void setRoamingConsortiumOis(long[]);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.HomeSp> CREATOR;
+  }
+
+  public final class Policy implements android.os.Parcelable {
+    ctor public Policy();
+    ctor public Policy(android.net.wifi.hotspot2.pps.Policy);
+    method public int describeContents();
+    method public java.lang.String[] getExcludedSsidList();
+    method public int getMaximumBssLoadValue();
+    method public long getMinHomeDownlinkBandWidht();
+    method public long getMinHomeUplinkBandwidth();
+    method public long getMinRoamingDownlinkBandwidth();
+    method public long getMinRoamingUplinkBandwidth();
+    method public android.net.wifi.hotspot2.pps.UpdateParameter getPolicyUpdate();
+    method public java.util.List<android.net.wifi.hotspot2.pps.Policy.RoamingPartner> getPreferredRoamingPartnerList();
+    method public java.util.Map<java.lang.Integer, java.lang.String> getRequiredProtoPortMap();
+    method public void setExcludedSsidList(java.lang.String[]);
+    method public void setMaximumBssLoadValue(int);
+    method public void setMinHomeDownlinkBandwidth(long);
+    method public void setMinHomeUplinkBandwidth(long);
+    method public void setMinRoamingDownlinkBandwidth(long);
+    method public void setMinRoamingUplinkBandwidth(long);
+    method public void setPolicyUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public void setPreferredRoamingPartnerList(java.util.List<android.net.wifi.hotspot2.pps.Policy.RoamingPartner>);
+    method public void setRequiredProtoPortMap(java.util.Map<java.lang.Integer, java.lang.String>);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Policy> CREATOR;
+  }
+
+  public static final class Policy.RoamingPartner implements android.os.Parcelable {
+    ctor public Policy.RoamingPartner();
+    ctor public Policy.RoamingPartner(android.net.wifi.hotspot2.pps.Policy.RoamingPartner);
+    method public int describeContents();
+    method public java.lang.String getCountries();
+    method public java.lang.String getFqdn();
+    method public boolean getFqdnExactMatch();
+    method public int getPriority();
+    method public void setCountries(java.lang.String);
+    method public void setFqdn(java.lang.String);
+    method public void setFqdnExactMatch(boolean);
+    method public void setPriority(int);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Policy.RoamingPartner> CREATOR;
+  }
+
+  public final class UpdateParameter implements android.os.Parcelable {
+    ctor public UpdateParameter();
+    ctor public UpdateParameter(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public int describeContents();
+    method public java.lang.String getBase64EncodedPassword();
+    method public java.lang.String getRestriction();
+    method public java.lang.String getServerUri();
+    method public byte[] getTrustRootCertSha256Fingerprint();
+    method public java.lang.String getTrustRootCertUrl();
+    method public long getUpdateIntervalInMinutes();
+    method public java.lang.String getUpdateMethod();
+    method public java.lang.String getUsername();
+    method public void setBase64EncodedPassword(java.lang.String);
+    method public void setRestriction(java.lang.String);
+    method public void setServerUri(java.lang.String);
+    method public void setTrustRootCertSha256Fingerprint(byte[]);
+    method public void setTrustRootCertUrl(java.lang.String);
+    method public void setUpdateIntervalInMinutes(long);
+    method public void setUpdateMethod(java.lang.String);
+    method public void setUsername(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.UpdateParameter> CREATOR;
+    field public static final long UPDATE_CHECK_INTERVAL_NEVER = 4294967295L; // 0xffffffffL
+    field public static final java.lang.String UPDATE_METHOD_OMADM = "OMA-DM-ClientInitiated";
+    field public static final java.lang.String UPDATE_METHOD_SSP = "SSP-ClientInitiated";
+    field public static final java.lang.String UPDATE_RESTRICTION_HOMESP = "HomeSP";
+    field public static final java.lang.String UPDATE_RESTRICTION_ROAMING_PARTNER = "RoamingPartner";
+    field public static final java.lang.String UPDATE_RESTRICTION_UNRESTRICTED = "Unrestricted";
+  }
+
+}
+
 package android.net.wifi.p2p {
 
   public class WifiP2pConfig implements android.os.Parcelable {
@@ -42380,11 +42618,6 @@
     field public static final int PHONE_TYPE_GSM = 1; // 0x1
     field public static final int PHONE_TYPE_NONE = 0; // 0x0
     field public static final int PHONE_TYPE_SIP = 3; // 0x3
-    field public static final int SIM_ACTIVATION_RESULT_CANCELED = 4; // 0x4
-    field public static final int SIM_ACTIVATION_RESULT_COMPLETE = 0; // 0x0
-    field public static final int SIM_ACTIVATION_RESULT_FAILED = 3; // 0x3
-    field public static final int SIM_ACTIVATION_RESULT_IN_PROGRESS = 2; // 0x2
-    field public static final int SIM_ACTIVATION_RESULT_NOT_SUPPORTED = 1; // 0x1
     field public static final int SIM_STATE_ABSENT = 1; // 0x1
     field public static final int SIM_STATE_CARD_IO_ERROR = 8; // 0x8
     field public static final int SIM_STATE_CARD_RESTRICTED = 9; // 0x9
diff --git a/api/test-current.txt b/api/test-current.txt
index 151ccbf..bfb0d14 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -25830,6 +25830,7 @@
 
   public class WifiManager {
     method public int addNetwork(android.net.wifi.WifiConfiguration);
+    method public boolean addOrUpdatePasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
     method public static int calculateSignalLevel(int, int);
     method public void cancelWps(android.net.wifi.WifiManager.WpsCallback);
     method public static int compareSignalLevel(int, int);
@@ -25842,6 +25843,7 @@
     method public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
     method public android.net.wifi.WifiInfo getConnectionInfo();
     method public android.net.DhcpInfo getDhcpInfo();
+    method public java.util.List<android.net.wifi.hotspot2.PasspointConfiguration> getPasspointConfigurations();
     method public java.util.List<android.net.wifi.ScanResult> getScanResults();
     method public int getWifiState();
     method public boolean is5GHzBandSupported();
@@ -25857,6 +25859,7 @@
     method public boolean reassociate();
     method public boolean reconnect();
     method public boolean removeNetwork(int);
+    method public boolean removePasspointConfiguration(java.lang.String);
     method public boolean saveConfiguration();
     method public void setTdlsEnabled(java.net.InetAddress, boolean);
     method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
@@ -26071,6 +26074,241 @@
 
 }
 
+package android.net.wifi.hotspot2 {
+
+  public final class ConfigParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parsePasspointConfig(java.lang.String, byte[]);
+  }
+
+  public final class PasspointConfiguration implements android.os.Parcelable {
+    ctor public PasspointConfiguration();
+    ctor public PasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
+    method public int describeContents();
+    method public android.net.wifi.hotspot2.pps.Credential getCredential();
+    method public int getCredentialPriority();
+    method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
+    method public android.net.wifi.hotspot2.pps.Policy getPolicy();
+    method public long getSubscriptionCreationTimeInMs();
+    method public long getSubscriptionExpirationTimeInMs();
+    method public java.lang.String getSubscriptionType();
+    method public android.net.wifi.hotspot2.pps.UpdateParameter getSubscriptionUpdate();
+    method public java.util.Map<java.lang.String, byte[]> getTrustRootCertList();
+    method public int getUpdateIdentififer();
+    method public long getUsageLimitDataLimit();
+    method public long getUsageLimitStartTimeInMs();
+    method public long getUsageLimitTimeLimitInMinutes();
+    method public long getUsageLimitUsageTimePeriodInMinutes();
+    method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
+    method public void setCredentialPriority(int);
+    method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public void setPolicy(android.net.wifi.hotspot2.pps.Policy);
+    method public void setSubscriptionCreationTimeInMs(long);
+    method public void setSubscriptionExpirationTimeInMs(long);
+    method public void setSubscriptionType(java.lang.String);
+    method public void setSubscriptionUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public void setTrustRootCertList(java.util.Map<java.lang.String, byte[]>);
+    method public void setUpdateIdentifier(int);
+    method public void setUsageLimitDataLimit(long);
+    method public void setUsageLimitStartTimeInMs(long);
+    method public void setUsageLimitTimeLimitInMinutes(long);
+    method public void setUsageLimitUsageTimePeriodInMinutes(long);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.PasspointConfiguration> CREATOR;
+  }
+
+}
+
+package android.net.wifi.hotspot2.omadm {
+
+  public final class PpsMoParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parseMoText(java.lang.String);
+  }
+
+}
+
+package android.net.wifi.hotspot2.pps {
+
+  public final class Credential implements android.os.Parcelable {
+    ctor public Credential();
+    ctor public Credential(android.net.wifi.hotspot2.pps.Credential);
+    method public int describeContents();
+    method public java.security.cert.X509Certificate getCaCertificate();
+    method public android.net.wifi.hotspot2.pps.Credential.CertificateCredential getCertCredential();
+    method public boolean getCheckAaaServerStatus();
+    method public java.security.cert.X509Certificate[] getClientCertificateChain();
+    method public java.security.PrivateKey getClientPrivateKey();
+    method public long getCreationTimeInMs();
+    method public long getExpirationTimeInMs();
+    method public java.lang.String getRealm();
+    method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
+    method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
+    method public void setCaCertificate(java.security.cert.X509Certificate);
+    method public void setCertCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public void setCheckAaaServerCertStatus(boolean);
+    method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
+    method public void setClientPrivateKey(java.security.PrivateKey);
+    method public void setCreationTimeInMs(long);
+    method public void setExpirationTimeInMs(long);
+    method public void setRealm(java.lang.String);
+    method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential> CREATOR;
+  }
+
+  public static final class Credential.CertificateCredential implements android.os.Parcelable {
+    ctor public Credential.CertificateCredential();
+    ctor public Credential.CertificateCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public int describeContents();
+    method public byte[] getCertSha256Fingerprint();
+    method public java.lang.String getCertType();
+    method public void setCertSha256Fingerprint(byte[]);
+    method public void setCertType(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.CertificateCredential> CREATOR;
+  }
+
+  public static final class Credential.SimCredential implements android.os.Parcelable {
+    ctor public Credential.SimCredential();
+    ctor public Credential.SimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public int describeContents();
+    method public int getEapType();
+    method public java.lang.String getImsi();
+    method public void setEapType(int);
+    method public void setImsi(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.SimCredential> CREATOR;
+  }
+
+  public static final class Credential.UserCredential implements android.os.Parcelable {
+    ctor public Credential.UserCredential();
+    ctor public Credential.UserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public int describeContents();
+    method public boolean getAbleToShare();
+    method public int getEapType();
+    method public boolean getMachineManaged();
+    method public java.lang.String getNonEapInnerMethod();
+    method public java.lang.String getPassword();
+    method public java.lang.String getSoftTokenApp();
+    method public java.lang.String getUsername();
+    method public void setAbleToShare(boolean);
+    method public void setEapType(int);
+    method public void setMachineManaged(boolean);
+    method public void setNonEapInnerMethod(java.lang.String);
+    method public void setPassword(java.lang.String);
+    method public void setSoftTokenApp(java.lang.String);
+    method public void setUsername(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.UserCredential> CREATOR;
+  }
+
+  public final class HomeSp implements android.os.Parcelable {
+    ctor public HomeSp();
+    ctor public HomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public int describeContents();
+    method public java.lang.String getFqdn();
+    method public java.lang.String getFriendlyName();
+    method public java.util.Map<java.lang.String, java.lang.Long> getHomeNetworkIds();
+    method public java.lang.String getIconUrl();
+    method public long[] getMatchAllOis();
+    method public long[] getMatchAnysOis();
+    method public java.lang.String[] getOtherHomePartners();
+    method public long[] getRoamingConsortiumOis();
+    method public void setFqdn(java.lang.String);
+    method public void setFriendlyName(java.lang.String);
+    method public void setHomeNetworkIds(java.util.Map<java.lang.String, java.lang.Long>);
+    method public void setIconUrl(java.lang.String);
+    method public void setMatchAllOis(long[]);
+    method public void setMatchAnyOis(long[]);
+    method public void setOtherHomePartners(java.lang.String[]);
+    method public void setRoamingConsortiumOis(long[]);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.HomeSp> CREATOR;
+  }
+
+  public final class Policy implements android.os.Parcelable {
+    ctor public Policy();
+    ctor public Policy(android.net.wifi.hotspot2.pps.Policy);
+    method public int describeContents();
+    method public java.lang.String[] getExcludedSsidList();
+    method public int getMaximumBssLoadValue();
+    method public long getMinHomeDownlinkBandWidht();
+    method public long getMinHomeUplinkBandwidth();
+    method public long getMinRoamingDownlinkBandwidth();
+    method public long getMinRoamingUplinkBandwidth();
+    method public android.net.wifi.hotspot2.pps.UpdateParameter getPolicyUpdate();
+    method public java.util.List<android.net.wifi.hotspot2.pps.Policy.RoamingPartner> getPreferredRoamingPartnerList();
+    method public java.util.Map<java.lang.Integer, java.lang.String> getRequiredProtoPortMap();
+    method public void setExcludedSsidList(java.lang.String[]);
+    method public void setMaximumBssLoadValue(int);
+    method public void setMinHomeDownlinkBandwidth(long);
+    method public void setMinHomeUplinkBandwidth(long);
+    method public void setMinRoamingDownlinkBandwidth(long);
+    method public void setMinRoamingUplinkBandwidth(long);
+    method public void setPolicyUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public void setPreferredRoamingPartnerList(java.util.List<android.net.wifi.hotspot2.pps.Policy.RoamingPartner>);
+    method public void setRequiredProtoPortMap(java.util.Map<java.lang.Integer, java.lang.String>);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Policy> CREATOR;
+  }
+
+  public static final class Policy.RoamingPartner implements android.os.Parcelable {
+    ctor public Policy.RoamingPartner();
+    ctor public Policy.RoamingPartner(android.net.wifi.hotspot2.pps.Policy.RoamingPartner);
+    method public int describeContents();
+    method public java.lang.String getCountries();
+    method public java.lang.String getFqdn();
+    method public boolean getFqdnExactMatch();
+    method public int getPriority();
+    method public void setCountries(java.lang.String);
+    method public void setFqdn(java.lang.String);
+    method public void setFqdnExactMatch(boolean);
+    method public void setPriority(int);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Policy.RoamingPartner> CREATOR;
+  }
+
+  public final class UpdateParameter implements android.os.Parcelable {
+    ctor public UpdateParameter();
+    ctor public UpdateParameter(android.net.wifi.hotspot2.pps.UpdateParameter);
+    method public int describeContents();
+    method public java.lang.String getBase64EncodedPassword();
+    method public java.lang.String getRestriction();
+    method public java.lang.String getServerUri();
+    method public byte[] getTrustRootCertSha256Fingerprint();
+    method public java.lang.String getTrustRootCertUrl();
+    method public long getUpdateIntervalInMinutes();
+    method public java.lang.String getUpdateMethod();
+    method public java.lang.String getUsername();
+    method public void setBase64EncodedPassword(java.lang.String);
+    method public void setRestriction(java.lang.String);
+    method public void setServerUri(java.lang.String);
+    method public void setTrustRootCertSha256Fingerprint(byte[]);
+    method public void setTrustRootCertUrl(java.lang.String);
+    method public void setUpdateIntervalInMinutes(long);
+    method public void setUpdateMethod(java.lang.String);
+    method public void setUsername(java.lang.String);
+    method public boolean validate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.UpdateParameter> CREATOR;
+    field public static final long UPDATE_CHECK_INTERVAL_NEVER = 4294967295L; // 0xffffffffL
+    field public static final java.lang.String UPDATE_METHOD_OMADM = "OMA-DM-ClientInitiated";
+    field public static final java.lang.String UPDATE_METHOD_SSP = "SSP-ClientInitiated";
+    field public static final java.lang.String UPDATE_RESTRICTION_HOMESP = "HomeSP";
+    field public static final java.lang.String UPDATE_RESTRICTION_ROAMING_PARTNER = "RoamingPartner";
+    field public static final java.lang.String UPDATE_RESTRICTION_UNRESTRICTED = "Unrestricted";
+  }
+
+}
+
 package android.net.wifi.p2p {
 
   public class WifiP2pConfig implements android.os.Parcelable {
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index c773275..7901737 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -18,6 +18,7 @@
 #define LOG_TAG "BootAnimation"
 
 #include <stdint.h>
+#include <inttypes.h>
 #include <sys/inotify.h>
 #include <sys/poll.h>
 #include <sys/stat.h>
@@ -35,6 +36,7 @@
 #include <utils/Atomic.h>
 #include <utils/Errors.h>
 #include <utils/Log.h>
+#include <utils/SystemClock.h>
 
 #include <ui/PixelFormat.h>
 #include <ui/Rect.h>
@@ -350,6 +352,7 @@
 
 bool BootAnimation::android()
 {
+    ALOGD("BootAnimationShownTiming: BootAnimation start time: %" PRId64 "ms", elapsedRealtime());
     initTexture(&mAndroid[0], mAssets, "images/android-logo-mask.png");
     initTexture(&mAndroid[1], mAssets, "images/android-logo-shine.png");
 
@@ -854,8 +857,8 @@
         mTimeCheckThread = nullptr;
     }
 
+    // We should have joined mInitAudioThread thread in playAnimation
     if (mInitAudioThread != nullptr) {
-        mInitAudioThread->requestExit();
         mInitAudioThread = nullptr;
     }
 
@@ -875,6 +878,7 @@
     const int animationX = (mWidth - animation.width) / 2;
     const int animationY = (mHeight - animation.height) / 2;
 
+    ALOGD("BootAnimationShownTiming: BootAnimation start time: %" PRId64 "ms", elapsedRealtime());
     for (size_t i=0 ; i<pcount ; i++) {
         const Animation::Part& part(animation.parts[i]);
         const size_t fcount = part.frames.size();
diff --git a/core/jni/android_os_seccomp.cpp b/core/jni/android_os_seccomp.cpp
index fc35a74..2fe5d39 100644
--- a/core/jni/android_os_seccomp.cpp
+++ b/core/jni/android_os_seccomp.cpp
@@ -122,6 +122,10 @@
     // 64-bit filter
     ExamineSyscall(f);
 
+    // arm64-only filter - autogenerated from bionic syscall usage
+    for (size_t i = 0; i < arm64_filter_size; ++i)
+        f.push_back(arm64_filter[i]);
+
     // Syscalls needed to boot Android
     AllowSyscall(f, 41);  // __NR_pivot_root
     AllowSyscall(f, 31);  // __NR_ioprio_get
@@ -143,9 +147,7 @@
     // Needed for kernel to restart syscalls
     AllowSyscall(f, 128); // __NR_restart_syscall
 
-    // arm64-only filter - autogenerated from bionic syscall usage
-    for (size_t i = 0; i < arm64_filter_size; ++i)
-        f.push_back(arm64_filter[i]);
+    Trap(f);
 
     if (SetValidateArchitectureJumpTarget(offset_to_32bit_filter, f) != 0)
         return -1;
@@ -153,6 +155,10 @@
     // 32-bit filter
     ExamineSyscall(f);
 
+    // arm32 filter - autogenerated from bionic syscall usage
+    for (size_t i = 0; i < arm_filter_size; ++i)
+        f.push_back(arm_filter[i]);
+
     // Syscalls needed to boot android
     AllowSyscall(f, 120); // __NR_clone
     AllowSyscall(f, 240); // __NR_futex
@@ -200,9 +206,10 @@
     // already allowed.
     AllowSyscall(f, 85);  // __NR_readlink
 
-    // arm32 filter - autogenerated from bionic syscall usage
-    for (size_t i = 0; i < arm_filter_size; ++i)
-        f.push_back(arm_filter[i]);
+    // b/34908783
+    AllowSyscall(f, 250); // __NR_epoll_create
+
+    Trap(f);
 
     return install_filter(f);
 }
diff --git a/core/proto/android/service/battery.proto b/core/proto/android/service/battery.proto
new file mode 100644
index 0000000..33ad682b
--- /dev/null
+++ b/core/proto/android/service/battery.proto
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.service.battery;
+
+option java_multiple_files = true;
+option java_outer_classname = "BatteryServiceProto";
+
+message BatteryServiceDumpProto {
+    enum BatteryPlugged {
+        BATTERY_PLUGGED_NONE = 0;
+        BATTERY_PLUGGED_AC = 1;
+        BATTERY_PLUGGED_USB = 2;
+        BATTERY_PLUGGED_WIRELESS = 4;
+    }
+    enum BatteryStatus {
+        BATTERY_STATUS_INVALID = 0;
+        BATTERY_STATUS_UNKNOWN = 1;
+        BATTERY_STATUS_CHARGING = 2;
+        BATTERY_STATUS_DISCHARGING = 3;
+        BATTERY_STATUS_NOT_CHARGING = 4;
+        BATTERY_STATUS_FULL = 5;
+    }
+    enum BatteryHealth {
+        BATTERY_HEALTH_INVALID = 0;
+        BATTERY_HEALTH_UNKNOWN = 1;
+        BATTERY_HEALTH_GOOD = 2;
+        BATTERY_HEALTH_OVERHEAT = 3;
+        BATTERY_HEALTH_DEAD = 4;
+        BATTERY_HEALTH_OVER_VOLTAGE = 5;
+        BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6;
+        BATTERY_HEALTH_COLD = 7;
+    }
+
+    // If true: UPDATES STOPPED -- use 'reset' to restart
+    bool are_updates_stopped = 1;
+    // Plugged status of power sources
+    BatteryPlugged plugged = 2;
+    // Max current in microamperes
+    int32 max_charging_current = 3;
+    // Max voltage
+    int32 max_charging_voltage = 4;
+    // Battery capacity in microampere-hours
+    int32 charge_counter = 5;
+    // Charging status
+    BatteryStatus status = 6;
+    // Battery health
+    BatteryHealth health = 7;
+    // True if the battery is present
+    bool is_present = 8;
+    // Charge level, from 0 through "scale" inclusive
+    int32 level = 9;
+    // The maximum value for the charge level
+    int32 scale = 10;
+    // Battery voltage in millivolts
+    int32 voltage = 11;
+    // Battery temperature in tenths of a degree Centigrade
+    int32 temperature = 12;
+    // The type of battery installed, e.g. "Li-ion"
+    string technology = 13;
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index b9ed725..4b1baa2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -38,7 +38,6 @@
 import com.android.systemui.classifier.FalsingManager;
 import com.android.systemui.statusbar.notification.FakeShadowView;
 import com.android.systemui.statusbar.notification.NotificationUtils;
-import com.android.systemui.statusbar.policy.AccessibilityController;
 import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
 import com.android.systemui.statusbar.stack.StackStateAnimator;
 
@@ -140,8 +139,6 @@
     private ValueAnimator mBackgroundColorAnimator;
     private float mAppearAnimationFraction = -1.0f;
     private float mAppearAnimationTranslation;
-    private boolean mShowingLegacyBackground;
-    private final int mLegacyColor;
     private final int mNormalColor;
     private final int mLowPriorityColor;
     private boolean mIsBelowSpeedBump;
@@ -192,7 +189,6 @@
         mSlowOutLinearInInterpolator = new PathInterpolator(0.8f, 0.0f, 1.0f, 1.0f);
         setClipChildren(false);
         setClipToPadding(false);
-        mLegacyColor = context.getColor(R.color.notification_legacy_background_color);
         mNormalColor = context.getColor(R.color.notification_material_background_color);
         mLowPriorityColor = context.getColor(
                 R.color.notification_material_background_low_priority_color);
@@ -489,11 +485,6 @@
         updateOutlineAlpha();
     }
 
-    public void setShowingLegacyBackground(boolean showing) {
-        mShowingLegacyBackground = showing;
-        updateBackgroundTint();
-    }
-
     @Override
     public void setBelowSpeedBump(boolean below) {
         super.setBelowSpeedBump(below);
@@ -950,8 +941,6 @@
         }
         if (withTint && mBgTint != NO_COLOR) {
             return mBgTint;
-        } else if (mShowingLegacyBackground) {
-            return mLegacyColor;
         } else if (mIsBelowSpeedBump) {
             return mLowPriorityColor;
         } else {
@@ -962,8 +951,6 @@
     protected int getRippleColor() {
         if (mBgTint != 0) {
             return mTintedRippleColor;
-        } else if (mShowingLegacyBackground) {
-            return mTintedRippleColor;
         } else if (mIsBelowSpeedBump) {
             return mLowPriorityRippleColor;
         } else {
@@ -1009,7 +996,6 @@
     public void reset() {
         setTintColor(0);
         resetBackgroundAlpha();
-        setShowingLegacyBackground(false);
         setBelowSpeedBump(false);
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index f19d6d7..85e2bd6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -1796,9 +1796,7 @@
         return mShowingPublic ? mPublicLayout : mPrivateLayout;
     }
 
-    @Override
     public void setShowingLegacyBackground(boolean showing) {
-        super.setShowingLegacyBackground(showing);
         for (NotificationContentView l : mLayouts) {
             l.setShowingLegacyBackground(showing);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
index 3b18886..03c7325 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
@@ -41,10 +41,12 @@
     private final ViewInvertHelper mInvertHelper;
     private final Paint mGreyPaint = new Paint();
     private boolean mShowingLegacyBackground;
+    private int mLegacyColor;
 
     protected NotificationCustomViewWrapper(View view, ExpandableNotificationRow row) {
         super(view, row);
         mInvertHelper = new ViewInvertHelper(view, NotificationPanelView.DOZE_ANIMATION_DURATION);
+        mLegacyColor = row.getContext().getColor(R.color.notification_legacy_background_color);
     }
 
     @Override
@@ -103,6 +105,15 @@
     }
 
     @Override
+    public int getCustomBackgroundColor() {
+        int customBackgroundColor = super.getCustomBackgroundColor();
+        if (customBackgroundColor == 0 && mShowingLegacyBackground) {
+            return mLegacyColor;
+        }
+        return customBackgroundColor;
+    }
+
+    @Override
     public void setShowingLegacyBackground(boolean showing) {
         super.setShowingLegacyBackground(showing);
         mShowingLegacyBackground = showing;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationContentViewTest.java
index 3bb9f5f..77f96b8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationContentViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationContentViewTest.java
@@ -16,9 +16,6 @@
 
 package com.android.systemui.statusbar;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 import android.content.Context;
 import android.support.test.InstrumentationRegistry;
 import android.support.test.annotation.UiThreadTest;
@@ -31,6 +28,11 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import static org.mockito.ArgumentMatchers.anyFloat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class NotificationContentViewTest {
@@ -39,13 +41,16 @@
     Context mContext;
 
     @Before
+    @UiThreadTest
     public void setup() {
-        ExpandableNotificationRow rowMock = mock(ExpandableNotificationRow.class);
-        when(rowMock.getIntrinsicHeight()).thenReturn(10);
-
         mContext = InstrumentationRegistry.getTargetContext();
         mView = new NotificationContentView(mContext, null);
-        mView.setContainingNotification(rowMock);
+        ExpandableNotificationRow row = new ExpandableNotificationRow(mContext, null);
+        ExpandableNotificationRow mockRow = spy(row);
+        doNothing().when(mockRow).updateBackgroundAlpha(anyFloat());
+        doReturn(10).when(mockRow).getIntrinsicHeight();
+
+        mView.setContainingNotification(mockRow);
         mView.setHeights(10, 20, 30, 40);
 
         mView.setContractedChild(createViewWithHeight(10));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/ViewUtils.java b/packages/SystemUI/tests/src/com/android/systemui/utils/ViewUtils.java
index 01996ca..202c4cf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/ViewUtils.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/ViewUtils.java
@@ -29,7 +29,7 @@
     public static void attachView(View view) {
         WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
-                LayoutParams.TYPE_SYSTEM_ALERT,
+                LayoutParams.TYPE_APPLICATION_OVERLAY,
                 0, PixelFormat.TRANSLUCENT);
         Handler handler = new Handler(Looper.getMainLooper());
         handler.post(() -> InstrumentationRegistry.getContext()
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index dd550f2..6248cab 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -49,8 +49,10 @@
 import android.os.UEventObserver;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.service.battery.BatteryServiceDumpProto;
 import android.util.EventLog;
 import android.util.Slog;
+import android.util.proto.ProtoOutputStream;
 
 import java.io.File;
 import java.io.FileDescriptor;
@@ -801,6 +803,35 @@
         }
     }
 
+    private void dumpProto(FileDescriptor fd) {
+        final ProtoOutputStream proto = new ProtoOutputStream(fd);
+
+        synchronized (mLock) {
+            proto.write(BatteryServiceDumpProto.ARE_UPDATES_STOPPED, mUpdatesStopped);
+            int batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_NONE;
+            if (mBatteryProps.chargerAcOnline) {
+                batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_AC;
+            } else if (mBatteryProps.chargerUsbOnline) {
+                batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_USB;
+            } else if (mBatteryProps.chargerWirelessOnline) {
+                batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_WIRELESS;
+            }
+            proto.write(BatteryServiceDumpProto.PLUGGED, batteryPluggedValue);
+            proto.write(BatteryServiceDumpProto.MAX_CHARGING_CURRENT, mBatteryProps.maxChargingCurrent);
+            proto.write(BatteryServiceDumpProto.MAX_CHARGING_VOLTAGE, mBatteryProps.maxChargingVoltage);
+            proto.write(BatteryServiceDumpProto.CHARGE_COUNTER, mBatteryProps.batteryChargeCounter);
+            proto.write(BatteryServiceDumpProto.STATUS, mBatteryProps.batteryStatus);
+            proto.write(BatteryServiceDumpProto.HEALTH, mBatteryProps.batteryHealth);
+            proto.write(BatteryServiceDumpProto.IS_PRESENT, mBatteryProps.batteryPresent);
+            proto.write(BatteryServiceDumpProto.LEVEL, mBatteryProps.batteryLevel);
+            proto.write(BatteryServiceDumpProto.SCALE, BATTERY_SCALE);
+            proto.write(BatteryServiceDumpProto.VOLTAGE, mBatteryProps.batteryVoltage);
+            proto.write(BatteryServiceDumpProto.TEMPERATURE, mBatteryProps.batteryTemperature);
+            proto.write(BatteryServiceDumpProto.TECHNOLOGY, mBatteryProps.batteryTechnology);
+        }
+        proto.flush();
+    }
+
     private final class Led {
         private final Light mBatteryLight;
 
@@ -878,7 +909,11 @@
                 return;
             }
 
-            dumpInternal(fd, pw, args);
+            if (args.length > 0 && "--proto".equals(args[0])) {
+                dumpProto(fd);
+            } else {
+                dumpInternal(fd, pw, args);
+            }
         }
 
         @Override public void onShellCommand(FileDescriptor in, FileDescriptor out,
diff --git a/services/core/java/com/android/server/job/JobServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java
index b089ba7..7cb223d 100644
--- a/services/core/java/com/android/server/job/JobServiceContext.java
+++ b/services/core/java/com/android/server/job/JobServiceContext.java
@@ -70,6 +70,8 @@
             ActivityManager.isLowRamDeviceStatic() ? 1 : 3;
     /** Amount of time a job is allowed to execute for before being considered timed-out. */
     private static final long EXECUTING_TIMESLICE_MILLIS = 10 * 60 * 1000;  // 10mins.
+    /** Amount of time the JobScheduler waits for the initial service launch+bind. */
+    private static final long OP_BIND_TIMEOUT_MILLIS = 18 * 1000;
     /** Amount of time the JobScheduler will wait for a response from an app for a message. */
     private static final long OP_TIMEOUT_MILLIS = 8 * 1000;
 
@@ -645,8 +647,20 @@
     private void scheduleOpTimeOut() {
         removeOpTimeOut();
 
-        final long timeoutMillis = (mVerb == VERB_EXECUTING) ?
-                EXECUTING_TIMESLICE_MILLIS : OP_TIMEOUT_MILLIS;
+        final long timeoutMillis;
+        switch (mVerb) {
+            case VERB_EXECUTING:
+                timeoutMillis = EXECUTING_TIMESLICE_MILLIS;
+                break;
+
+            case VERB_BINDING:
+                timeoutMillis = OP_BIND_TIMEOUT_MILLIS;
+                break;
+
+            default:
+                timeoutMillis = OP_TIMEOUT_MILLIS;
+                break;
+        }
         if (DEBUG) {
             Slog.d(TAG, "Scheduling time out for '" +
                     mRunningJob.getServiceComponent().getShortClassName() + "' jId: " +
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 6f20f10..0e5ea6e 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -712,6 +712,7 @@
     // System configuration read by SystemConfig.
     final int[] mGlobalGids;
     final SparseArray<ArraySet<String>> mSystemPermissions;
+    @GuardedBy("mAvailableFeatures")
     final ArrayMap<String, FeatureInfo> mAvailableFeatures;
 
     // If mac_permissions.xml was found for seinfo labeling.
@@ -4215,21 +4216,22 @@
 
     @Override
     public @NonNull ParceledListSlice<FeatureInfo> getSystemAvailableFeatures() {
-        synchronized (mPackages) {
-            final ArrayList<FeatureInfo> res = new ArrayList<>(mAvailableFeatures.values());
-
-            final FeatureInfo fi = new FeatureInfo();
-            fi.reqGlEsVersion = SystemProperties.getInt("ro.opengles.version",
-                    FeatureInfo.GL_ES_VERSION_UNDEFINED);
-            res.add(fi);
-
-            return new ParceledListSlice<>(res);
+        ArrayList<FeatureInfo> res;
+        synchronized (mAvailableFeatures) {
+            res = new ArrayList<>(mAvailableFeatures.size() + 1);
+            res.addAll(mAvailableFeatures.values());
         }
+        final FeatureInfo fi = new FeatureInfo();
+        fi.reqGlEsVersion = SystemProperties.getInt("ro.opengles.version",
+                FeatureInfo.GL_ES_VERSION_UNDEFINED);
+        res.add(fi);
+
+        return new ParceledListSlice<>(res);
     }
 
     @Override
     public boolean hasSystemFeature(String name, int version) {
-        synchronized (mPackages) {
+        synchronized (mAvailableFeatures) {
             final FeatureInfo feat = mAvailableFeatures.get(name);
             if (feat == null) {
                 return false;
@@ -20379,20 +20381,22 @@
                     pw.println("Features:");
                 }
 
-                for (FeatureInfo feat : mAvailableFeatures.values()) {
-                    if (checkin) {
-                        pw.print("feat,");
-                        pw.print(feat.name);
-                        pw.print(",");
-                        pw.println(feat.version);
-                    } else {
-                        pw.print("  ");
-                        pw.print(feat.name);
-                        if (feat.version > 0) {
-                            pw.print(" version=");
-                            pw.print(feat.version);
+                synchronized (mAvailableFeatures) {
+                    for (FeatureInfo feat : mAvailableFeatures.values()) {
+                        if (checkin) {
+                            pw.print("feat,");
+                            pw.print(feat.name);
+                            pw.print(",");
+                            pw.println(feat.version);
+                        } else {
+                            pw.print("  ");
+                            pw.print(feat.name);
+                            if (feat.version > 0) {
+                                pw.print(" version=");
+                                pw.print(feat.version);
+                            }
+                            pw.println();
                         }
-                        pw.println();
                     }
                 }
             }
diff --git a/services/core/java/com/android/server/vr/VrManagerService.java b/services/core/java/com/android/server/vr/VrManagerService.java
index e8385fc..8368b05 100644
--- a/services/core/java/com/android/server/vr/VrManagerService.java
+++ b/services/core/java/com/android/server/vr/VrManagerService.java
@@ -31,7 +31,6 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.hardware.display.DisplayManager;
 import android.os.Binder;
 import android.os.Handler;
 import android.os.IBinder;
@@ -138,7 +137,6 @@
     private final NotificationAccessManager mNotifAccessManager = new NotificationAccessManager();
     /** Tracks the state of the screen and keyguard UI.*/
     private int mSystemSleepFlags = FLAG_NONE;
-    private CompatibilityDisplay mCompatibilityDisplay;
 
     private static final int MSG_VR_STATE_CHANGE = 0;
     private static final int MSG_PENDING_VR_STATE_CHANGE = 1;
@@ -496,11 +494,6 @@
 
                 mComponentObserver.rebuildAll();
             }
-
-            DisplayManager dm =
-                    (DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE);
-            mCompatibilityDisplay = new CompatibilityDisplay(dm, mVrManager);
-            mCompatibilityDisplay.init();
         } else if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) {
             synchronized (mLock) {
                 mVrModeAllowed = true;
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index b163abf..d2ea64c8 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -915,10 +915,15 @@
             if (attachedTransformation != null) {
                 tmpMatrix.postConcat(attachedTransformation.getMatrix());
             }
-            tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);
             if (appTransformation != null) {
                 tmpMatrix.postConcat(appTransformation.getMatrix());
             }
+
+            // The translation that applies the position of the window needs to be applied at the
+            // end in case that other translations include scaling. Otherwise the scaling will
+            // affect this translation. But it needs to be set before the screen rotation animation
+            // so the pivot point is at the center of the screen for all windows.
+            tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);
             if (screenAnimation) {
                 tmpMatrix.postConcat(screenRotationAnimation.getEnterTransformation().getMatrix());
             }
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 6c45233..3b15f1c 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1173,6 +1173,9 @@
      * and {@code NEW_CODE} is the new {@code ImsReasonInfo#CODE_*} which this combination of
      * original code and message shall be remapped to.
      *
+     * Note: If {@code *} is specified for the original code, any ImsReasonInfo with the matching
+     * {@code MESSAGE} will be remapped to {@code NEW_CODE}.
+     *
      * Example: "501|call completion elsewhere|1014"
      * When the {@link ImsReasonInfo#getCode()} is {@link ImsReasonInfo#CODE_USER_TERMINATED} and
      * the {@link ImsReasonInfo#getExtraMessage()} is {@code "call completion elsewhere"},
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index 10cb7c9..e53e246 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -246,23 +246,18 @@
      */
     public static final int IMEI_NOT_ACCEPTED = 58;
 
+    /**
+     * A call over WIFI was disconnected because the WIFI signal was lost or became too degraded to
+     * continue the call.
+     */
+    public static final int WIFI_LOST = 59;
+
     //*********************************************************************************************
     // When adding a disconnect type:
-    // 1) Please assign the new type the next id value below.
-    // 2) Increment the next id value below to a new value.
-    // 3) Update MAXIMUM_VALID_VALUE to the new disconnect type.
-    // 4) Update toString() with the newly added disconnect type.
-    // 5) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause.
-    //
-    // NextId: 59
+    // 1) Update toString() with the newly added disconnect type.
+    // 2) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause.
     //*********************************************************************************************
 
-    /** Smallest valid value for call disconnect codes. */
-    public static final int MINIMUM_VALID_VALUE = NOT_DISCONNECTED;
-
-    /** Largest valid value for call disconnect codes. */
-    public static final int MAXIMUM_VALID_VALUE = IMEI_NOT_ACCEPTED;
-
     /** Private constructor to avoid class instantiation. */
     private DisconnectCause() {
         // Do nothing.
@@ -387,6 +382,8 @@
             return "DIALED_CALL_FORWARDING_WHILE_ROAMING";
         case IMEI_NOT_ACCEPTED:
             return "IMEI_NOT_ACCEPTED";
+        case WIFI_LOST:
+            return "WIFI_LOST";
         default:
             return "INVALID: " + cause;
         }
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 913da82..1b3aa8a 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -819,37 +819,6 @@
     public static final String EVENT_DOWNGRADE_DATA_DISABLED =
             "android.telephony.event.EVENT_DOWNGRADE_DATA_DISABLED";
 
-    /**
-     * Response codes for sim activation. Activation completed successfully.
-     * @hide
-     */
-    @SystemApi
-    public static final int SIM_ACTIVATION_RESULT_COMPLETE = 0;
-    /**
-     * Response codes for sim activation. Activation not supported (device has no SIM).
-     * @hide
-     */
-    @SystemApi
-    public static final int SIM_ACTIVATION_RESULT_NOT_SUPPORTED = 1;
-    /**
-     * Response codes for sim activation. Activation is in progress.
-     * @hide
-     */
-    @SystemApi
-    public static final int SIM_ACTIVATION_RESULT_IN_PROGRESS = 2;
-    /**
-     * Response codes for sim activation. Activation failed to complete.
-     * @hide
-     */
-    @SystemApi
-    public static final int SIM_ACTIVATION_RESULT_FAILED = 3;
-    /**
-     * Response codes for sim activation. Activation canceled by user.
-     * @hide
-     */
-    @SystemApi
-    public static final int SIM_ACTIVATION_RESULT_CANCELED = 4;
-
     /* Visual voicemail protocols */
 
     /**
diff --git a/telephony/java/com/android/ims/ImsReasonInfo.java b/telephony/java/com/android/ims/ImsReasonInfo.java
index 56b8822..c71808c 100644
--- a/telephony/java/com/android/ims/ImsReasonInfo.java
+++ b/telephony/java/com/android/ims/ImsReasonInfo.java
@@ -308,6 +308,11 @@
     public static final int CODE_DATA_DISABLED = 1406;
 
     /**
+     * Indicates a call was disconnected due to loss of wifi signal.
+     */
+    public static final int CODE_WIFI_LOST = 1407;
+
+    /**
      * Network string error messages.
      * mExtraMessage may have these values.
      */
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 891b8a1a..5ee7e23 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -417,7 +417,7 @@
     int RIL_UNSOL_RESPONSE_BASE = 1000;
     int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
     int RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001;
-    int RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED = 1002;
+    int RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED = 1002;
     int RIL_UNSOL_RESPONSE_NEW_SMS = 1003;
     int RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT = 1004;
     int RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM = 1005;
diff --git a/tools/aapt2/LoadedApk.cpp b/tools/aapt2/LoadedApk.cpp
index 3d466ef..76792ce 100644
--- a/tools/aapt2/LoadedApk.cpp
+++ b/tools/aapt2/LoadedApk.cpp
@@ -16,10 +16,15 @@
 
 #include "LoadedApk.h"
 
+#include "ResourceValues.h"
+#include "ValueVisitor.h"
+#include "flatten/Archive.h"
+#include "flatten/TableFlattener.h"
+
 namespace aapt {
 
-std::unique_ptr<LoadedApk> LoadedApk::LoadApkFromPath(
-    IAaptContext* context, const StringPiece& path) {
+std::unique_ptr<LoadedApk> LoadedApk::LoadApkFromPath(IAaptContext* context,
+                                                      const android::StringPiece& path) {
   Source source(path);
   std::string error;
   std::unique_ptr<io::ZipFileCollection> apk =
@@ -53,4 +58,68 @@
   return util::make_unique<LoadedApk>(source, std::move(apk), std::move(table));
 }
 
+bool LoadedApk::WriteToArchive(IAaptContext* context, IArchiveWriter* writer) {
+  std::set<std::string> referenced_resources;
+  // List the files being referenced in the resource table.
+  for (auto& pkg : table_->packages) {
+    for (auto& type : pkg->types) {
+      for (auto& entry : type->entries) {
+        for (auto& config_value : entry->values) {
+          FileReference* file_ref = ValueCast<FileReference>(config_value->value.get());
+          if (file_ref) {
+            referenced_resources.insert(*file_ref->path);
+          }
+        }
+      }
+    }
+  }
+
+  std::unique_ptr<io::IFileCollectionIterator> iterator = apk_->Iterator();
+  while (iterator->HasNext()) {
+    io::IFile* file = iterator->Next();
+
+    std::string path = file->GetSource().path;
+    // The name of the path has the format "<zip-file-name>@<path-to-file>".
+    path = path.substr(path.find("@") + 1);
+
+    // Skip resources that are not referenced if requested.
+    if (path.find("res/") == 0 && referenced_resources.find(path) == referenced_resources.end()) {
+      if (context->IsVerbose()) {
+        context->GetDiagnostics()->Note(DiagMessage()
+                                        << "Resource '" << path << "' not referenced in "
+                                        << "resource table; removing from APK.");
+      }
+      continue;
+    }
+
+    // The resource table needs to be reserialized since it might have changed.
+    if (path == "resources.arsc") {
+      BigBuffer buffer = BigBuffer(1024);
+      TableFlattener flattener(&buffer);
+      if (!flattener.Consume(context, table_.get())) {
+        return false;
+      }
+
+      if (!writer->StartEntry(path, ArchiveEntry::kAlign) || !writer->WriteEntry(buffer) ||
+          !writer->FinishEntry()) {
+        context->GetDiagnostics()->Error(DiagMessage()
+                                         << "Error when writing file '" << path << "' in APK.");
+        return false;
+      }
+      continue;
+    }
+
+    std::unique_ptr<io::IData> data = file->OpenAsData();
+    // TODO(lecesne): Only compress the files that were compressed in the original APK.
+    if (!writer->StartEntry(path, ArchiveEntry::kCompress) ||
+        !writer->WriteEntry(data->data(), data->size()) || !writer->FinishEntry()) {
+      context->GetDiagnostics()->Error(DiagMessage()
+                                       << "Error when writing file '" << path << "' in APK.");
+      return false;
+    }
+  }
+
+  return true;
+}
+
 }  // namespace aapt
diff --git a/tools/aapt2/LoadedApk.h b/tools/aapt2/LoadedApk.h
index 0cc2d22..f8878d1 100644
--- a/tools/aapt2/LoadedApk.h
+++ b/tools/aapt2/LoadedApk.h
@@ -19,12 +19,11 @@
 
 #include "androidfw/StringPiece.h"
 
-#include "io/ZipArchive.h"
 #include "ResourceTable.h"
+#include "flatten/Archive.h"
+#include "io/ZipArchive.h"
 #include "unflatten/BinaryResourceParser.h"
 
-using android::StringPiece;
-
 namespace aapt {
 
 /** Info about an APK loaded in memory. */
@@ -42,8 +41,14 @@
 
   const Source& GetSource() { return source_; }
 
-  static std::unique_ptr<LoadedApk> LoadApkFromPath(
-      IAaptContext* context, const StringPiece& path);
+  /**
+   * Writes the APK on disk at the given path, while also removing the resource
+   * files that are not referenced in the resource table.
+   */
+  bool WriteToArchive(IAaptContext* context, IArchiveWriter* writer);
+
+  static std::unique_ptr<LoadedApk> LoadApkFromPath(IAaptContext* context,
+                                                    const android::StringPiece& path);
 
  private:
   Source source_;
diff --git a/tools/aapt2/io/File.h b/tools/aapt2/io/File.h
index 3d5b5b1..1ef9743 100644
--- a/tools/aapt2/io/File.h
+++ b/tools/aapt2/io/File.h
@@ -63,6 +63,11 @@
 
   IFile* CreateFileSegment(size_t offset, size_t len);
 
+  /** Returns whether the file was compressed before it was stored in memory. */
+  virtual bool WasCompressed() {
+    return false;
+  }
+
  private:
   // Any segments created from this IFile need to be owned by this IFile, so
   // keep them
diff --git a/tools/aapt2/io/ZipArchive.cpp b/tools/aapt2/io/ZipArchive.cpp
index 62b436f..6494d2d 100644
--- a/tools/aapt2/io/ZipArchive.cpp
+++ b/tools/aapt2/io/ZipArchive.cpp
@@ -59,6 +59,10 @@
 
 const Source& ZipFile::GetSource() const { return source_; }
 
+bool ZipFile::WasCompressed() {
+  return zip_entry_.method != kCompressStored;
+}
+
 ZipFileCollectionIterator::ZipFileCollectionIterator(
     ZipFileCollection* collection)
     : current_(collection->files_.begin()), end_(collection->files_.end()) {}
@@ -66,7 +70,7 @@
 bool ZipFileCollectionIterator::HasNext() { return current_ != end_; }
 
 IFile* ZipFileCollectionIterator::Next() {
-  IFile* result = current_->second.get();
+  IFile* result = current_->get();
   ++current_;
   return result;
 }
@@ -110,8 +114,10 @@
         std::string(reinterpret_cast<const char*>(zip_entry_name.name),
                     zip_entry_name.name_length);
     std::string nested_path = path.to_string() + "@" + zip_entry_path;
-    collection->files_[zip_entry_path] = util::make_unique<ZipFile>(
-        collection->handle_, zip_data, Source(nested_path));
+    std::unique_ptr<IFile> file =
+        util::make_unique<ZipFile>(collection->handle_, zip_data, Source(nested_path));
+    collection->files_by_name_[zip_entry_path] = file.get();
+    collection->files_.push_back(std::move(file));
   }
 
   if (result != -1) {
@@ -122,9 +128,9 @@
 }
 
 IFile* ZipFileCollection::FindFile(const StringPiece& path) {
-  auto iter = files_.find(path.to_string());
-  if (iter != files_.end()) {
-    return iter->second.get();
+  auto iter = files_by_name_.find(path.to_string());
+  if (iter != files_by_name_.end()) {
+    return iter->second;
   }
   return nullptr;
 }
diff --git a/tools/aapt2/io/ZipArchive.h b/tools/aapt2/io/ZipArchive.h
index 634adad..56c74e3 100644
--- a/tools/aapt2/io/ZipArchive.h
+++ b/tools/aapt2/io/ZipArchive.h
@@ -40,6 +40,7 @@
 
   std::unique_ptr<IData> OpenAsData() override;
   const Source& GetSource() const override;
+  bool WasCompressed() override;
 
  private:
   ZipArchiveHandle zip_handle_;
@@ -57,7 +58,7 @@
   io::IFile* Next() override;
 
  private:
-  std::map<std::string, std::unique_ptr<IFile>>::const_iterator current_, end_;
+  std::vector<std::unique_ptr<IFile>>::const_iterator current_, end_;
 };
 
 /**
@@ -78,7 +79,8 @@
   ZipFileCollection();
 
   ZipArchiveHandle handle_;
-  std::map<std::string, std::unique_ptr<IFile>> files_;
+  std::vector<std::unique_ptr<IFile>> files_;
+  std::map<std::string, IFile*> files_by_name_;
 };
 
 }  // namespace io
diff --git a/tools/aapt2/strip/Strip.cpp b/tools/aapt2/strip/Strip.cpp
index b3787ec..c34cfbf3 100644
--- a/tools/aapt2/strip/Strip.cpp
+++ b/tools/aapt2/strip/Strip.cpp
@@ -22,6 +22,7 @@
 #include "Diagnostics.h"
 #include "Flags.h"
 #include "LoadedApk.h"
+#include "split/TableSplitter.h"
 
 using android::StringPiece;
 
@@ -78,7 +79,27 @@
       context_->GetDiagnostics()->Note(DiagMessage() << "Stripping APK...");
     }
 
-    // TODO(lecesne): Implement stripping here.
+    // TODO(lecesne): Add support for more than one density.
+    if (options_.target_configs.size() > 1) {
+      context_->GetDiagnostics()->Error(DiagMessage()
+                                        << "Multiple densities not supported at the moment");
+      return 1;
+    }
+
+    // Stripping the APK using the TableSplitter with no splits and the target
+    // density as the preferred density. The resource table is modified in
+    // place in the LoadedApk.
+    TableSplitterOptions splitter_options;
+    splitter_options.preferred_density = options_.target_configs[0].density;
+    std::vector<SplitConstraints> splits;
+    TableSplitter splitter(splits, splitter_options);
+    splitter.SplitTable(apk->GetResourceTable());
+
+    std::unique_ptr<IArchiveWriter> writer =
+        CreateZipFileArchiveWriter(context_->GetDiagnostics(), options_.output_path);
+    if (!apk->WriteToArchive(context_, writer.get())) {
+      return 1;
+    }
 
     return 0;
   }
diff --git a/tools/aapt2/unflatten/BinaryResourceParser.cpp b/tools/aapt2/unflatten/BinaryResourceParser.cpp
index aeabcff..7098fe9 100644
--- a/tools/aapt2/unflatten/BinaryResourceParser.cpp
+++ b/tools/aapt2/unflatten/BinaryResourceParser.cpp
@@ -370,8 +370,7 @@
       return false;
     }
 
-    if (!table_->AddResourceAllowMangled(name, config, {},
-                                         std::move(resource_value),
+    if (!table_->AddResourceAllowMangled(name, res_id, config, {}, std::move(resource_value),
                                          context_->GetDiagnostics())) {
       return false;
     }
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index ab725e2..3fb8ef3 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -973,7 +973,6 @@
      *
      * @param config The Passpoint configuration to be added
      * @return true on success
-     * @hide
      */
     public boolean addOrUpdatePasspointConfiguration(PasspointConfiguration config) {
         try {
@@ -988,7 +987,6 @@
      *
      * @param fqdn The FQDN of the passpoint configuration to be removed
      * @return true on success
-     * @hide
      */
     public boolean removePasspointConfiguration(String fqdn) {
         try {
@@ -1004,7 +1002,6 @@
      * An empty list will be returned when no configurations are installed.
      *
      * @return A list of {@link PasspointConfiguration}
-     * @hide
      */
     public List<PasspointConfiguration> getPasspointConfigurations() {
         try {
diff --git a/wifi/java/android/net/wifi/hotspot2/ConfigBuilder.java b/wifi/java/android/net/wifi/hotspot2/ConfigParser.java
similarity index 97%
rename from wifi/java/android/net/wifi/hotspot2/ConfigBuilder.java
rename to wifi/java/android/net/wifi/hotspot2/ConfigParser.java
index 78b335d..027b049a 100644
--- a/wifi/java/android/net/wifi/hotspot2/ConfigBuilder.java
+++ b/wifi/java/android/net/wifi/hotspot2/ConfigParser.java
@@ -16,7 +16,7 @@
 
 package android.net.wifi.hotspot2;
 
-import android.net.wifi.hotspot2.omadm.PPSMOParser;
+import android.net.wifi.hotspot2.omadm.PpsMoParser;
 import android.text.TextUtils;
 import android.util.Base64;
 import android.util.Log;
@@ -41,11 +41,9 @@
 
 /**
  * Utility class for building PasspointConfiguration from an installation file.
- *
- * @hide
  */
-public final class ConfigBuilder {
-    private static final String TAG = "ConfigBuilder";
+public final class ConfigParser {
+    private static final String TAG = "ConfigParser";
 
     // Header names.
     private static final String CONTENT_TYPE = "Content-Type";
@@ -101,6 +99,10 @@
         public String encodingType = null;
     }
 
+    /**
+     * @hide
+     */
+    public ConfigParser() {}
 
     /**
      * Parse the Hotspot 2.0 Release 1 configuration data into a {@link PasspointConfiguration}
@@ -133,7 +135,7 @@
      *             certificate chain (optional).
      * @return {@link PasspointConfiguration}
      */
-    public static PasspointConfiguration buildPasspointConfig(String mimeType, byte[] data) {
+    public static PasspointConfiguration parsePasspointConfig(String mimeType, byte[] data) {
         // Verify MIME type.
         if (!TextUtils.equals(mimeType, TYPE_WIFI_CONFIG)) {
             Log.e(TAG, "Unexpected MIME type: " + mimeType);
@@ -169,7 +171,7 @@
             throw new IOException("Missing Passpoint Profile");
         }
 
-        PasspointConfiguration config = PPSMOParser.parseMOText(new String(profileData));
+        PasspointConfiguration config = PpsMoParser.parseMoText(new String(profileData));
         if (config == null) {
             throw new IOException("Failed to parse Passpoint profile");
         }
@@ -470,4 +472,4 @@
         }
         return new Pair<PrivateKey, List<X509Certificate>>(clientKey, clientCertificateChain);
     }
-}
\ No newline at end of file
+}
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
index c2b307d..7b73b4b 100644
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
@@ -17,7 +17,7 @@
 package android.net.wifi.hotspot2;
 
 import android.net.wifi.hotspot2.pps.Credential;
-import android.net.wifi.hotspot2.pps.HomeSP;
+import android.net.wifi.hotspot2.pps.HomeSp;
 import android.net.wifi.hotspot2.pps.Policy;
 import android.net.wifi.hotspot2.pps.UpdateParameter;
 import android.os.Parcelable;
@@ -38,8 +38,6 @@
  *
  * For more info, refer to Hotspot 2.0 PPS MO defined in section 9.1 of the Hotspot 2.0
  * Release 2 Technical Specification.
- *
- * @hide
  */
 public final class PasspointConfiguration implements Parcelable {
     private static final String TAG = "PasspointConfiguration";
@@ -60,11 +58,11 @@
     private static final int NULL_VALUE = -1;
 
     /**
-     * Configurations under HomeSP subtree.
+     * Configurations under HomeSp subtree.
      */
-    private HomeSP mHomeSp = null;
-    public void setHomeSp(HomeSP homeSp) { mHomeSp = homeSp; }
-    public HomeSP getHomeSp() { return mHomeSp; }
+    private HomeSp mHomeSp = null;
+    public void setHomeSp(HomeSp homeSp) { mHomeSp = homeSp; }
+    public HomeSp getHomeSp() { return mHomeSp; }
 
     /**
      * Configurations under Credential subtree.
@@ -248,7 +246,7 @@
         }
 
         if (source.mHomeSp != null) {
-            mHomeSp = new HomeSP(source.mHomeSp);
+            mHomeSp = new HomeSp(source.mHomeSp);
         }
         if (source.mCredential != null) {
             mCredential = new Credential(source.mCredential);
diff --git a/wifi/java/android/net/wifi/hotspot2/omadm/PPSMOParser.java b/wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java
similarity index 98%
rename from wifi/java/android/net/wifi/hotspot2/omadm/PPSMOParser.java
rename to wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java
index 24672d4..2ffe428 100644
--- a/wifi/java/android/net/wifi/hotspot2/omadm/PPSMOParser.java
+++ b/wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java
@@ -18,7 +18,7 @@
 
 import android.net.wifi.hotspot2.PasspointConfiguration;
 import android.net.wifi.hotspot2.pps.Credential;
-import android.net.wifi.hotspot2.pps.HomeSP;
+import android.net.wifi.hotspot2.pps.HomeSp;
 import android.net.wifi.hotspot2.pps.Policy;
 import android.net.wifi.hotspot2.pps.UpdateParameter;
 import android.text.TextUtils;
@@ -109,11 +109,9 @@
  *     </Node>
  *   </Node>
  * </MgmtTree>
- *
- * @hide
  */
-public final class PPSMOParser {
-    private static final String TAG = "PPSMOParser";
+public final class PpsMoParser {
+    private static final String TAG = "PpsMoParser";
 
     /**
      * XML tags expected in the PPS MO (PerProviderSubscription Management Object) XML tree.
@@ -326,13 +324,18 @@
     }
 
     /**
+     * @hide
+     */
+    public PpsMoParser() {}
+
+    /**
      * Convert a XML string representation of a PPS MO (PerProviderSubscription
      * Management Object) tree to a {@link PasspointConfiguration} object.
      *
      * @param xmlString XML string representation of a PPS MO tree
      * @return {@link PasspointConfiguration} or null
      */
-    public static PasspointConfiguration parseMOText(String xmlString) {
+    public static PasspointConfiguration parseMoText(String xmlString) {
         // Convert the XML string to a XML tree.
         XMLParser xmlParser = new XMLParser();
         XMLNode root = null;
@@ -640,12 +643,12 @@
      * @return HomeSP
      * @throws ParsingException
      */
-    private static HomeSP parseHomeSP(PPSNode node) throws ParsingException {
+    private static HomeSp parseHomeSP(PPSNode node) throws ParsingException {
         if (node.isLeaf()) {
             throw new ParsingException("Leaf node not expected for HomeSP");
         }
 
-        HomeSP homeSp = new HomeSP();
+        HomeSp homeSp = new HomeSp();
         for (PPSNode child : node.getChildren()) {
             switch (child.getName()) {
                 case NODE_FQDN:
@@ -655,7 +658,7 @@
                     homeSp.setFriendlyName(getPpsNodeValue(child));
                     break;
                 case NODE_ROAMING_CONSORTIUM_OI:
-                    homeSp.setRoamingConsortiumOIs(
+                    homeSp.setRoamingConsortiumOis(
                             parseRoamingConsortiumOI(getPpsNodeValue(child)));
                     break;
                 case NODE_ICON_URL:
@@ -666,8 +669,8 @@
                     break;
                 case NODE_HOME_OI_LIST:
                     Pair<List<Long>, List<Long>> homeOIs = parseHomeOIList(child);
-                    homeSp.setMatchAllOIs(convertFromLongList(homeOIs.first));
-                    homeSp.setMatchAnyOIs(convertFromLongList(homeOIs.second));
+                    homeSp.setMatchAllOis(convertFromLongList(homeOIs.first));
+                    homeSp.setMatchAnyOis(convertFromLongList(homeOIs.second));
                     break;
                 case NODE_OTHER_HOME_PARTNERS:
                     homeSp.setOtherHomePartners(parseOtherHomePartners(child));
@@ -909,7 +912,7 @@
                     credential.setRealm(getPpsNodeValue(child));
                     break;
                 case NODE_CHECK_AAA_SERVER_CERT_STATUS:
-                    credential.setCheckAAAServerCertStatus(
+                    credential.setCheckAaaServerCertStatus(
                             Boolean.parseBoolean(getPpsNodeValue(child)));
                     break;
                 case NODE_SIM:
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
index ff93486..025d4d3 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
@@ -42,8 +42,6 @@
  *
  * In addition to the fields in the Credential subtree, this will also maintain necessary
  * information for the private key and certificates associated with this credential.
- *
- * @hide
  */
 public final class Credential implements Parcelable {
     private static final String TAG = "Credential";
@@ -98,12 +96,12 @@
      * and Accounting) server's certificate during EAP (Extensible Authentication
      * Protocol) authentication.
      */
-    private boolean mCheckAAAServerCertStatus = false;
-    public void setCheckAAAServerCertStatus(boolean checkAAAServerCertStatus) {
-        mCheckAAAServerCertStatus = checkAAAServerCertStatus;
+    private boolean mCheckAaaServerCertStatus = false;
+    public void setCheckAaaServerCertStatus(boolean checkAaaServerCertStatus) {
+        mCheckAaaServerCertStatus = checkAaaServerCertStatus;
     }
-    public boolean getCheckAAAServerStatus() {
-        return mCheckAAAServerCertStatus;
+    public boolean getCheckAaaServerStatus() {
+        return mCheckAaaServerCertStatus;
     }
 
     /**
@@ -685,7 +683,7 @@
             mCreationTimeInMs = source.mCreationTimeInMs;
             mExpirationTimeInMs = source.mExpirationTimeInMs;
             mRealm = source.mRealm;
-            mCheckAAAServerCertStatus = source.mCheckAAAServerCertStatus;
+            mCheckAaaServerCertStatus = source.mCheckAaaServerCertStatus;
             if (source.mUserCredential != null) {
                 mUserCredential = new UserCredential(source.mUserCredential);
             }
@@ -714,7 +712,7 @@
         dest.writeLong(mCreationTimeInMs);
         dest.writeLong(mExpirationTimeInMs);
         dest.writeString(mRealm);
-        dest.writeInt(mCheckAAAServerCertStatus ? 1 : 0);
+        dest.writeInt(mCheckAaaServerCertStatus ? 1 : 0);
         dest.writeParcelable(mUserCredential, flags);
         dest.writeParcelable(mCertCredential, flags);
         dest.writeParcelable(mSimCredential, flags);
@@ -736,7 +734,7 @@
         return TextUtils.equals(mRealm, that.mRealm)
                 && mCreationTimeInMs == that.mCreationTimeInMs
                 && mExpirationTimeInMs == that.mExpirationTimeInMs
-                && mCheckAAAServerCertStatus == that.mCheckAAAServerCertStatus
+                && mCheckAaaServerCertStatus == that.mCheckAaaServerCertStatus
                 && (mUserCredential == null ? that.mUserCredential == null
                     : mUserCredential.equals(that.mUserCredential))
                 && (mCertCredential == null ? that.mCertCredential == null
@@ -751,7 +749,7 @@
     @Override
     public int hashCode() {
         return Objects.hash(mRealm, mCreationTimeInMs, mExpirationTimeInMs,
-                mCheckAAAServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
+                mCheckAaaServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
                 mCaCertificate, mClientCertificateChain, mClientPrivateKey);
     }
 
@@ -800,7 +798,7 @@
                 credential.setCreationTimeInMs(in.readLong());
                 credential.setExpirationTimeInMs(in.readLong());
                 credential.setRealm(in.readString());
-                credential.setCheckAAAServerCertStatus(in.readInt() != 0);
+                credential.setCheckAaaServerCertStatus(in.readInt() != 0);
                 credential.setUserCredential(in.readParcelable(null));
                 credential.setCertCredential(in.readParcelable(null));
                 credential.setSimCredential(in.readParcelable(null));
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/HomeSP.aidl b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.aidl
similarity index 96%
rename from wifi/java/android/net/wifi/hotspot2/pps/HomeSP.aidl
rename to wifi/java/android/net/wifi/hotspot2/pps/HomeSp.aidl
index 62d5603..6d343bd 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/HomeSP.aidl
+++ b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.aidl
@@ -16,4 +16,4 @@
 
 package android.net.wifi.hotspot2.pps;
 
-parcelable HomeSP;
+parcelable HomeSp;
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/HomeSP.java b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
similarity index 79%
rename from wifi/java/android/net/wifi/hotspot2/pps/HomeSP.java
rename to wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
index 8b3b79c..7a46129 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/HomeSP.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
@@ -34,11 +34,9 @@
  *
  * For more info, refer to Hotspot 2.0 PPS MO defined in section 9.1 of the Hotspot 2.0
  * Release 2 Technical Specification.
- *
- * @hide
  */
-public final class HomeSP implements Parcelable {
-    private static final String TAG = "HomeSP";
+public final class HomeSp implements Parcelable {
+    private static final String TAG = "HomeSp";
 
     /**
      * Maximum number of bytes allowed for a SSID.
@@ -108,12 +106,12 @@
      * Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
      * (MO) tree for more detail.
      */
-    private long[] mMatchAllOIs = null;
-    public void setMatchAllOIs(long[] matchAllOIs) {
-        mMatchAllOIs = matchAllOIs;
+    private long[] mMatchAllOis = null;
+    public void setMatchAllOis(long[] matchAllOis) {
+        mMatchAllOis = matchAllOis;
     }
-    public long[] getMatchAllOIs() {
-        return mMatchAllOIs;
+    public long[] getMatchAllOis() {
+        return mMatchAllOis;
     }
 
     /**
@@ -129,12 +127,12 @@
      * Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
      * (MO) tree for more detail.
      */
-    private long[] mMatchAnyOIs = null;
-    public void setMatchAnyOIs(long[] matchAnyOIs) {
-        mMatchAnyOIs = matchAnyOIs;
+    private long[] mMatchAnyOis = null;
+    public void setMatchAnyOis(long[] matchAnyOis) {
+        mMatchAnyOis = matchAnyOis;
     }
-    public long[] getMatchAnysOIs() {
-        return mMatchAnyOIs;
+    public long[] getMatchAnysOis() {
+        return mMatchAnyOis;
     }
 
     /**
@@ -155,25 +153,25 @@
      * List of Organization Identifiers (OIs) identifying a roaming consortium of
      * which this provider is a member.
      */
-    private long[] mRoamingConsortiumOIs = null;
-    public void setRoamingConsortiumOIs(long[] roamingConsortiumOIs) {
-        mRoamingConsortiumOIs = roamingConsortiumOIs;
+    private long[] mRoamingConsortiumOis = null;
+    public void setRoamingConsortiumOis(long[] roamingConsortiumOis) {
+        mRoamingConsortiumOis = roamingConsortiumOis;
     }
-    public long[] getRoamingConsortiumOIs() {
-        return mRoamingConsortiumOIs;
+    public long[] getRoamingConsortiumOis() {
+        return mRoamingConsortiumOis;
     }
 
     /**
-     * Constructor for creating HomeSP with default values.
+     * Constructor for creating HomeSp with default values.
      */
-    public HomeSP() {}
+    public HomeSp() {}
 
     /**
      * Copy constructor.
      *
      * @param source The source to copy from
      */
-    public HomeSP(HomeSP source) {
+    public HomeSp(HomeSp source) {
         if (source == null) {
             return;
         }
@@ -183,19 +181,19 @@
         if (source.mHomeNetworkIds != null) {
             mHomeNetworkIds = Collections.unmodifiableMap(source.mHomeNetworkIds);
         }
-        if (source.mMatchAllOIs != null) {
-            mMatchAllOIs = Arrays.copyOf(source.mMatchAllOIs, source.mMatchAllOIs.length);
+        if (source.mMatchAllOis != null) {
+            mMatchAllOis = Arrays.copyOf(source.mMatchAllOis, source.mMatchAllOis.length);
         }
-        if (source.mMatchAnyOIs != null) {
-            mMatchAnyOIs = Arrays.copyOf(source.mMatchAnyOIs, source.mMatchAnyOIs.length);
+        if (source.mMatchAnyOis != null) {
+            mMatchAnyOis = Arrays.copyOf(source.mMatchAnyOis, source.mMatchAnyOis.length);
         }
         if (source.mOtherHomePartners != null) {
             mOtherHomePartners = Arrays.copyOf(source.mOtherHomePartners,
                     source.mOtherHomePartners.length);
         }
-        if (source.mRoamingConsortiumOIs != null) {
-            mRoamingConsortiumOIs = Arrays.copyOf(source.mRoamingConsortiumOIs,
-                    source.mRoamingConsortiumOIs.length);
+        if (source.mRoamingConsortiumOis != null) {
+            mRoamingConsortiumOis = Arrays.copyOf(source.mRoamingConsortiumOis,
+                    source.mRoamingConsortiumOis.length);
         }
     }
 
@@ -210,10 +208,10 @@
         dest.writeString(mFriendlyName);
         dest.writeString(mIconUrl);
         writeHomeNetworkIds(dest, mHomeNetworkIds);
-        dest.writeLongArray(mMatchAllOIs);
-        dest.writeLongArray(mMatchAnyOIs);
+        dest.writeLongArray(mMatchAllOis);
+        dest.writeLongArray(mMatchAnyOis);
         dest.writeStringArray(mOtherHomePartners);
-        dest.writeLongArray(mRoamingConsortiumOIs);
+        dest.writeLongArray(mRoamingConsortiumOis);
     }
 
     @Override
@@ -221,30 +219,30 @@
         if (this == thatObject) {
             return true;
         }
-        if (!(thatObject instanceof HomeSP)) {
+        if (!(thatObject instanceof HomeSp)) {
             return false;
         }
-        HomeSP that = (HomeSP) thatObject;
+        HomeSp that = (HomeSp) thatObject;
 
         return TextUtils.equals(mFqdn, that.mFqdn)
                 && TextUtils.equals(mFriendlyName, that.mFriendlyName)
                 && TextUtils.equals(mIconUrl, that.mIconUrl)
                 && (mHomeNetworkIds == null ? that.mHomeNetworkIds == null
                         : mHomeNetworkIds.equals(that.mHomeNetworkIds))
-                && Arrays.equals(mMatchAllOIs, that.mMatchAllOIs)
-                && Arrays.equals(mMatchAnyOIs, that.mMatchAnyOIs)
+                && Arrays.equals(mMatchAllOis, that.mMatchAllOis)
+                && Arrays.equals(mMatchAnyOis, that.mMatchAnyOis)
                 && Arrays.equals(mOtherHomePartners, that.mOtherHomePartners)
-                && Arrays.equals(mRoamingConsortiumOIs, that.mRoamingConsortiumOIs);
+                && Arrays.equals(mRoamingConsortiumOis, that.mRoamingConsortiumOis);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(mFqdn, mFriendlyName, mIconUrl, mHomeNetworkIds, mMatchAllOIs,
-                mMatchAnyOIs, mOtherHomePartners, mRoamingConsortiumOIs);
+        return Objects.hash(mFqdn, mFriendlyName, mIconUrl, mHomeNetworkIds, mMatchAllOis,
+                mMatchAnyOis, mOtherHomePartners, mRoamingConsortiumOis);
     }
 
     /**
-     * Validate HomeSP data.
+     * Validate HomeSp data.
      *
      * @return true on success or false on failure
      */
@@ -270,25 +268,25 @@
         return true;
     }
 
-    public static final Creator<HomeSP> CREATOR =
-        new Creator<HomeSP>() {
+    public static final Creator<HomeSp> CREATOR =
+        new Creator<HomeSp>() {
             @Override
-            public HomeSP createFromParcel(Parcel in) {
-                HomeSP homeSp = new HomeSP();
+            public HomeSp createFromParcel(Parcel in) {
+                HomeSp homeSp = new HomeSp();
                 homeSp.setFqdn(in.readString());
                 homeSp.setFriendlyName(in.readString());
                 homeSp.setIconUrl(in.readString());
                 homeSp.setHomeNetworkIds(readHomeNetworkIds(in));
-                homeSp.setMatchAllOIs(in.createLongArray());
-                homeSp.setMatchAnyOIs(in.createLongArray());
+                homeSp.setMatchAllOis(in.createLongArray());
+                homeSp.setMatchAnyOis(in.createLongArray());
                 homeSp.setOtherHomePartners(in.createStringArray());
-                homeSp.setRoamingConsortiumOIs(in.createLongArray());
+                homeSp.setRoamingConsortiumOis(in.createLongArray());
                 return homeSp;
             }
 
             @Override
-            public HomeSP[] newArray(int size) {
-                return new HomeSP[size];
+            public HomeSp[] newArray(int size) {
+                return new HomeSp[size];
             }
 
             /**
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Policy.java b/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
index ceaada4..caca0e4b 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
@@ -40,18 +40,11 @@
  *
  * For more info, refer to Hotspot 2.0 PPS MO defined in section 9.1 of the Hotspot 2.0
  * Release 2 Technical Specification.
- *
- * @hide
  */
 public final class Policy implements Parcelable {
     private static final String TAG = "Policy";
 
     /**
-     * Default priority for preferred roaming partner.
-     */
-    public static final int PREFERRED_ROAMING_PARTNER_DEFAULT_PRIORITY = 128;
-
-    /**
      * Maximum number of SSIDs in the exclusion list.
      */
     private static final int MAX_EXCLUSION_SSIDS = 128;
@@ -189,8 +182,9 @@
 
         /**
          * Priority associated with this roaming partner policy.
+         * Using Integer.MIN_VALUE to indicate unset value.
          */
-        private int mPriority = PREFERRED_ROAMING_PARTNER_DEFAULT_PRIORITY;
+        private int mPriority = Integer.MIN_VALUE;
         public void setPriority(int priority) {
             mPriority = priority;
         }
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java b/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java
index 17fbf9f..70264b0e 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java
@@ -34,8 +34,6 @@
  *
  * For more info, refer to Hotspot 2.0 PPS MO defined in section 9.1 of the Hotspot 2.0
  * Release 2 Technical Specification.
- *
- * @hide
  */
 public final class UpdateParameter implements Parcelable {
     private static final String TAG = "UpdateParameter";
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/ConfigBuilderTest.java b/wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java
similarity index 91%
rename from wifi/tests/src/android/net/wifi/hotspot2/ConfigBuilderTest.java
rename to wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java
index f7dbf7e..56bb437 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/ConfigBuilderTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java
@@ -21,7 +21,7 @@
 
 import android.net.wifi.FakeKeys;
 import android.net.wifi.hotspot2.pps.Credential;
-import android.net.wifi.hotspot2.pps.HomeSP;
+import android.net.wifi.hotspot2.pps.HomeSp;
 import android.test.suitebuilder.annotation.SmallTest;
 
 import java.io.BufferedReader;
@@ -33,10 +33,10 @@
 import org.junit.Test;
 
 /**
- * Unit tests for {@link android.net.wifi.hotspot2.ConfigBuilder}.
+ * Unit tests for {@link android.net.wifi.hotspot2.ConfigParser}.
  */
 @SmallTest
-public class ConfigBuilderTest {
+public class ConfigParserTest {
     /**
      * Hotspot 2.0 Release 1 installation file that contains a Passpoint profile and a
      * CA (Certificate Authority) X.509 certificate {@link FakeKeys#CA_CERT0}.
@@ -83,10 +83,10 @@
         PasspointConfiguration config = new PasspointConfiguration();
 
         // HomeSP configuration.
-        HomeSP homeSp = new HomeSP();
+        HomeSp homeSp = new HomeSp();
         homeSp.setFriendlyName("Century House");
         homeSp.setFqdn("mi6.co.uk");
-        homeSp.setRoamingConsortiumOIs(new long[] {0x112233L, 0x445566L});
+        homeSp.setRoamingConsortiumOis(new long[] {0x112233L, 0x445566L});
         config.setHomeSp(homeSp);
 
         // Credential configuration.
@@ -123,7 +123,7 @@
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
         PasspointConfiguration expectedConfig = generateConfigurationFromProfile();
         PasspointConfiguration actualConfig =
-                ConfigBuilder.buildPasspointConfig(
+                ConfigParser.parsePasspointConfig(
                         "application/x-wifi-config", configStr.getBytes());
         assertTrue(actualConfig.equals(expectedConfig));
     }
@@ -136,7 +136,7 @@
     @Test
     public void parseConfigFileWithInvalidMimeType() throws Exception {
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
-        assertNull(ConfigBuilder.buildPasspointConfig(
+        assertNull(ConfigParser.parsePasspointConfig(
                 "application/wifi-config", configStr.getBytes()));
     }
 
@@ -148,7 +148,7 @@
     @Test
     public void parseConfigFileWithUnencodedData() throws Exception {
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_UNENCODED_DATA);
-        assertNull(ConfigBuilder.buildPasspointConfig(
+        assertNull(ConfigParser.parsePasspointConfig(
                 "application/x-wifi-config", configStr.getBytes()));
     }
 
@@ -160,7 +160,7 @@
     @Test
     public void parseConfigFileWithInvalidPart() throws Exception {
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_PART);
-        assertNull(ConfigBuilder.buildPasspointConfig(
+        assertNull(ConfigParser.parsePasspointConfig(
                 "application/x-wifi-config", configStr.getBytes()));
     }
 
@@ -172,7 +172,7 @@
     @Test
     public void parseConfigFileWithMissingBoundary() throws Exception {
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_MISSING_BOUNDARY);
-        assertNull(ConfigBuilder.buildPasspointConfig(
+        assertNull(ConfigParser.parsePasspointConfig(
                 "application/x-wifi-config", configStr.getBytes()));
     }
 
@@ -185,7 +185,7 @@
     @Test
     public void parseConfigFileWithInvalidContentType() throws Exception {
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_CONTENT_TYPE);
-        assertNull(ConfigBuilder.buildPasspointConfig(
+        assertNull(ConfigParser.parsePasspointConfig(
                 "application/x-wifi-config", configStr.getBytes()));
     }
 
@@ -197,7 +197,7 @@
     @Test
     public void parseConfigFileWithoutPasspointProfile() throws Exception {
         String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITHOUT_PROFILE);
-        assertNull(ConfigBuilder.buildPasspointConfig(
+        assertNull(ConfigParser.parsePasspointConfig(
                 "application/x-wifi-config", configStr.getBytes()));
     }
 }
\ No newline at end of file
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
index 3aed918..7df4fcf 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
@@ -21,7 +21,7 @@
 
 import android.net.wifi.EAPConstants;
 import android.net.wifi.hotspot2.pps.Credential;
-import android.net.wifi.hotspot2.pps.HomeSP;
+import android.net.wifi.hotspot2.pps.HomeSp;
 import android.net.wifi.hotspot2.pps.Policy;
 import android.net.wifi.hotspot2.pps.UpdateParameter;
 import android.os.Parcel;
@@ -50,11 +50,11 @@
      *
      * @return {@link android.net.wifi.hotspot2.pps.HomeSP}
      */
-    private static HomeSP createHomeSp() {
-        HomeSP homeSp = new HomeSP();
+    private static HomeSp createHomeSp() {
+        HomeSp homeSp = new HomeSp();
         homeSp.setFqdn("fqdn");
         homeSp.setFriendlyName("friendly name");
-        homeSp.setRoamingConsortiumOIs(new long[] {0x55, 0x66});
+        homeSp.setRoamingConsortiumOis(new long[] {0x55, 0x66});
         return homeSp;
     }
 
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/omadm/PPSMOParserTest.java b/wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java
similarity index 91%
rename from wifi/tests/src/android/net/wifi/hotspot2/omadm/PPSMOParserTest.java
rename to wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java
index 15de5c7..7cd72f0 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/omadm/PPSMOParserTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java
@@ -19,10 +19,10 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.net.wifi.hotspot2.omadm.PPSMOParser;
+import android.net.wifi.hotspot2.omadm.PpsMoParser;
 import android.net.wifi.hotspot2.PasspointConfiguration;
 import android.net.wifi.hotspot2.pps.Credential;
-import android.net.wifi.hotspot2.pps.HomeSP;
+import android.net.wifi.hotspot2.pps.HomeSp;
 import android.net.wifi.hotspot2.pps.Policy;
 import android.net.wifi.hotspot2.pps.UpdateParameter;
 import android.test.suitebuilder.annotation.SmallTest;
@@ -43,10 +43,10 @@
 import java.util.Map;
 
 /**
- * Unit tests for {@link android.net.wifi.hotspot2.omadm.PPSMOParser}.
+ * Unit tests for {@link android.net.wifi.hotspot2.omadm.PpsMoParser}.
  */
 @SmallTest
-public class PPSMOParserTest {
+public class PpsMoParserTest {
     private static final String VALID_PPS_MO_XML_FILE = "assets/pps/PerProviderSubscription.xml";
     private static final String PPS_MO_XML_FILE_DUPLICATE_HOMESP =
             "assets/pps/PerProviderSubscription_DuplicateHomeSP.xml";
@@ -122,17 +122,17 @@
         config.setUsageLimitUsageTimePeriodInMinutes(99910);
 
         // HomeSP configuration.
-        HomeSP homeSp = new HomeSP();
+        HomeSp homeSp = new HomeSp();
         homeSp.setFriendlyName("Century House");
         homeSp.setFqdn("mi6.co.uk");
-        homeSp.setRoamingConsortiumOIs(new long[] {0x112233L, 0x445566L});
+        homeSp.setRoamingConsortiumOis(new long[] {0x112233L, 0x445566L});
         homeSp.setIconUrl("icon.test.com");
         Map<String, Long> homeNetworkIds = new HashMap<>();
         homeNetworkIds.put("TestSSID", 0x12345678L);
         homeNetworkIds.put("NullHESSID", null);
         homeSp.setHomeNetworkIds(homeNetworkIds);
-        homeSp.setMatchAllOIs(new long[] {0x11223344});
-        homeSp.setMatchAnyOIs(new long[] {0x55667788});
+        homeSp.setMatchAllOis(new long[] {0x11223344});
+        homeSp.setMatchAnyOis(new long[] {0x55667788});
         homeSp.setOtherHomePartners(new String[] {"other.fqdn.com"});
         config.setHomeSp(homeSp);
 
@@ -141,7 +141,7 @@
         credential.setCreationTimeInMs(format.parse("2016-01-01T10:00:00Z").getTime());
         credential.setExpirationTimeInMs(format.parse("2016-02-01T10:00:00Z").getTime());
         credential.setRealm("shaken.stirred.com");
-        credential.setCheckAAAServerCertStatus(true);
+        credential.setCheckAaaServerCertStatus(true);
         Credential.UserCredential userCredential = new Credential.UserCredential();
         userCredential.setUsername("james");
         userCredential.setPassword("Ym9uZDAwNw==");
@@ -209,53 +209,53 @@
     public void parseValidPPSMOTree() throws Exception {
         String ppsMoTree = loadResourceFile(VALID_PPS_MO_XML_FILE);
         PasspointConfiguration expectedConfig = generateConfigurationFromPPSMOTree();
-        PasspointConfiguration actualConfig = PPSMOParser.parseMOText(ppsMoTree);
+        PasspointConfiguration actualConfig = PpsMoParser.parseMoText(ppsMoTree);
         assertTrue(actualConfig.equals(expectedConfig));
     }
 
     @Test
     public void parseNullPPSMOTree() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(null));
+        assertEquals(null, PpsMoParser.parseMoText(null));
     }
 
     @Test
     public void parseEmptyPPSMOTree() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(new String()));
+        assertEquals(null, PpsMoParser.parseMoText(new String()));
     }
 
     @Test
     public void parsePPSMOTreeWithDuplicateHomeSP() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(
+        assertEquals(null, PpsMoParser.parseMoText(
                 loadResourceFile(PPS_MO_XML_FILE_DUPLICATE_HOMESP)));
     }
 
     @Test
     public void parsePPSMOTreeWithDuplicateValue() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(
+        assertEquals(null, PpsMoParser.parseMoText(
                 loadResourceFile(PPS_MO_XML_FILE_DUPLICATE_VALUE)));
     }
 
     @Test
     public void parsePPSMOTreeWithMissingValue() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(
+        assertEquals(null, PpsMoParser.parseMoText(
                 loadResourceFile(PPS_MO_XML_FILE_MISSING_VALUE)));
     }
 
     @Test
     public void parsePPSMOTreeWithMissingName() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(
+        assertEquals(null, PpsMoParser.parseMoText(
                 loadResourceFile(PPS_MO_XML_FILE_MISSING_NAME)));
     }
 
     @Test
     public void parsePPSMOTreeWithInvalidNode() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(
+        assertEquals(null, PpsMoParser.parseMoText(
                 loadResourceFile(PPS_MO_XML_FILE_INVALID_NODE)));
     }
 
     @Test
     public void parsePPSMOTreeWithInvalidName() throws Exception {
-        assertEquals(null, PPSMOParser.parseMOText(
+        assertEquals(null, PpsMoParser.parseMoText(
                 loadResourceFile(PPS_MO_XML_FILE_INVALID_NAME)));
     }
 }
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java b/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java
index 6f68e1c..c7ade00 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java
@@ -59,7 +59,7 @@
         cred.setCreationTimeInMs(123455L);
         cred.setExpirationTimeInMs(2310093L);
         cred.setRealm("realm");
-        cred.setCheckAAAServerCertStatus(true);
+        cred.setCheckAaaServerCertStatus(true);
         cred.setUserCredential(userCred);
         cred.setCertCredential(certCred);
         cred.setSimCredential(simCred);
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSPTest.java b/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java
similarity index 68%
rename from wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSPTest.java
rename to wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java
index 92e94ee..c41c11f 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSPTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java
@@ -30,10 +30,10 @@
 import java.util.Map;
 
 /**
- * Unit tests for {@link android.net.wifi.hotspot2.pps.HomeSP}.
+ * Unit tests for {@link android.net.wifi.hotspot2.pps.HomeSp}.
  */
 @SmallTest
-public class HomeSPTest {
+public class HomeSpTest {
 
     /**
      * Helper function for creating a map of home network IDs for testing.
@@ -48,68 +48,68 @@
     }
 
     /**
-     * Helper function for creating a HomeSP for testing.
+     * Helper function for creating a HomeSp for testing.
      *
-     * @param homeNetworkIds The map of home network IDs associated with HomeSP
-     * @return {@link HomeSP}
+     * @param homeNetworkIds The map of home network IDs associated with HomeSp
+     * @return {@link HomeSp}
      */
-    private static HomeSP createHomeSp(Map<String, Long> homeNetworkIds) {
-        HomeSP homeSp = new HomeSP();
+    private static HomeSp createHomeSp(Map<String, Long> homeNetworkIds) {
+        HomeSp homeSp = new HomeSp();
         homeSp.setFqdn("fqdn");
         homeSp.setFriendlyName("friendly name");
         homeSp.setIconUrl("icon.url");
         homeSp.setHomeNetworkIds(homeNetworkIds);
-        homeSp.setMatchAllOIs(new long[] {0x11L, 0x22L});
-        homeSp.setMatchAnyOIs(new long[] {0x33L, 0x44L});
+        homeSp.setMatchAllOis(new long[] {0x11L, 0x22L});
+        homeSp.setMatchAnyOis(new long[] {0x33L, 0x44L});
         homeSp.setOtherHomePartners(new String[] {"partner1", "partner2"});
-        homeSp.setRoamingConsortiumOIs(new long[] {0x55, 0x66});
+        homeSp.setRoamingConsortiumOis(new long[] {0x55, 0x66});
         return homeSp;
     }
 
     /**
-     * Helper function for creating a HomeSP with home network IDs for testing.
+     * Helper function for creating a HomeSp with home network IDs for testing.
      *
-     * @return {@link HomeSP}
+     * @return {@link HomeSp}
      */
-    private static HomeSP createHomeSpWithHomeNetworkIds() {
+    private static HomeSp createHomeSpWithHomeNetworkIds() {
         return createHomeSp(createHomeNetworkIds());
     }
 
     /**
-     * Helper function for creating a HomeSP without home network IDs for testing.
+     * Helper function for creating a HomeSp without home network IDs for testing.
      *
-     * @return {@link HomeSP}
+     * @return {@link HomeSp}
      */
-    private static HomeSP createHomeSpWithoutHomeNetworkIds() {
+    private static HomeSp createHomeSpWithoutHomeNetworkIds() {
         return createHomeSp(null);
     }
 
     /**
-     * Helper function for verifying HomeSP after parcel write then read.
+     * Helper function for verifying HomeSp after parcel write then read.
      * @param writeHomeSp
      * @throws Exception
      */
-    private static void verifyParcel(HomeSP writeHomeSp) throws Exception {
+    private static void verifyParcel(HomeSp writeHomeSp) throws Exception {
         Parcel parcel = Parcel.obtain();
         writeHomeSp.writeToParcel(parcel, 0);
 
         parcel.setDataPosition(0);    // Rewind data position back to the beginning for read.
-        HomeSP readHomeSp = HomeSP.CREATOR.createFromParcel(parcel);
+        HomeSp readHomeSp = HomeSp.CREATOR.createFromParcel(parcel);
         assertTrue(readHomeSp.equals(writeHomeSp));
     }
 
     /**
-     * Verify parcel read/write for an empty HomeSP.
+     * Verify parcel read/write for an empty HomeSp.
      *
      * @throws Exception
      */
     @Test
-    public void verifyParcelWithEmptyHomeSP() throws Exception {
-        verifyParcel(new HomeSP());
+    public void verifyParcelWithEmptyHomeSp() throws Exception {
+        verifyParcel(new HomeSp());
     }
 
     /**
-     * Verify parcel read/write for a HomeSP containing Home Network IDs.
+     * Verify parcel read/write for a HomeSp containing Home Network IDs.
      *
      * @throws Exception
      */
@@ -119,7 +119,7 @@
     }
 
     /**
-     * Verify parcel read/write for a HomeSP without Home Network IDs.
+     * Verify parcel read/write for a HomeSp without Home Network IDs.
      *
      * @throws Exception
      */
@@ -129,62 +129,62 @@
     }
 
     /**
-     * Verify that a HomeSP is valid when both FQDN and Friendly Name
+     * Verify that a HomeSp is valid when both FQDN and Friendly Name
      * are provided.
      *
      * @throws Exception
      */
     @Test
-    public void validateValidHomeSP() throws Exception {
-        HomeSP homeSp = createHomeSpWithHomeNetworkIds();
+    public void validateValidHomeSp() throws Exception {
+        HomeSp homeSp = createHomeSpWithHomeNetworkIds();
         assertTrue(homeSp.validate());
     }
 
     /**
-     * Verify that a HomeSP is not valid when FQDN is not provided
+     * Verify that a HomeSp is not valid when FQDN is not provided
      *
      * @throws Exception
      */
     @Test
     public void validateHomeSpWithoutFqdn() throws Exception {
-        HomeSP homeSp = createHomeSpWithHomeNetworkIds();
+        HomeSp homeSp = createHomeSpWithHomeNetworkIds();
         homeSp.setFqdn(null);
         assertFalse(homeSp.validate());
     }
 
     /**
-     * Verify that a HomeSP is not valid when Friendly Name is not provided
+     * Verify that a HomeSp is not valid when Friendly Name is not provided
      *
      * @throws Exception
      */
     @Test
     public void validateHomeSpWithoutFriendlyName() throws Exception {
-        HomeSP homeSp = createHomeSpWithHomeNetworkIds();
+        HomeSp homeSp = createHomeSpWithHomeNetworkIds();
         homeSp.setFriendlyName(null);
         assertFalse(homeSp.validate());
     }
 
     /**
-     * Verify that a HomeSP is valid when the optional Home Network IDs are
+     * Verify that a HomeSp is valid when the optional Home Network IDs are
      * not provided.
      *
      * @throws Exception
      */
     @Test
     public void validateHomeSpWithoutHomeNetworkIds() throws Exception {
-        HomeSP homeSp = createHomeSpWithoutHomeNetworkIds();
+        HomeSp homeSp = createHomeSpWithoutHomeNetworkIds();
         assertTrue(homeSp.validate());
     }
 
     /**
-     * Verify that a HomeSP is invalid when the optional Home Network IDs
+     * Verify that a HomeSp is invalid when the optional Home Network IDs
      * contained an invalid SSID (exceeding maximum number of bytes).
      *
      * @throws Exception
      */
     @Test
     public void validateHomeSpWithInvalidHomeNetworkIds() throws Exception {
-        HomeSP homeSp = createHomeSpWithoutHomeNetworkIds();
+        HomeSp homeSp = createHomeSpWithoutHomeNetworkIds();
         // HomeNetworkID with SSID exceeding the maximum length.
         Map<String, Long> homeNetworkIds = new HashMap<>();
         byte[] rawSsidBytes = new byte[33];
@@ -202,8 +202,8 @@
      */
     @Test
     public void validateCopyConstructorFromNullSource() throws Exception {
-        HomeSP copySp = new HomeSP(null);
-        HomeSP defaultSp = new HomeSP();
+        HomeSp copySp = new HomeSp(null);
+        HomeSp defaultSp = new HomeSp();
         assertTrue(copySp.equals(defaultSp));
     }
 
@@ -214,8 +214,8 @@
      */
     @Test
     public void validateCopyConstructorFromValidSource() throws Exception {
-        HomeSP sourceSp = createHomeSpWithHomeNetworkIds();
-        HomeSP copySp = new HomeSP(sourceSp);
+        HomeSp sourceSp = createHomeSpWithHomeNetworkIds();
+        HomeSp copySp = new HomeSp(sourceSp);
         assertTrue(copySp.equals(sourceSp));
     }
 }