Merge change 23698 into eclair
* changes: suppress syncs until boot is complete
This commit is contained in:
@@ -177,6 +177,7 @@ class SyncManager implements OnAccountsUpdatedListener {
|
|||||||
private BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() {
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (!mFactoryTest) {
|
if (!mFactoryTest) {
|
||||||
|
mBootCompleted = true;
|
||||||
AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
|
AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
|
||||||
mSyncHandler, true /* updateImmediately */);
|
mSyncHandler, true /* updateImmediately */);
|
||||||
}
|
}
|
||||||
@@ -283,6 +284,8 @@ class SyncManager implements OnAccountsUpdatedListener {
|
|||||||
|
|
||||||
private final boolean mFactoryTest;
|
private final boolean mFactoryTest;
|
||||||
|
|
||||||
|
private volatile boolean mBootCompleted = false;
|
||||||
|
|
||||||
private ConnectivityManager getConnectivityManager() {
|
private ConnectivityManager getConnectivityManager() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (mConnManagerDoNotUseDirectly == null) {
|
if (mConnManagerDoNotUseDirectly == null) {
|
||||||
@@ -541,6 +544,13 @@ class SyncManager implements OnAccountsUpdatedListener {
|
|||||||
Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState) {
|
Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState) {
|
||||||
boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE);
|
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 (!isSyncEnabled()) {
|
||||||
if (isLoggable) {
|
if (isLoggable) {
|
||||||
Log.v(TAG, "not syncing because sync is disabled");
|
Log.v(TAG, "not syncing because sync is disabled");
|
||||||
|
|||||||
Reference in New Issue
Block a user