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

Commit 7191a775 authored by Ian Pedowitz's avatar Ian Pedowitz Committed by android-build-merger
Browse files

Merge "DO NOT MERGE Fix for syncs being dropped when appIdle is on" into...

Merge "DO NOT MERGE Fix for syncs being dropped when appIdle is on" into mnc-dr1.5-dev am: 33001945
am: 33b55366

* commit '33b55366':
  DO NOT MERGE Fix for syncs being dropped when appIdle is on
parents c8ef3f87 33b55366
Loading
Loading
Loading
Loading
+22 −19
Original line number Diff line number Diff line
@@ -2596,24 +2596,6 @@ public class SyncManager {
                        }
                        continue;
                    }
                    if (!isOperationValidLocked(op)) {
                        operationIterator.remove();
                        mSyncStorageEngine.deleteFromPending(op.pendingOperation);
                        continue;
                    }
                    // If the next run time is in the future, even given the flexible scheduling,
                    // return the time.
                    if (op.effectiveRunTime - op.flexTime > now) {
                        if (nextReadyToRunTime > op.effectiveRunTime) {
                            nextReadyToRunTime = op.effectiveRunTime;
                        }
                        if (isLoggable) {
                            Log.v(TAG, "    Not running sync operation: Sync too far in future."
                                    + "effective: " + op.effectiveRunTime + " flex: " + op.flexTime
                                    + " now: " + now);
                        }
                        continue;
                    }
                    String packageName = getPackageName(op.target);
                    ApplicationInfo ai = null;
                    if (packageName != null) {
@@ -2622,6 +2604,9 @@ public class SyncManager {
                                    PackageManager.GET_UNINSTALLED_PACKAGES
                                            | PackageManager.GET_DISABLED_COMPONENTS);
                        } catch (NameNotFoundException e) {
                            operationIterator.remove();
                            mSyncStorageEngine.deleteFromPending(op.pendingOperation);
                            continue;
                        }
                    }
                    // If app is considered idle, then skip for now and backoff
@@ -2636,6 +2621,24 @@ public class SyncManager {
                    } else {
                        op.appIdle = false;
                    }
                    if (!isOperationValidLocked(op)) {
                        operationIterator.remove();
                        mSyncStorageEngine.deleteFromPending(op.pendingOperation);
                        continue;
                    }
                    // If the next run time is in the future, even given the flexible scheduling,
                    // return the time.
                    if (op.effectiveRunTime - op.flexTime > now) {
                        if (nextReadyToRunTime > op.effectiveRunTime) {
                            nextReadyToRunTime = op.effectiveRunTime;
                        }
                        if (isLoggable) {
                            Log.v(TAG, "    Not running sync operation: Sync too far in future."
                                    + "effective: " + op.effectiveRunTime + " flex: " + op.flexTime
                                    + " now: " + now);
                        }
                        continue;
                    }
                    // Add this sync to be run.
                    operations.add(op);
                }