Disambiguate apps that share uid for job/bucket purposes

Specifically, we no longer update our cached standby state bookkeeping for
*all* apps under that uid when a standby policy change notification comes
in.  We weren't properly handling shared uids; and now we are.

Change-Id: I4bda6233ebeff259cc63bdb8a4febbc83f2e1043
Fixes: 73663980
Test: atest CtsJobSchedulerTestCases
This commit is contained in:
Christopher Tate
2018-02-20 15:57:17 -08:00
parent 41ed367a63
commit 93defea5ac

View File

@@ -2261,7 +2261,12 @@ public final class JobSchedulerService extends com.android.server.SystemService
Slog.i(TAG, "Moving uid " + uid + " to bucketIndex " + bucketIndex);
}
synchronized (mLock) {
mJobs.forEachJobForSourceUid(uid, job -> job.setStandbyBucket(bucketIndex));
mJobs.forEachJobForSourceUid(uid, job -> {
// double-check uid vs package name to disambiguate shared uids
if (packageName.equals(job.getSourcePackageName())) {
job.setStandbyBucket(bucketIndex);
}
});
onControllerStateChanged();
}
});