am 8f1e5981: Merge change 26653 into eclair
Merge commit '8f1e598118d612988ffecfa979778e9aab4ece57' into eclair-plus-aosp * commit '8f1e598118d612988ffecfa979778e9aab4ece57': make the SyncManager listen for backgroun data setting changes and do a sync when the setting is enabled
This commit is contained in:
@@ -208,6 +208,15 @@ class SyncManager implements OnAccountsUpdatedListener {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() {
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (getConnectivityManager().getBackgroundDataSetting()) {
|
||||||
|
scheduleSync(null /* account */, null /* authority */, new Bundle(), 0 /* delay */,
|
||||||
|
false /* onlyThoseWithUnknownSyncableState */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public void onAccountsUpdated(Account[] accounts) {
|
public void onAccountsUpdated(Account[] accounts) {
|
||||||
// remember if this was the first time this was called after an update
|
// remember if this was the first time this was called after an update
|
||||||
final boolean justBootedUp = mAccounts == null;
|
final boolean justBootedUp = mAccounts == null;
|
||||||
@@ -351,6 +360,9 @@ class SyncManager implements OnAccountsUpdatedListener {
|
|||||||
intentFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
|
intentFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
|
||||||
context.registerReceiver(mBootCompletedReceiver, intentFilter);
|
context.registerReceiver(mBootCompletedReceiver, intentFilter);
|
||||||
|
|
||||||
|
intentFilter = new IntentFilter(ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED);
|
||||||
|
context.registerReceiver(mBackgroundDataSettingChanged, intentFilter);
|
||||||
|
|
||||||
intentFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
|
intentFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
|
||||||
intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
|
intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
|
||||||
context.registerReceiver(mStorageIntentReceiver, intentFilter);
|
context.registerReceiver(mStorageIntentReceiver, intentFilter);
|
||||||
@@ -687,8 +699,8 @@ class SyncManager implements OnAccountsUpdatedListener {
|
|||||||
if (isLoggable) {
|
if (isLoggable) {
|
||||||
Log.d(TAG, "scheduleSync: sync of " + account + ", " + authority
|
Log.d(TAG, "scheduleSync: sync of " + account + ", " + authority
|
||||||
+ " is not allowed, dropping request");
|
+ " is not allowed, dropping request");
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isLoggable) {
|
if (isLoggable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user