Merge "Skip persisting when there's no change." into udc-dev am: d22e8c624f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21649101

Change-Id: I7c1d9c5d5113b43d82f0aa11155e0efb9dc55f7c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Kweku Adams
2023-02-28 21:37:23 +00:00
committed by Automerger Merge Worker
2 changed files with 9 additions and 2 deletions

View File

@@ -727,8 +727,11 @@ public final class JobServiceContext implements ServiceConnection {
// Exception-throwing-can down the road to JobParameters.completeWork >:(
return true;
}
mService.mJobs.touchJob(mRunningJob);
return mRunningJob.completeWorkLocked(workId);
if (mRunningJob.completeWorkLocked(workId)) {
mService.mJobs.touchJob(mRunningJob);
return true;
}
return false;
}
} finally {
Binder.restoreCallingIdentity(ident);

View File

@@ -828,6 +828,10 @@ public final class JobStatus {
}
}
/**
* Returns {@code true} if the JobWorkItem queue was updated,
* and {@code false} if nothing changed.
*/
public boolean completeWorkLocked(int workId) {
if (executingWork != null) {
final int N = executingWork.size();