summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorShreyas Basarge <snb@google.com>2016-01-11 15:43:54 +0000
committerShreyas Basarge <snb@google.com>2016-01-14 16:24:00 +0000
commit7aa4671b3699137fb71c324ac7325cf6680cf2f8 (patch)
treea9c30ce2f7d16fcd01eccfa12efb5583f0b57756 /services
parente41a6c8b19482a05a98e77d13281f7f14056f119 (diff)
downloadframeworks_base-7aa4671b3699137fb71c324ac7325cf6680cf2f8.zip
frameworks_base-7aa4671b3699137fb71c324ac7325cf6680cf2f8.tar.gz
frameworks_base-7aa4671b3699137fb71c324ac7325cf6680cf2f8.tar.bz2
DO NOT MERGE Fix for syncs being dropped when appIdle is on
Syncs were being dropped when appIdleMode was on for an app. This CL backs off the sync instead of dropping it. When the app becomes non-idle, backoff is cleared and the sync is performed. Bug: 26355386 Change-Id: I2040dfd847011d3ca902e66a8cd52b2a429177c1
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/content/SyncManager.java41
1 files changed, 22 insertions, 19 deletions
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 3ec0bee..ef086da 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -2604,32 +2604,17 @@ 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) {
try {
ai = mContext.getPackageManager().getApplicationInfo(packageName,
PackageManager.GET_UNINSTALLED_PACKAGES
- | PackageManager.GET_DISABLED_COMPONENTS);
+ | 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
@@ -2644,6 +2629,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);
}