Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2ecb683 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am 38796fe1: Merge "Fix sync problems when setting up a new user and account" into jb-mr1-dev

* commit '38796fe1':
  Fix sync problems when setting up a new user and account
parents 2bbc3257 38796fe1
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -203,6 +203,12 @@ public class SyncManager implements OnAccountsUpdateListener {
        }
    };

    private BroadcastReceiver mAccountsUpdatedReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            onAccountsUpdated(null);
        }
    };

    private final PowerManager mPowerManager;

    // Use this as a random offset to seed all periodic syncs
@@ -456,8 +462,11 @@ public class SyncManager implements OnAccountsUpdateListener {
        });

        if (!factoryTest) {
            AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
                mSyncHandler, false /* updateImmediately */);
            // Register for account list updates for all users
            mContext.registerReceiverAsUser(mAccountsUpdatedReceiver,
                    UserHandle.ALL,
                    new IntentFilter(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION),
                    null, null);
            // do this synchronously to ensure we have the accounts before this call returns
            onAccountsUpdated(null);
        }