Bug 1220892 - Part 3: Remove Task sub-classes. r=mcomella
authorNick Alexander <nalexander@mozilla.com>
Mon, 30 Nov 2015 15:47:50 -0800
changeset 275227 61f2a1360c6d2556ada47b4dc68eeec16f7919b4
parent 275226 d2be8686105daf21da88db6bf163bad2eba0c3e2
child 275228 f659e1c2d182ae4194d5a57706e106d4ec6a4a35
push id16521
push usernalexander@mozilla.com
push dateWed, 02 Dec 2015 23:24:59 +0000
treeherderfx-team@675689351241 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1220892
milestone45.0a1
Bug 1220892 - Part 3: Remove Task sub-classes. r=mcomella
mobile/android/base/android-services.mozbuild
mobile/android/base/home/RemoteTabsStaticFragment.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCodeResender.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCreateAccountTask.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSetupTask.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSignInTask.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountUnlockCodeResender.java
--- a/mobile/android/base/android-services.mozbuild
+++ b/mobile/android/base/android-services.mozbuild
@@ -890,21 +890,16 @@ sync_java_files = [TOPSRCDIR + '/mobile/
     'fxa/sync/FxAccountProfileService.java',
     'fxa/sync/FxAccountSchedulePolicy.java',
     'fxa/sync/FxAccountSyncAdapter.java',
     'fxa/sync/FxAccountSyncDelegate.java',
     'fxa/sync/FxAccountSyncService.java',
     'fxa/sync/FxAccountSyncStatusHelper.java',
     'fxa/sync/SchedulePolicy.java',
     'fxa/SyncStatusListener.java',
-    'fxa/tasks/FxAccountCodeResender.java',
-    'fxa/tasks/FxAccountCreateAccountTask.java',
-    'fxa/tasks/FxAccountSetupTask.java',
-    'fxa/tasks/FxAccountSignInTask.java',
-    'fxa/tasks/FxAccountUnlockCodeResender.java',
     'sync/AlreadySyncingException.java',
     'sync/BackoffHandler.java',
     'sync/BadRequiredFieldJSONException.java',
     'sync/CollectionKeys.java',
     'sync/CommandProcessor.java',
     'sync/CommandRunner.java',
     'sync/config/AccountPickler.java',
     'sync/config/activities/SelectEnginesActivity.java',
--- a/mobile/android/base/home/RemoteTabsStaticFragment.java
+++ b/mobile/android/base/home/RemoteTabsStaticFragment.java
@@ -102,18 +102,19 @@ public class RemoteTabsStaticFragment ex
             final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_GET_STARTED);
             startActivity(intent);
         } else if (id == R.id.remote_tabs_setup_old_sync_link) {
             final String url = FirefoxAccounts.getOldSyncUpgradeURL(getResources(), Locale.getDefault());
             // Don't allow switch-to-tab.
             final EnumSet<OnUrlOpenListener.Flags> flags = EnumSet.noneOf(OnUrlOpenListener.Flags.class);
             mUrlOpenListener.onUrlOpen(url, flags);
         } else if (id == R.id.remote_tabs_needs_verification_resend_email) {
-            // Send a fresh email; this displays a toast, so the user gets feedback.
-            FirefoxAccounts.resendVerificationEmail(getActivity());
+            final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_CONFIRM_ACCOUNT);
+            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            startActivity(intent);
         } else if (id == R.id.remote_tabs_needs_verification_help) {
             // Don't allow switch-to-tab.
             final EnumSet<OnUrlOpenListener.Flags> flags = EnumSet.noneOf(OnUrlOpenListener.Flags.class);
             mUrlOpenListener.onUrlOpen(CONFIRM_ACCOUNT_SUPPORT_URL, flags);
         } else if (id == R.id.remote_tabs_needs_password_sign_in) {
             final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_UPDATE_CREDENTIALS);
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             startActivity(intent);
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java
@@ -12,26 +12,24 @@ import java.util.concurrent.CountDownLat
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.background.common.log.Logger;
 import org.mozilla.gecko.fxa.authenticator.AccountPickler;
 import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
 import org.mozilla.gecko.fxa.login.State;
 import org.mozilla.gecko.fxa.sync.FxAccountSyncAdapter;
 import org.mozilla.gecko.fxa.sync.FxAccountSyncStatusHelper;
-import org.mozilla.gecko.fxa.tasks.FxAccountCodeResender;
 import org.mozilla.gecko.sync.ThreadPool;
 import org.mozilla.gecko.sync.Utils;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Resources;
