suppress syncs until boot is complete

This commit is contained in:
Fred Quintana
2009-09-02 15:20:23 -07:00
parent 29dab8278a
commit 4f9cfc5c52

View File

@@ -177,6 +177,7 @@ class SyncManager implements OnAccountsUpdatedListener {
private BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (!mFactoryTest) {
mBootCompleted = true;
AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
mSyncHandler, true /* updateImmediately */);
}
@@ -283,6 +284,8 @@ class SyncManager implements OnAccountsUpdatedListener {
private final boolean mFactoryTest;
private volatile boolean mBootCompleted = false;
private ConnectivityManager getConnectivityManager() {
synchronized (this) {
if (mConnManagerDoNotUseDirectly == null) {
@@ -541,6 +544,13 @@ class SyncManager implements OnAccountsUpdatedListener {
Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState) {
boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE);
if (!mBootCompleted) {
if (isLoggable) {
Log.v(TAG, "suppressing scheduleSync() since boot hasn't completed");
}
return;
}
if (!isSyncEnabled()) {
if (isLoggable) {
Log.v(TAG, "not syncing because sync is disabled");