@Override public void handleFailure(FxAccountClientRemoteException e) { if (e.isUpgradeRequired()) { Logger.error( LOG_TAG, "Got upgrade required from remote server; transitioning Firefox Account to Doghouse state."); final State state = fxAccount.getState(); fxAccount.setState(state.makeDoghouseState()); // The status activity will say that the user needs to upgrade. redirectToActivity(FxAccountStatusActivity.class); return; } showRemoteError(e, R.string.fxaccount_update_credentials_unknown_error); }
@Override public boolean onPreferenceClick(Preference preference) { final String key = preference.getKey(); if ("debug_refresh".equals(key)) { Logger.info(LOG_TAG, "Refreshing."); refresh(); } else if ("debug_dump".equals(key)) { fxAccount.dump(); } else if ("debug_force_sync".equals(key)) { Logger.info(LOG_TAG, "Force syncing."); fxAccount.requestSync(FirefoxAccounts.FORCE); // No sense refreshing, since the sync will complete in the future. } else if ("debug_forget_certificate".equals(key)) { State state = fxAccount.getState(); try { Married married = (Married) state; Logger.info(LOG_TAG, "Moving to Cohabiting state: Forgetting certificate."); fxAccount.setState(married.makeCohabitingState()); refresh(); } catch (ClassCastException e) { Logger.info(LOG_TAG, "Not in Married state; can't forget certificate."); // Ignore. } } else if ("debug_invalidate_certificate".equals(key)) { State state = fxAccount.getState(); try { Married married = (Married) state; Logger.info(LOG_TAG, "Invalidating certificate."); fxAccount.setState(married.makeCohabitingState().withCertificate("INVALID CERTIFICATE")); refresh(); } catch (ClassCastException e) { Logger.info(LOG_TAG, "Not in Married state; can't invalidate certificate."); // Ignore. } } else if ("debug_require_password".equals(key)) { Logger.info(LOG_TAG, "Moving to Separated state: Forgetting password."); State state = fxAccount.getState(); fxAccount.setState(state.makeSeparatedState()); refresh(); } else if ("debug_require_upgrade".equals(key)) { Logger.info(LOG_TAG, "Moving to Doghouse state: Requiring upgrade."); State state = fxAccount.getState(); fxAccount.setState(state.makeDoghouseState()); refresh(); } else if ("debug_migrated_from_sync11".equals(key)) { Logger.info(LOG_TAG, "Moving to MigratedFromSync11 state: Requiring password."); State state = fxAccount.getState(); fxAccount.setState(state.makeMigratedFromSync11State(null)); refresh(); } else if ("debug_make_account_stage".equals(key)) { Logger.info( LOG_TAG, "Moving Account endpoints, in place, to stage. Deleting Sync and RL prefs and requiring password."); fxAccount.unsafeTransitionToStageEndpoints(); refresh(); } else if ("debug_make_account_default".equals(key)) { Logger.info( LOG_TAG, "Moving Account endpoints, in place, to default (production). Deleting Sync and RL prefs and requiring password."); fxAccount.unsafeTransitionToDefaultEndpoints(); refresh(); } else { return false; } return true; }