-import android.os.AsyncTask;
 import android.os.Bundle;
 
 /**
  * Simple public accessors for Firefox account objects.
  */
 public class FirefoxAccounts {
   private static final String LOG_TAG = FirefoxAccounts.class.getSimpleName();
 
@@ -298,31 +296,9 @@ public class FirefoxAccounts {
   }
 
   public static String getOldSyncUpgradeURL(final Resources res, final Locale locale) {
     final String VERSION = AppConstants.MOZ_APP_VERSION;
     final String OS = AppConstants.OS_TARGET;
     final String LOCALE = Utils.getLanguageTag(locale);
     return res.getString(R.string.fxaccount_link_old_firefox, VERSION, OS, LOCALE);
   }
-
-  /**
-   * Resends the account verification email, and displays an appropriate
-   * toast on both send success and failure. Note that because the underlying implementation
-   * uses {@link AsyncTask}, the provided context must be UI-capable, and this
-   * method called from the UI thread (see
-   * {@link org.mozilla.gecko.fxa.tasks.FxAccountCodeResender#resendCode(Context, AndroidFxAccount)}
-   * for more).
-   *
-   * @param context a UI-capable Android context.
-   * @return true if an account exists, false otherwise.
-   */
-  public static boolean resendVerificationEmail(final Context context) {
-    final Account account = getFirefoxAccount(context);
-    if (account == null) {
-      return false;
-    }
-
-    final AndroidFxAccount fxAccount = new AndroidFxAccount(context, account);
-    FxAccountCodeResender.resendCode(context, fxAccount);
-    return true;
-  }
 }
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java
@@ -1,74 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.fxa.activities;
 
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.mozilla.gecko.AppConstants;
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
-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.background.fxa.QuickPasswordStretcher;
-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;
-import org.mozilla.gecko.fxa.tasks.FxAccountSetupTask.ProgressDisplay;
-import org.mozilla.gecko.fxa.tasks.FxAccountUnlockCodeResender;
-import org.mozilla.gecko.sync.ExtendedJSONObject;
-import org.mozilla.gecko.sync.SyncConfiguration;
-import org.mozilla.gecko.sync.Utils;
-import org.mozilla.gecko.sync.setup.Constants;
-import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
-import org.mozilla.gecko.util.ColorUtils;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.animation.LayoutTransition;
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.text.Editable;
-import android.text.Spannable;
-import android.text.TextWatcher;
-import android.text.method.LinkMovementMethod;
-import android.text.method.PasswordTransformationMethod;
-import android.text.method.SingleLineTransformationMethod;
-import android.text.style.ClickableSpan;
-import android.util.Patterns;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnFocusChangeListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.TextView.OnEditorActionListener;
-
-abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractActivity implements ProgressDisplay {
+abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractActivity {
   public static final String EXTRA_EMAIL = "email";
   public static final String EXTRA_PASSWORD = "password";
   public static final String EXTRA_PASSWORD_SHOWN = "password_shown";
   public static final String EXTRA_YEAR = "year";
   public static final String EXTRA_MONTH = "month";
   public static final String EXTRA_DAY = "day";
   public static final String EXTRA_EXTRAS = "extras";
 
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java
@@ -33,17 +33,16 @@ import org.mozilla.gecko.background.fxa.
 import org.mozilla.gecko.background.preferences.PreferenceFragment;
 import org.mozilla.gecko.fxa.FirefoxAccounts;
 import org.mozilla.gecko.fxa.FxAccountConstants;
 import org.mozilla.gecko.fxa.SyncStatusListener;
 import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
 import org.mozilla.gecko.fxa.login.Married;
 import org.mozilla.gecko.fxa.login.State;
 import org.mozilla.gecko.fxa.sync.FxAccountSyncStatusHelper;
-import org.mozilla.gecko.fxa.tasks.FxAccountCodeResender;
 import org.mozilla.gecko.sync.ExtendedJSONObject;
 import org.mozilla.gecko.sync.SharedPreferencesClientsDataDelegate;
 import org.mozilla.gecko.sync.SyncConfiguration;
 import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import java.util.Calendar;
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCodeResender.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.fxa.tasks;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.background.fxa.FxAccountClient;
-import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
-import org.mozilla.gecko.background.fxa.FxAccountClient20;
-import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException;
-import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
-import org.mozilla.gecko.fxa.login.Engaged;
-
-import android.content.Context;
-import android.os.AsyncTask;
-import android.widget.Toast;
-
-/**
- * A helper class that provides a simple interface for requesting
- * a Firefox Account verification email to be resent.
- */
-public class FxAccountCodeResender {
-  private static final String LOG_TAG = FxAccountCodeResender.class.getSimpleName();
-
-  private static class FxAccountResendCodeTask extends FxAccountSetupTask<Void> {
-    protected static final String LOG_TAG = FxAccountResendCodeTask.class.getSimpleName();
-
-    protected final byte[] sessionToken;
-
-    public FxAccountResendCodeTask(Context context, byte[] sessionToken, FxAccountClient client, RequestDelegate<Void> delegate) {
-      super(context, null, client, null, delegate);
-      this.sessionToken = sessionToken;
-    }
-
-    @Override
-    protected InnerRequestDelegate<Void> doInBackground(Void... arg0) {
-      try {
-        client.resendCode(sessionToken, innerDelegate);
-        latch.await();
-        return innerDelegate;
-      } catch (Exception e) {
-        Logger.error(LOG_TAG, "Got exception signing in.", e);
-        delegate.handleError(e);
-      }
-      return null;
-    }
-  }
-
-  private static class ResendCodeDelegate implements RequestDelegate<Void> {
-    public final Context context;
-
-    public ResendCodeDelegate(Context context) {
-      this.context = context;
-    }
-
-    @Override
-    public void handleError(Exception e) {
-      Logger.warn(LOG_TAG, "Got exception requesting fresh confirmation link; ignoring.", e);
-      Toast.makeText(context, R.string.fxaccount_confirm_account_verification_link_not_sent, Toast.LENGTH_LONG).show();
-    }
-
-    @Override
-    public void handleFailure(FxAccountClientRemoteException e) {
-      handleError(e);
-    }
-
-    @Override
-    public void handleSuccess(Void result) {
-      Toast.makeText(context, R.string.fxaccount_confirm_account_verification_link_sent, Toast.LENGTH_SHORT).show();
-    }
-  }
-
-  /**
-   * Resends the account verification email, and displays an appropriate
-   * toast on both send success and failure. Note that because the underlying implementation
-   * uses {@link AsyncTask}, the provided context must be UI-capable and
-   * this method called from the UI thread.
-   *
-   * Note that it may actually be possible to run this (and the {@link AsyncTask}) method
-   * from a background thread - but this hasn't been tested.
-   *
-   * @param context A UI-capable Android context.
-   * @param fxAccount The Firefox Account to resend the code to.
-   */
-  public static void resendCode(Context context, AndroidFxAccount fxAccount) {
-    RequestDelegate<Void> delegate = new ResendCodeDelegate(context);
-
-    byte[] sessionToken;
-    try {
-      sessionToken = ((Engaged) fxAccount.getState()).getSessionToken();
-    } catch (Exception e) {
-      delegate.handleError(e);
-      return;
-    }
-    if (sessionToken == null) {
-      delegate.handleError(new IllegalStateException("sessionToken should not be null"));
-      return;
-    }
-
-    Executor executor = Executors.newSingleThreadExecutor();
-    FxAccountClient client = new FxAccountClient20(fxAccount.getAccountServerURI(), executor);
-    new FxAccountResendCodeTask(context, sessionToken, client, delegate).execute();
-  }
-}
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCreateAccountTask.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.fxa.tasks;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
-
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.background.fxa.FxAccountClient;
-import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
-import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse;
-import org.mozilla.gecko.background.fxa.PasswordStretcher;
-
-import android.content.Context;
-
-public class FxAccountCreateAccountTask extends FxAccountSetupTask<LoginResponse> {
-  private static final String LOG_TAG = FxAccountCreateAccountTask.class.getSimpleName();
-
-  protected final byte[] emailUTF8;
-  protected final PasswordStretcher passwordStretcher;
-
-  public FxAccountCreateAccountTask(Context context, ProgressDisplay progressDisplay, String email, PasswordStretcher passwordStretcher, FxAccountClient client, Map<String, String> queryParameters, RequestDelegate<LoginResponse> delegate) throws UnsupportedEncodingException {
-    super(context, progressDisplay, client, queryParameters, delegate);
-    this.emailUTF8 = email.getBytes("UTF-8");
-    this.passwordStretcher = passwordStretcher;
-  }
-
-  @Override
-  protected InnerRequestDelegate<LoginResponse> doInBackground(Void... arg0) {
-    try {
-      client.createAccountAndGetKeys(emailUTF8, passwordStretcher, queryParameters, innerDelegate);
-      latch.await();
-      return innerDelegate;
-    } catch (Exception e) {
-      Logger.error(LOG_TAG, "Got exception logging in.", e);
-      delegate.handleError(e);
-    }
-    return null;
-  }
-}
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSetupTask.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.fxa.tasks;
-
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.background.fxa.FxAccountClient;
-import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
-import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException;
-import org.mozilla.gecko.fxa.tasks.FxAccountSetupTask.InnerRequestDelegate;
-
-import android.content.Context;
-import android.os.AsyncTask;
-
-/**
- * An <code>AsyncTask</code> wrapper around signing up for, and signing in to, a
- * Firefox Account.
- * <p>
- * It's strange to add explicit blocking to callback-threading code, but we do
- * it here to take advantage of Android's built in support for background work.
- * We really want to avoid making a threading mistake that brings down the whole
- * process.
- */
-public abstract class FxAccountSetupTask<T> extends AsyncTask<Void, Void, InnerRequestDelegate<T>> {
-  private static final String LOG_TAG = FxAccountSetupTask.class.getSimpleName();
-
-  public interface ProgressDisplay {
-    public void showProgress();
-    public void dismissProgress();
-  }
-
-  protected final Context context;
-  protected final FxAccountClient client;
-  protected final ProgressDisplay progressDisplay;
-
-  // Initialized lazily.
-  protected byte[] quickStretchedPW;
-
-  // AsyncTask's are one-time-use, so final members are fine.
-  protected final CountDownLatch latch = new CountDownLatch(1);
-  protected final InnerRequestDelegate<T> innerDelegate = new InnerRequestDelegate<T>(latch);
-
-  protected final Map<String, String> queryParameters;
-
-  protected final RequestDelegate<T> delegate;
-
-  public FxAccountSetupTask(Context context, ProgressDisplay progressDisplay, FxAccountClient client, Map<String, String> queryParameters, RequestDelegate<T> delegate) {
-    this.context = context;
-    this.client = client;
-    this.delegate = delegate;
-    this.progressDisplay = progressDisplay;
-    this.queryParameters = queryParameters;
-  }
-
-  @Override
-  protected void onPreExecute() {
-    if (progressDisplay != null) {
-      progressDisplay.showProgress();
-    }
-  }
-
-  @Override
-  protected void onPostExecute(InnerRequestDelegate<T> result) {
-    if (progressDisplay != null) {
-      progressDisplay.dismissProgress();
-    }
-
-    // We are on the UI thread, and need to invoke these callbacks here to allow UI updating.
-    if (innerDelegate.failure != null) {
-      delegate.handleFailure(innerDelegate.failure);
-    } else if (innerDelegate.exception != null) {
-      delegate.handleError(innerDelegate.exception);
-    } else {
-      delegate.handleSuccess(result.response);
-    }
-  }
-
-  @Override
-  protected void onCancelled(InnerRequestDelegate<T> result) {
-    if (progressDisplay != null) {
-      progressDisplay.dismissProgress();
-    }
-    delegate.handleError(new IllegalStateException("Task was cancelled."));
-  }
-
-  protected static class InnerRequestDelegate<T> implements RequestDelegate<T> {
-    protected final CountDownLatch latch;
-    public T response;
-    public Exception exception;
-    public FxAccountClientRemoteException failure;
-
-    protected InnerRequestDelegate(CountDownLatch latch) {
-      this.latch = latch;
-    }
-
-    @Override
-    public void handleError(Exception e) {
-      Logger.error(LOG_TAG, "Got exception.");
-      this.exception = e;
-      latch.countDown();
-    }
-
-    @Override
-    public void handleFailure(FxAccountClientRemoteException e) {
-      Logger.warn(LOG_TAG, "Got failure.");
-      this.failure = e;
-      latch.countDown();
-    }
-
-    @Override
-    public void handleSuccess(T result) {
-      Logger.info(LOG_TAG, "Got success.");
-      this.response = result;
-      latch.countDown();
-    }
-  }
-}
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSignInTask.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.fxa.tasks;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
-
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.background.fxa.FxAccountClient;
-import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
-import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse;
-import org.mozilla.gecko.background.fxa.PasswordStretcher;
-
-import android.content.Context;
-
-public class FxAccountSignInTask extends FxAccountSetupTask<LoginResponse> {
-  protected static final String LOG_TAG = FxAccountSignInTask.class.getSimpleName();
-
-  protected final byte[] emailUTF8;
-  protected final PasswordStretcher passwordStretcher;
-
-  public FxAccountSignInTask(Context context, ProgressDisplay progressDisplay, String email, PasswordStretcher passwordStretcher, FxAccountClient client, Map<String, String> queryParameters, RequestDelegate<LoginResponse> delegate) throws UnsupportedEncodingException {
-    super(context, progressDisplay, client, queryParameters, delegate);
-    this.emailUTF8 = email.getBytes("UTF-8");
-    this.passwordStretcher = passwordStretcher;
-  }
-
-  @Override
-  protected InnerRequestDelegate<LoginResponse> doInBackground(Void... arg0) {
-    try {
-      client.loginAndGetKeys(emailUTF8, passwordStretcher, queryParameters, innerDelegate);
-      latch.await();
-      return innerDelegate;
-    } catch (Exception e) {
-      Logger.error(LOG_TAG, "Got exception signing in.", e);
-      delegate.handleError(e);
-    }
-    return null;
-  }
-}
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountUnlockCodeResender.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.fxa.tasks;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.background.fxa.FxAccountClient;
-import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
-import org.mozilla.gecko.background.fxa.FxAccountClient20;
-import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException;
-
-import android.content.Context;
-import android.os.AsyncTask;
-import android.widget.Toast;
-
-/**
- * A helper class that provides a simple interface for requesting a Firefox
- * Account unlock account email be (re)-sent.
- */
-public class FxAccountUnlockCodeResender {
-  private static final String LOG_TAG = FxAccountUnlockCodeResender.class.getSimpleName();
-
-  private static class FxAccountUnlockCodeTask extends FxAccountSetupTask<Void> {
-    protected static final String LOG_TAG = FxAccountUnlockCodeTask.class.getSimpleName();
-
-    protected final byte[] emailUTF8;
-
-    public FxAccountUnlockCodeTask(Context context, byte[] emailUTF8, FxAccountClient client, RequestDelegate<Void> delegate) {
-      super(context, null, client, null, delegate);
-      this.emailUTF8 = emailUTF8;
-    }
-
-    @Override
-    protected InnerRequestDelegate<Void> doInBackground(Void... arg0) {
-      try {
-        client.resendUnlockCode(emailUTF8, innerDelegate);
-        latch.await();
-        return innerDelegate;
-      } catch (Exception e) {
-        Logger.error(LOG_TAG, "Got exception signing in.", e);
-        delegate.handleError(e);
-      }
-      return null;
-    }
-  }
-
-  private static class ResendUnlockCodeDelegate implements RequestDelegate<Void> {
-    public final Context context;
-
-    public ResendUnlockCodeDelegate(Context context) {
-      this.context = context;
-    }
-
-    @Override
-    public void handleError(Exception e) {
-      Logger.warn(LOG_TAG, "Got exception requesting fresh unlock code; ignoring.", e);
-      Toast.makeText(context, R.string.fxaccount_unlock_code_not_sent, Toast.LENGTH_LONG).show();
-    }
-
-    @Override
-    public void handleFailure(FxAccountClientRemoteException e) {
-      handleError(e);
-    }
-
-    @Override
-    public void handleSuccess(Void result) {
-      Toast.makeText(context, R.string.fxaccount_unlock_code_sent, Toast.LENGTH_SHORT).show();
-    }
-  }
-
-  /**
-   * Resends the account unlock email, and displays an appropriate toast on both
-   * send success and failure. Note that because the underlying implementation
-   * uses {@link AsyncTask}, the provided context must be UI-capable and this
-   * method called from the UI thread.
-   *
-   * Note that it may actually be possible to run this (and the
-   * {@link AsyncTask}) method from a background thread - but this hasn't been
-   * tested.
-   *
-   * @param context
-   *          A UI-capable Android context.
-   * @param authServerURI
-   *          to send request to.
-   * @param emailUTF8
-   *          bytes of email address identifying account; null indicates a local failure.
-   */
-  public static void resendUnlockCode(Context context, String authServerURI, byte[] emailUTF8) {
-    RequestDelegate<Void> delegate = new ResendUnlockCodeDelegate(context);
-
-    if (emailUTF8 == null) {
-      delegate.handleError(new IllegalArgumentException("emailUTF8 must not be null"));
-      return;
-    }
-
-    final Executor executor = Executors.newSingleThreadExecutor();
-    final FxAccountClient client = new FxAccountClient20(authServerURI, executor);
-    new FxAccountUnlockCodeTask(context, emailUTF8, client, delegate).execute();
-  }
-}