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
(cherry picked from commit 2c051498b2)
This commit is contained in:
committed by
Akshay Thakker
parent
7a313a63ca
commit
a42a892630
@@ -2604,6 +2604,31 @@ public class SyncManager {
|
||||
}
|
||||
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);
|
||||
} catch (NameNotFoundException e) {
|
||||
operationIterator.remove();
|
||||
mSyncStorageEngine.deleteFromPending(op.pendingOperation);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// If app is considered idle, then skip for now and backoff
|
||||
if (ai != null
|
||||
&& mAppIdleMonitor.isAppIdle(packageName, ai.uid, op.target.userId)) {
|
||||
increaseBackoffSetting(op);
|
||||
op.appIdle = true;
|
||||
if (isLoggable) {
|
||||
Log.v(TAG, "Sync backing off idle app " + packageName);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
op.appIdle = false;
|
||||
}
|
||||
if (!isOperationValidLocked(op)) {
|
||||
operationIterator.remove();
|
||||
mSyncStorageEngine.deleteFromPending(op.pendingOperation);
|
||||
@@ -2622,28 +2647,6 @@ public class SyncManager {
|
||||
}
|
||||
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);
|
||||
} catch (NameNotFoundException e) {
|
||||
}
|
||||
}
|
||||
// If app is considered idle, then skip for now and backoff
|
||||
if (ai != null
|
||||
&& mAppIdleMonitor.isAppIdle(packageName, ai.uid, op.target.userId)) {
|
||||
increaseBackoffSetting(op);
|
||||
op.appIdle = true;
|
||||
if (isLoggable) {
|
||||
Log.v(TAG, "Sync backing off idle app " + packageName);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
op.appIdle = false;
|
||||
}
|
||||
// Add this sync to be run.
|
||||
operations.add(op);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user