Bug 1231549 - Set default profile endpoint server URI for Firefox Accounts not created via the web flow. r=nalexander

This commit is contained in:
dlim 2016-02-23 13:03:33 -08:00
parent 8b8d966746
commit cfd73d0d46

View File

@ -293,18 +293,29 @@ public class AndroidFxAccount {
}
public String getProfileServerURI() {
return accountManager.getUserData(account, ACCOUNT_KEY_PROFILE_SERVER);
String profileURI = accountManager.getUserData(account, ACCOUNT_KEY_PROFILE_SERVER);
if (profileURI == null) {
if (isStaging()) {
return FxAccountConstants.STAGE_PROFILE_SERVER_ENDPOINT;
}
return FxAccountConstants.DEFAULT_PROFILE_SERVER_ENDPOINT;
}
return profileURI;
}
public String getOAuthServerURI() {
// Allow testing against stage.
if (FxAccountConstants.STAGE_AUTH_SERVER_ENDPOINT.equals(getAccountServerURI())) {
if (isStaging()) {
return FxAccountConstants.STAGE_OAUTH_SERVER_ENDPOINT;
} else {
return FxAccountConstants.DEFAULT_OAUTH_SERVER_ENDPOINT;
}
}
private boolean isStaging() {
return FxAccountConstants.STAGE_AUTH_SERVER_ENDPOINT.equals(getAccountServerURI());
}
private String constructPrefsPath(String product, long version, String extra) throws GeneralSecurityException, UnsupportedEncodingException {
String profile = getProfile();
String username = account.name;