Bug 746362 - StrictMode violation in saving Sync migration state. r=blassey a=mfinkle
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Thu, 19 Apr 2012 19:16:23 +0200
changeset 95292 4ec92164de7bd178c55bce445d644bde2fb2565a
parent 95279 1d3aea7115d36068c375f00e2d3048f734a4da7b
child 95293 d8a90842487049896570f621ebb18bf2afe4edd5
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, mfinkle
bugs746362
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 746362 - StrictMode violation in saving Sync migration state. r=blassey a=mfinkle
mobile/android/base/ProfileMigrator.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -455,40 +455,40 @@ public class ProfileMigrator {
             final String userName = mSyncSettingsMap.get("services.sync.account");
             final String syncKey = mSyncSettingsMap.get("Mozilla Services Password");
             final String syncPass = mSyncSettingsMap.get("Mozilla Services Encryption Passphrase");
             final String serverURL = mSyncSettingsMap.get("services.sync.serverURL");
             final String clusterURL = mSyncSettingsMap.get("services.sync.clusterURL");
             final String clientName = mSyncSettingsMap.get("services.sync.client.name");
             final String clientGuid = mSyncSettingsMap.get("services.sync.client.GUID");
 
-            if (userName == null || syncKey == null || syncPass == null) {
-                // This isn't going to work. Give up.
-                Log.e(LOGTAG, "Profile has incomplete Sync config. Not migrating.");
-                setMigratedSync();
-                return;
-            }
+            GeckoAppShell.getHandler().post(new Runnable() {
+                public void run() {
+                    if (userName == null || syncKey == null || syncPass == null) {
+                        // This isn't going to work. Give up.
+                        Log.e(LOGTAG, "Profile has incomplete Sync config. Not migrating.");
+                        setMigratedSync();
+                        return;
+                    }
 
-            final SyncAccountParameters params =
-                new SyncAccountParameters(mContext, null,
-                                          userName, syncKey,
-                                          syncPass, serverURL, clusterURL,
-                                          clientName, clientGuid);
+                    final SyncAccountParameters params =
+                        new SyncAccountParameters(mContext, null,
+                                                  userName, syncKey,
+                                                  syncPass, serverURL, clusterURL,
+                                                  clientName, clientGuid);
 
-            new SyncAccounts.CreateSyncAccountTask() {
-                @Override
-                protected void onPostExecute(Account account) {
+                    final Account account = SyncAccounts.createSyncAccount(params);
                     if (account == null) {
                         Log.e(LOGTAG, "Failed to migrate Sync account.");
                     } else {
                         Log.i(LOGTAG, "Migrating Sync account succeeded.");
                     }
                     setMigratedSync();
                 }
-            }.execute(params);
+            });
         }
 
         protected void registerAndRequest() {
             GeckoAppShell.getHandler().post(new Runnable() {
                 public void run() {
                     GeckoAppShell.registerGeckoEventListener("Preferences:Data",
                                                              SyncTask.this);
                     requestValues();
@@ -498,18 +498,22 @@ public class ProfileMigrator {
 
         @Override
         public void run() {
             // Run only if no Sync accounts exist.
             new SyncAccounts.AccountsExistTask() {
                 @Override
                 protected void onPostExecute(Boolean result) {
                     if (result.booleanValue()) {
-                        Log.i(LOGTAG, "Sync account already configured, skipping.");
-                        setMigratedSync();
+                        GeckoAppShell.getHandler().post(new Runnable() {
+                            public void run() {
+                                Log.i(LOGTAG, "Sync account already configured, skipping.");
+                                setMigratedSync();
+                            }
+                        });
                     } else {
                         // No account configured, fire up.
                         registerAndRequest();
                     }
                 }
             }.execute(mContext);
         }
     }