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

Commit 33e44694 authored by Fred Quintana's avatar Fred Quintana
Browse files

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()

Bug: 5713224
Change-Id: Ic8c42103f4031e1d7b1db797edcbbd7f7bac1387
parent 277cbe5a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.google.android.collect.Maps;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.OnAccountsUpdateListener;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
@@ -86,8 +87,13 @@ public class SyncManager implements OnAccountsUpdateListener {
    private static final long MAX_TIME_PER_SYNC;

    static {
        MAX_SIMULTANEOUS_INITIALIZATION_SYNCS = SystemProperties.getInt("sync.max_init_syncs", 5);
        MAX_SIMULTANEOUS_REGULAR_SYNCS = SystemProperties.getInt("sync.max_regular_syncs", 2);
        final boolean isLargeRAM = ActivityManager.isLargeRAM();
        int defaultMaxInitSyncs = isLargeRAM ? 5 : 2;
        int defaultMaxRegularSyncs = isLargeRAM ? 2 : 1;
        MAX_SIMULTANEOUS_INITIALIZATION_SYNCS =
                SystemProperties.getInt("sync.max_init_syncs", defaultMaxInitSyncs);
        MAX_SIMULTANEOUS_REGULAR_SYNCS =
                SystemProperties.getInt("sync.max_regular_syncs", defaultMaxRegularSyncs);
        LOCAL_SYNC_DELAY =
                SystemProperties.getLong("sync.local_sync_delay", 30 * 1000 /* 30 seconds */);
        MAX_TIME_PER_SYNC =