зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1102488 - Part 0: Make FxAccountConstants independent of Logger. r=rnewman
--HG-- extra : rebase_source : 5f85ea54b5afa611868c856a1027461d6c711b5f extra : source : 8d1d39582e497c2c47400740304bdc98f0aef0a7
This commit is contained in:
Родитель
52e4b7d489
Коммит
03f38e392c
|
@ -35,13 +35,13 @@ public class FxAccountAgeLockoutHelper {
|
|||
// Otherwise, find out how long it's been since we last failed.
|
||||
long millsecondsSinceLastFailedAgeCheck = elapsedRealtime - ELAPSED_REALTIME_OF_LAST_FAILED_AGE_CHECK;
|
||||
boolean isLockedOut = millsecondsSinceLastFailedAgeCheck < FxAccountConstants.MINIMUM_TIME_TO_WAIT_AFTER_AGE_CHECK_FAILED_IN_MILLISECONDS;
|
||||
FxAccountConstants.pii(LOG_TAG, "Checking if locked out: it's been " + millsecondsSinceLastFailedAgeCheck + "ms " +
|
||||
FxAccountUtils.pii(LOG_TAG, "Checking if locked out: it's been " + millsecondsSinceLastFailedAgeCheck + "ms " +
|
||||
"since last lockout, so " + (isLockedOut ? "yes." : "no."));
|
||||
return isLockedOut;
|
||||
}
|
||||
|
||||
public static synchronized void lockOut(long elapsedRealtime) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Locking out at time: " + elapsedRealtime);
|
||||
FxAccountUtils.pii(LOG_TAG, "Locking out at time: " + elapsedRealtime);
|
||||
ELAPSED_REALTIME_OF_LAST_FAILED_AGE_CHECK = Math.max(elapsedRealtime, ELAPSED_REALTIME_OF_LAST_FAILED_AGE_CHECK);
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ public class FxAccountAgeLockoutHelper {
|
|||
int thisYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
int approximateAge = thisYear - yearOfBirth;
|
||||
boolean oldEnough = approximateAge >= FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Age check " + (oldEnough ? "passes" : "fails") +
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountUtils.pii(LOG_TAG, "Age check " + (oldEnough ? "passes" : "fails") +
|
||||
": age is " + approximateAge + " = " + thisYear + " - " + yearOfBirth);
|
||||
}
|
||||
return oldEnough;
|
||||
|
@ -79,7 +79,7 @@ public class FxAccountAgeLockoutHelper {
|
|||
}
|
||||
if (!Arrays.asList(yearItems).contains(yearText)) {
|
||||
// This should never happen, but let's be careful.
|
||||
FxAccountConstants.pii(LOG_TAG, "Failed age check: year text was not found in item list.");
|
||||
FxAccountUtils.pii(LOG_TAG, "Failed age check: year text was not found in item list.");
|
||||
return false;
|
||||
}
|
||||
Integer yearOfBirth;
|
||||
|
@ -88,7 +88,7 @@ public class FxAccountAgeLockoutHelper {
|
|||
} catch (NumberFormatException e) {
|
||||
// Any non-numbers in the list are ranges (and we say as much to
|
||||
// translators in the resource file), so these people pass the age check.
|
||||
FxAccountConstants.pii(LOG_TAG, "Passed age check: year text was found in item list but was not a number.");
|
||||
FxAccountUtils.pii(LOG_TAG, "Passed age check: year text was found in item list but was not a number.");
|
||||
return true;
|
||||
}
|
||||
return passesAgeCheck(yearOfBirth);
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.concurrent.Executor;
|
|||
import org.json.simple.JSONObject;
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
||||
import org.mozilla.gecko.sync.Utils;
|
||||
import org.mozilla.gecko.sync.net.BaseResource;
|
||||
|
@ -206,7 +205,7 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
|
|||
final RequestDelegate<LoginResponse> delegate) {
|
||||
byte[] quickStretchedPW;
|
||||
try {
|
||||
FxAccountConstants.pii(LOG_TAG, "Trying user provided email: '" + new String(emailUTF8, "UTF-8") + "'" );
|
||||
FxAccountUtils.pii(LOG_TAG, "Trying user provided email: '" + new String(emailUTF8, "UTF-8") + "'" );
|
||||
quickStretchedPW = stretcher.getQuickStretchedPW(emailUTF8);
|
||||
} catch (Exception e) {
|
||||
delegate.handleError(e);
|
||||
|
@ -233,7 +232,7 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
|
|||
};
|
||||
|
||||
Logger.info(LOG_TAG, "Server returned alternate email; retrying login with provided email.");
|
||||
FxAccountConstants.pii(LOG_TAG, "Trying server provided email: '" + alternateEmail + "'" );
|
||||
FxAccountUtils.pii(LOG_TAG, "Trying server provided email: '" + alternateEmail + "'" );
|
||||
|
||||
try {
|
||||
// Nota bene: this is not recursive, since we call the fixed password
|
||||
|
|
|
@ -35,6 +35,16 @@ public class FxAccountUtils {
|
|||
|
||||
public static final int NUMBER_OF_QUICK_STRETCH_ROUNDS = 1000;
|
||||
|
||||
// For extra debugging. Not final so it can be changed from Fennec, or from
|
||||
// an add-on.
|
||||
public static boolean LOG_PERSONAL_INFORMATION = false;
|
||||
|
||||
public static void pii(String tag, String message) {
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
Logger.info(tag, "$$FxA PII$$: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public static String bytes(String string) throws UnsupportedEncodingException {
|
||||
return Utils.byte2Hex(string.getBytes("UTF-8"));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
package org.mozilla.gecko.fxa;
|
||||
|
||||
import org.mozilla.gecko.background.common.GlobalConstants;
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
|
||||
public class FxAccountConstants {
|
||||
public static final String GLOBAL_LOG_TAG = "FxAccounts";
|
||||
|
@ -18,16 +17,6 @@ public class FxAccountConstants {
|
|||
public static final String STAGE_AUTH_SERVER_ENDPOINT = "https://api-accounts.stage.mozaws.net/v1";
|
||||
public static final String STAGE_TOKEN_SERVER_ENDPOINT = "https://token.stage.mozaws.net/1.0/sync/1.5";
|
||||
|
||||
// For extra debugging. Not final so it can be changed from Fennec, or from
|
||||
// an add-on.
|
||||
public static boolean LOG_PERSONAL_INFORMATION = false;
|
||||
|
||||
public static void pii(String tag, String message) {
|
||||
if (LOG_PERSONAL_INFORMATION) {
|
||||
Logger.info(tag, "$$FxA PII$$: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
// You must be at least 14 years old to create a Firefox Account.
|
||||
public static final int MINIMUM_AGE_TO_CREATE_AN_ACCOUNT = 14;
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractAc
|
|||
}
|
||||
|
||||
// For great debugging.
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
fxAccount.dump();
|
||||
}
|
||||
|
||||
|
@ -403,9 +403,9 @@ abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractAc
|
|||
// This sets defaults as well as extracting from extras, so it's not conditional.
|
||||
updateServersFromIntentExtras(getIntent());
|
||||
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Using auth server: " + authServerEndpoint);
|
||||
FxAccountConstants.pii(LOG_TAG, "Using sync server: " + syncServerEndpoint);
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountUtils.pii(LOG_TAG, "Using auth server: " + authServerEndpoint);
|
||||
FxAccountUtils.pii(LOG_TAG, "Using sync server: " + syncServerEndpoint);
|
||||
}
|
||||
|
||||
updateCustomServerView();
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
|
|||
import org.mozilla.gecko.background.fxa.FxAccountClient20;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.background.fxa.PasswordStretcher;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.tasks.FxAccountCreateAccountTask;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
|
@ -250,10 +250,10 @@ public class FxAccountCreateAccountActivity extends FxAccountAbstractSetupActivi
|
|||
? selectedEngines
|
||||
: null;
|
||||
if (FxAccountAgeLockoutHelper.passesAgeCheck(yearEdit.getText().toString(), yearItems)) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Passed age check.");
|
||||
FxAccountUtils.pii(LOG_TAG, "Passed age check.");
|
||||
createAccount(email, password, engines);
|
||||
} else {
|
||||
FxAccountConstants.pii(LOG_TAG, "Failed age check!");
|
||||
FxAccountUtils.pii(LOG_TAG, "Failed age check!");
|
||||
FxAccountAgeLockoutHelper.lockOut(SystemClock.elapsedRealtime());
|
||||
setResult(RESULT_CANCELED);
|
||||
redirectToActivity(FxAccountCreateAccountNotAllowedActivity.class);
|
||||
|
@ -304,7 +304,7 @@ public class FxAccountCreateAccountActivity extends FxAccountAbstractSetupActivi
|
|||
selectedEngines.put("history", checkedItems[INDEX_HISTORY]);
|
||||
selectedEngines.put("tabs", checkedItems[INDEX_TABS]);
|
||||
selectedEngines.put("passwords", checkedItems[INDEX_PASSWORDS]);
|
||||
FxAccountConstants.pii(LOG_TAG, "Updating selectedEngines: " + selectedEngines.toString());
|
||||
FxAccountUtils.pii(LOG_TAG, "Updating selectedEngines: " + selectedEngines.toString());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Locale;
|
|||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountAgeLockoutHelper;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.fxa.FirefoxAccounts;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
|
||||
|
@ -133,7 +134,7 @@ public class FxAccountGetStartedActivity extends AccountAuthenticatorActivity {
|
|||
TextView oldFirefox = (TextView) findViewById(R.id.old_firefox);
|
||||
String text = getResources().getString(R.string.fxaccount_getting_started_old_firefox);
|
||||
final String url = FirefoxAccounts.getOldSyncUpgradeURL(getResources(), Locale.getDefault());
|
||||
FxAccountConstants.pii(LOG_TAG, "Old Firefox url is: " + url); // Don't want to leak locale in particular.
|
||||
FxAccountUtils.pii(LOG_TAG, "Old Firefox url is: " + url); // Don't want to leak locale in particular.
|
||||
ActivityUtils.linkTextView(oldFirefox, text, url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Set;
|
|||
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.background.preferences.PreferenceFragment;
|
||||
import org.mozilla.gecko.fxa.FirefoxAccounts;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
|
@ -145,7 +146,7 @@ public class FxAccountStatusFragment
|
|||
tabsPreference = (CheckBoxPreference) ensureFindPreference("tabs");
|
||||
passwordsPreference = (CheckBoxPreference) ensureFindPreference("passwords");
|
||||
|
||||
if (!FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (!FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
removeDebugButtons();
|
||||
} else {
|
||||
connectDebugButtons();
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClient
|
|||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.background.fxa.PasswordStretcher;
|
||||
import org.mozilla.gecko.fxa.FirefoxAccounts;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
|
||||
import org.mozilla.gecko.fxa.login.Engaged;
|
||||
import org.mozilla.gecko.fxa.login.State;
|
||||
|
@ -156,7 +155,7 @@ public class FxAccountUpdateCredentialsActivity extends FxAccountAbstractSetupAc
|
|||
fxAccount.requestSync(FirefoxAccounts.FORCE);
|
||||
|
||||
// For great debugging.
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
fxAccount.dump();
|
||||
}
|
||||
|
||||
|
|
|
@ -516,14 +516,14 @@ public class AndroidFxAccount {
|
|||
* <b>For debugging only!</b>
|
||||
*/
|
||||
public void dump() {
|
||||
if (!FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (!FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
return;
|
||||
}
|
||||
ExtendedJSONObject o = toJSONObject();
|
||||
ArrayList<String> list = new ArrayList<String>(o.keySet());
|
||||
Collections.sort(list);
|
||||
for (String key : list) {
|
||||
FxAccountConstants.pii(LOG_TAG, key + ": " + o.get(key));
|
||||
FxAccountUtils.pii(LOG_TAG, key + ": " + o.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
package org.mozilla.gecko.fxa.login;
|
||||
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.browserid.BrowserIDKeyPair;
|
||||
import org.mozilla.gecko.browserid.JSONWebTokenUtils;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginStateMachine.ExecuteDelegate;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginTransition.LogMessage;
|
||||
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
||||
|
@ -24,19 +24,19 @@ public class Cohabiting extends TokensAndKeysState {
|
|||
new BaseRequestDelegate<String>(this, delegate) {
|
||||
@Override
|
||||
public void handleSuccess(String certificate) {
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
try {
|
||||
FxAccountConstants.pii(LOG_TAG, "Fetched certificate: " + certificate);
|
||||
FxAccountUtils.pii(LOG_TAG, "Fetched certificate: " + certificate);
|
||||
ExtendedJSONObject c = JSONWebTokenUtils.parseCertificate(certificate);
|
||||
if (c != null) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Header : " + c.getObject("header"));
|
||||
FxAccountConstants.pii(LOG_TAG, "Payload : " + c.getObject("payload"));
|
||||
FxAccountConstants.pii(LOG_TAG, "Signature: " + c.getString("signature"));
|
||||
FxAccountUtils.pii(LOG_TAG, "Header : " + c.getObject("header"));
|
||||
FxAccountUtils.pii(LOG_TAG, "Payload : " + c.getObject("payload"));
|
||||
FxAccountUtils.pii(LOG_TAG, "Signature: " + c.getString("signature"));
|
||||
} else {
|
||||
FxAccountConstants.pii(LOG_TAG, "Could not parse certificate!");
|
||||
FxAccountUtils.pii(LOG_TAG, "Could not parse certificate!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Could not parse certificate!");
|
||||
FxAccountUtils.pii(LOG_TAG, "Could not parse certificate!");
|
||||
}
|
||||
}
|
||||
delegate.handleTransition(new LogMessage("sign succeeded"), new Married(email, uid, sessionToken, kA, kB, keyPair, certificate));
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.security.NoSuchAlgorithmException;
|
|||
import org.mozilla.gecko.background.fxa.FxAccountClient10.TwoKeys;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.browserid.BrowserIDKeyPair;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginStateMachine.ExecuteDelegate;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginTransition.AccountVerified;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginTransition.LocalError;
|
||||
|
@ -61,10 +60,10 @@ public class Engaged extends State {
|
|||
byte[] kB;
|
||||
try {
|
||||
kB = FxAccountUtils.unwrapkB(unwrapkB, result.wrapkB);
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Fetched kA: " + Utils.byte2Hex(result.kA));
|
||||
FxAccountConstants.pii(LOG_TAG, "And wrapkB: " + Utils.byte2Hex(result.wrapkB));
|
||||
FxAccountConstants.pii(LOG_TAG, "Giving kB : " + Utils.byte2Hex(kB));
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountUtils.pii(LOG_TAG, "Fetched kA: " + Utils.byte2Hex(result.kA));
|
||||
FxAccountUtils.pii(LOG_TAG, "And wrapkB: " + Utils.byte2Hex(result.wrapkB));
|
||||
FxAccountUtils.pii(LOG_TAG, "Giving kB : " + Utils.byte2Hex(kB));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
delegate.handleTransition(new RemoteError(e), new Separated(email, uid, verified));
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.json.simple.parser.ParseException;
|
|||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.browserid.BrowserIDKeyPair;
|
||||
import org.mozilla.gecko.browserid.JSONWebTokenUtils;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginStateMachine.ExecuteDelegate;
|
||||
import org.mozilla.gecko.fxa.login.FxAccountLoginTransition.LogMessage;
|
||||
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
||||
|
@ -61,23 +60,23 @@ public class Married extends TokensAndKeysState {
|
|||
// invalid-timestamp errors from the token server.
|
||||
final long expiresAt = JSONWebTokenUtils.DEFAULT_FUTURE_EXPIRES_AT_IN_MILLISECONDS;
|
||||
String assertion = JSONWebTokenUtils.createAssertion(keyPair.getPrivate(), certificate, audience, issuer, null, expiresAt);
|
||||
if (!FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (!FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
return assertion;
|
||||
}
|
||||
|
||||
try {
|
||||
FxAccountConstants.pii(LOG_TAG, "Generated assertion: " + assertion);
|
||||
FxAccountUtils.pii(LOG_TAG, "Generated assertion: " + assertion);
|
||||
ExtendedJSONObject a = JSONWebTokenUtils.parseAssertion(assertion);
|
||||
if (a != null) {
|
||||
FxAccountConstants.pii(LOG_TAG, "aHeader : " + a.getObject("header"));
|
||||
FxAccountConstants.pii(LOG_TAG, "aPayload : " + a.getObject("payload"));
|
||||
FxAccountConstants.pii(LOG_TAG, "aSignature: " + a.getString("signature"));
|
||||
FxAccountUtils.pii(LOG_TAG, "aHeader : " + a.getObject("header"));
|
||||
FxAccountUtils.pii(LOG_TAG, "aPayload : " + a.getObject("payload"));
|
||||
FxAccountUtils.pii(LOG_TAG, "aSignature: " + a.getString("signature"));
|
||||
String certificate = a.getString("certificate");
|
||||
if (certificate != null) {
|
||||
ExtendedJSONObject c = JSONWebTokenUtils.parseCertificate(certificate);
|
||||
FxAccountConstants.pii(LOG_TAG, "cHeader : " + c.getObject("header"));
|
||||
FxAccountConstants.pii(LOG_TAG, "cPayload : " + c.getObject("payload"));
|
||||
FxAccountConstants.pii(LOG_TAG, "cSignature: " + c.getString("signature"));
|
||||
FxAccountUtils.pii(LOG_TAG, "cHeader : " + c.getObject("header"));
|
||||
FxAccountUtils.pii(LOG_TAG, "cPayload : " + c.getObject("payload"));
|
||||
FxAccountUtils.pii(LOG_TAG, "cSignature: " + c.getString("signature"));
|
||||
// Print the relevant timestamps in sorted order with labels.
|
||||
HashMap<Long, String> map = new HashMap<Long, String>();
|
||||
map.put(a.getObject("payload").getLong("iat"), "aiat");
|
||||
|
@ -87,16 +86,16 @@ public class Married extends TokensAndKeysState {
|
|||
ArrayList<Long> values = new ArrayList<Long>(map.keySet());
|
||||
Collections.sort(values);
|
||||
for (Long value : values) {
|
||||
FxAccountConstants.pii(LOG_TAG, map.get(value) + ": " + value);
|
||||
FxAccountUtils.pii(LOG_TAG, map.get(value) + ": " + value);
|
||||
}
|
||||
} else {
|
||||
FxAccountConstants.pii(LOG_TAG, "Could not parse certificate!");
|
||||
FxAccountUtils.pii(LOG_TAG, "Could not parse certificate!");
|
||||
}
|
||||
} else {
|
||||
FxAccountConstants.pii(LOG_TAG, "Could not parse assertion!");
|
||||
FxAccountUtils.pii(LOG_TAG, "Could not parse assertion!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Got exception dumping assertion debug info.");
|
||||
FxAccountUtils.pii(LOG_TAG, "Got exception dumping assertion debug info.");
|
||||
}
|
||||
return assertion;
|
||||
}
|
||||
|
@ -107,8 +106,8 @@ public class Married extends TokensAndKeysState {
|
|||
}
|
||||
|
||||
public String getClientState() {
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Client state: " + this.clientState);
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountUtils.pii(LOG_TAG, "Client state: " + this.clientState);
|
||||
}
|
||||
return this.clientState;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.security.spec.InvalidKeySpecException;
|
||||
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.browserid.BrowserIDKeyPair;
|
||||
import org.mozilla.gecko.browserid.DSACryptoImplementation;
|
||||
import org.mozilla.gecko.browserid.RSACryptoImplementation;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.login.State.StateLabel;
|
||||
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
||||
import org.mozilla.gecko.sync.NonObjectJSONException;
|
||||
|
@ -135,15 +135,15 @@ public class StateFactory {
|
|||
}
|
||||
|
||||
protected static void logMigration(State from, State to) {
|
||||
if (!FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (!FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
FxAccountConstants.pii(LOG_TAG, "V1 persisted state is: " + from.toJSONObject().toJSONString());
|
||||
FxAccountUtils.pii(LOG_TAG, "V1 persisted state is: " + from.toJSONObject().toJSONString());
|
||||
} catch (Exception e) {
|
||||
Logger.warn(LOG_TAG, "Error producing JSON representation of V1 state.", e);
|
||||
}
|
||||
FxAccountConstants.pii(LOG_TAG, "Generated new V2 state: " + to.toJSONObject().toJSONString());
|
||||
FxAccountUtils.pii(LOG_TAG, "Generated new V2 state: " + to.toJSONObject().toJSONString());
|
||||
}
|
||||
|
||||
protected static State migrateV1toV2(StateLabel stateLabel, State state) throws NoSuchAlgorithmException {
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.concurrent.Executor;
|
|||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.fxa.FirefoxAccounts;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
|
||||
|
@ -112,7 +113,7 @@ public class FxAccountUpgradeReceiver extends BroadcastReceiver {
|
|||
try {
|
||||
final AndroidFxAccount fxAccount = new AndroidFxAccount(context, account);
|
||||
// For great debugging.
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
fxAccount.dump();
|
||||
}
|
||||
State state = fxAccount.getState();
|
||||
|
|
|
@ -7,7 +7,7 @@ package org.mozilla.gecko.fxa.sync;
|
|||
import org.mozilla.gecko.BrowserLocaleManager;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.fxa.FxAccountConstants;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.fxa.activities.FxAccountStatusActivity;
|
||||
import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
|
||||
import org.mozilla.gecko.fxa.login.State;
|
||||
|
@ -70,7 +70,7 @@ public class FxAccountNotificationManager {
|
|||
final String title = context.getResources().getString(R.string.fxaccount_sync_sign_in_error_notification_title);
|
||||
final String text = context.getResources().getString(R.string.fxaccount_sync_sign_in_error_notification_text, state.email);
|
||||
Logger.info(LOG_TAG, "State " + state.getStateLabel() + " needs action; offering notification with title: " + title);
|
||||
FxAccountConstants.pii(LOG_TAG, "And text: " + text);
|
||||
FxAccountUtils.pii(LOG_TAG, "And text: " + text);
|
||||
|
||||
final Intent notificationIntent = new Intent(context, FxAccountStatusActivity.class);
|
||||
final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.concurrent.Executors;
|
|||
import org.mozilla.gecko.background.common.log.Logger;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountClient;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountClient20;
|
||||
import org.mozilla.gecko.background.fxa.FxAccountUtils;
|
||||
import org.mozilla.gecko.background.fxa.SkewHandler;
|
||||
import org.mozilla.gecko.browserid.BrowserIDKeyPair;
|
||||
import org.mozilla.gecko.browserid.JSONWebTokenUtils;
|
||||
|
@ -315,7 +316,7 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
|
||||
@Override
|
||||
public void handleSuccess(final TokenServerToken token) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Got token! uid is " + token.uid + " and endpoint is " + token.endpoint + ".");
|
||||
FxAccountUtils.pii(LOG_TAG, "Got token! uid is " + token.uid + " and endpoint is " + token.endpoint + ".");
|
||||
|
||||
if (!didReceiveBackoff) {
|
||||
// We must be OK to touch this token server.
|
||||
|
@ -358,9 +359,9 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
FxAccountGlobalSession globalSession = null;
|
||||
try {
|
||||
final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs, getContext());
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountConstants.pii(LOG_TAG, "Client device name is: '" + clientsDataDelegate.getClientName() + "'.");
|
||||
FxAccountConstants.pii(LOG_TAG, "Client device data last modified: " + clientsDataDelegate.getLastModifiedTimestamp());
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
FxAccountUtils.pii(LOG_TAG, "Client device name is: '" + clientsDataDelegate.getClientName() + "'.");
|
||||
FxAccountUtils.pii(LOG_TAG, "Client device data last modified: " + clientsDataDelegate.getLastModifiedTimestamp());
|
||||
}
|
||||
|
||||
// We compute skew over time using SkewHandler. This yields an unchanging
|
||||
|
@ -444,7 +445,7 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
|
||||
Logger.info(LOG_TAG, "Account last synced at: " + fxAccount.getLastSyncedTimestamp());
|
||||
|
||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||
if (FxAccountUtils.LOG_PERSONAL_INFORMATION) {
|
||||
fxAccount.dump();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче