Skip to content

Commit b5f2dfb

Browse files
fredquintanaAndroid (Google) Code Review
authored andcommitted
Merge "By default ICS allows two syncs to run in parallel. Make it only do one at a time for devices that don't have much RAM as defined by the call ActivityManager.isLargeRAM()" into ics-mr1
2 parents 3124e6f + 33e4469 commit b5f2dfb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/java/android/content/SyncManager.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.accounts.Account;
2525
import android.accounts.AccountManager;
2626
import android.accounts.OnAccountsUpdateListener;
27+
import android.app.ActivityManager;
2728
import android.app.AlarmManager;
2829
import android.app.Notification;
2930
import android.app.NotificationManager;
@@ -86,8 +87,13 @@ public class SyncManager implements OnAccountsUpdateListener {
8687
private static final long MAX_TIME_PER_SYNC;
8788

8889
static {
89-
MAX_SIMULTANEOUS_INITIALIZATION_SYNCS = SystemProperties.getInt("sync.max_init_syncs", 5);
90-
MAX_SIMULTANEOUS_REGULAR_SYNCS = SystemProperties.getInt("sync.max_regular_syncs", 2);
90+
final boolean isLargeRAM = ActivityManager.isLargeRAM();
91+
int defaultMaxInitSyncs = isLargeRAM ? 5 : 2;
92+
int defaultMaxRegularSyncs = isLargeRAM ? 2 : 1;
93+
MAX_SIMULTANEOUS_INITIALIZATION_SYNCS =
94+
SystemProperties.getInt("sync.max_init_syncs", defaultMaxInitSyncs);
95+
MAX_SIMULTANEOUS_REGULAR_SYNCS =
96+
SystemProperties.getInt("sync.max_regular_syncs", defaultMaxRegularSyncs);
9197
LOCAL_SYNC_DELAY =
9298
SystemProperties.getLong("sync.local_sync_delay", 30 * 1000 /* 30 seconds */);
9399
MAX_TIME_PER_SYNC =

0 commit comments

Comments
 (0)