diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index a15f4097967..3e88dc12a3c 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -13,8 +13,6 @@ import org.mozilla.gecko.favicons.Favicons; import org.mozilla.gecko.favicons.OnFaviconLoadedListener; import org.mozilla.gecko.favicons.LoadFaviconTask; import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry; -import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity; -import org.mozilla.gecko.fxa.FirefoxAccounts; import org.mozilla.gecko.gfx.BitmapUtils; import org.mozilla.gecko.gfx.GeckoLayerClient; import org.mozilla.gecko.gfx.ImmutableViewportMetrics; @@ -30,7 +28,6 @@ import org.mozilla.gecko.home.SearchEngine; import org.mozilla.gecko.menu.GeckoMenu; import org.mozilla.gecko.preferences.GeckoPreferences; import org.mozilla.gecko.prompts.Prompt; -import org.mozilla.gecko.sync.setup.SyncAccounts; import org.mozilla.gecko.toolbar.AutocompleteHandler; import org.mozilla.gecko.toolbar.BrowserToolbar; import org.mozilla.gecko.util.Clipboard; @@ -548,8 +545,6 @@ abstract public class BrowserApp extends GeckoApp registerEventListener("Menu:Add"); registerEventListener("Menu:Remove"); registerEventListener("Menu:Update"); - registerEventListener("Accounts:Create"); - registerEventListener("Accounts:Exist"); Distribution.init(this); JavaAddonManager.getInstance().init(getApplicationContext()); @@ -867,8 +862,6 @@ abstract public class BrowserApp extends GeckoApp unregisterEventListener("Menu:Add"); unregisterEventListener("Menu:Remove"); unregisterEventListener("Menu:Update"); - unregisterEventListener("Accounts:Create"); - unregisterEventListener("Accounts:Exist"); if (AppConstants.MOZ_ANDROID_BEAM && Build.VERSION.SDK_INT >= 14) { NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this); @@ -1253,30 +1246,6 @@ abstract public class BrowserApp extends GeckoApp bringToFrontIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS); bringToFrontIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(bringToFrontIntent); - } else if (event.equals("Accounts:Create")) { - // Do exactly the same thing as if you tapped 'Sync' - // in Settings. - final Intent intent = new Intent(getContext(), FxAccountGetStartedActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - getContext().startActivity(intent); - } else if (event.equals("Accounts:Exist")) { - final String kind = message.getString("kind"); - final JSONObject response = new JSONObject(); - - if ("any".equals(kind)) { - response.put("exists", SyncAccounts.syncAccountsExist(getContext()) || - FirefoxAccounts.firefoxAccountsExist(getContext())); - EventDispatcher.sendResponse(message, response); - } else if ("fxa".equals(kind)) { - response.put("exists", FirefoxAccounts.firefoxAccountsExist(getContext())); - EventDispatcher.sendResponse(message, response); - } else if ("sync11".equals(kind)) { - response.put("exists", SyncAccounts.syncAccountsExist(getContext())); - EventDispatcher.sendResponse(message, response); - } else { - response.put("error", "Unknown kind"); - EventDispatcher.sendError(message, response); - } } else { super.handleMessage(event, message); } diff --git a/mobile/android/base/tests/robocop.ini b/mobile/android/base/tests/robocop.ini index 6e692be4a73..8c759569f4f 100644 --- a/mobile/android/base/tests/robocop.ini +++ b/mobile/android/base/tests/robocop.ini @@ -77,7 +77,6 @@ skip-if = processor == "x86" # [testVkbOverlap] # see bug 907274 # Using JavascriptTest -[testAccounts] [testBrowserDiscovery] [testDeviceSearchEngine] [testJNI] diff --git a/mobile/android/base/tests/testAccounts.java b/mobile/android/base/tests/testAccounts.java deleted file mode 100644 index f50be77d425..00000000000 --- a/mobile/android/base/tests/testAccounts.java +++ /dev/null @@ -1,23 +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.tests; - -import android.app.Activity; -import org.mozilla.gecko.*; -import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity; - -public class testAccounts extends JavascriptTest { - public testAccounts() { - super("testAccounts.js"); - } - - @Override - public void testJavascript() throws Exception { - super.testJavascript(); - Activity activity = mSolo.getCurrentActivity(); - System.out.println("Current activity: " + activity); - mAsserter.ok(activity instanceof FxAccountGetStartedActivity, "checking activity", "setup activity launched"); - } -} diff --git a/mobile/android/base/tests/testAccounts.js b/mobile/android/base/tests/testAccounts.js deleted file mode 100644 index 65c027d6ab0..00000000000 --- a/mobile/android/base/tests/testAccounts.js +++ /dev/null @@ -1,24 +0,0 @@ -// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- -/* 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/. */ - -Components.utils.import("resource://gre/modules/Accounts.jsm"); - -add_task(function test_Accounts() { - let syncExists = yield Accounts.syncAccountsExist(); - dump("Sync account exists? " + syncExists + "\n"); - let firefoxExists = yield Accounts.firefoxAccountsExist(); - dump("Firefox account exists? " + firefoxExists + "\n"); - let anyExists = yield Accounts.anySyncAccountsExist(); - dump("Any accounts exist? " + anyExists + "\n"); - - // Only one account should exist. - do_check_true(!syncExists || !firefoxExists); - do_check_eq(anyExists, firefoxExists || syncExists); - - dump("Launching setup.\n"); - Accounts.launchSetup(); -}); - -run_next_test(); diff --git a/mobile/android/modules/Accounts.jsm b/mobile/android/modules/Accounts.jsm deleted file mode 100644 index f5d9cd381b5..00000000000 --- a/mobile/android/modules/Accounts.jsm +++ /dev/null @@ -1,76 +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/. */ - -"use strict"; - -this.EXPORTED_SYMBOLS = ["Accounts"]; - -const { utils: Cu } = Components; - -Cu.import("resource://gre/modules/Messaging.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/Promise.jsm"); - -/** - * A promise-based API for querying the existence of Sync accounts, - * and accessing the Sync setup wizard. - * - * Usage: - * - * Cu.import("resource://gre/modules/Accounts.jsm"); - * Accounts.anySyncAccountsExist().then( - * (exist) => { - * console.log("Accounts exist? " + exist); - * if (!exist) { - * Accounts.launchSetup(); - * } - * }, - * (err) => { - * console.log("We failed so hard."); - * } - * ); - */ -let Accounts = Object.freeze({ - _accountsExist: function (kind) { - let deferred = Promise.defer(); - - sendMessageToJava({ - type: "Accounts:Exist", - kind: kind, - }, (data, error) => { - if (error) { - deferred.reject(error); - } else { - deferred.resolve(JSON.parse(data).exists); - } - }); - - return deferred.promise; - }, - - firefoxAccountsExist: function () { - return this._accountsExist("fxa"); - }, - - syncAccountsExist: function () { - return this._accountsExist("sync11"); - }, - - anySyncAccountsExist: function () { - return this._accountsExist("any"); - }, - - /** - * Fire-and-forget: open the Firefox accounts activity, which - * will be the Getting Started screen if FxA isn't yet set up. - * - * There is no return value from this method. - */ - launchSetup: function () { - sendMessageToJava({ - type: "Accounts:Create", - }); - }, -}); - diff --git a/mobile/android/modules/moz.build b/mobile/android/modules/moz.build index 2720d0007df..18296e5bc2d 100644 --- a/mobile/android/modules/moz.build +++ b/mobile/android/modules/moz.build @@ -5,7 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_JS_MODULES += [ - 'Accounts.jsm', 'ContactService.jsm', 'HelperApps.jsm', 'Home.jsm',