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

Commit 325956df authored by Shreyas Basarge's avatar Shreyas Basarge
Browse files

Fixes for JobScheduler sourcePackage fields

Source fields now copied as part of copy constructor.
Wakelocks acquired with sourceUid as the worksource.

Change-Id: I93217730c6b1215ea048aa6f54636c5f3215ce8e
parent a0b16caf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -289,7 +289,7 @@ public class JobServiceContext extends IJobCallback.Stub implements ServiceConne
        final PowerManager pm =
                (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, runningJob.getTag());
        mWakeLock.setWorkSource(new WorkSource(runningJob.getUid()));
        mWakeLock.setWorkSource(new WorkSource(runningJob.getSourceUid()));
        mWakeLock.setReferenceCounted(false);
        mWakeLock.acquire();
        mCallbackHandler.obtainMessage(MSG_SERVICE_BOUND).sendToTarget();
+4 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ public class JobStatus {
    /** Copy constructor. */
    public JobStatus(JobStatus jobStatus) {
        this(jobStatus.getJob(), jobStatus.getUid(), jobStatus.getNumFailures());
        this.sourceUserId = jobStatus.sourceUserId;
        this.sourcePackageName = jobStatus.sourcePackageName;
        this.earliestRunTimeElapsedMillis = jobStatus.getEarliestRunTime();
        this.latestRunTimeElapsedMillis = jobStatus.getLatestRunTimeElapsed();
    }
@@ -132,6 +134,8 @@ public class JobStatus {
    public JobStatus(JobStatus rescheduling, long newEarliestRuntimeElapsedMillis,
                      long newLatestRuntimeElapsedMillis, int backoffAttempt) {
        this(rescheduling.job, rescheduling.getUid(), backoffAttempt);
        this.sourceUserId = rescheduling.sourceUserId;
        this.sourcePackageName = rescheduling.sourcePackageName;

        earliestRunTimeElapsedMillis = newEarliestRuntimeElapsedMillis;
        latestRunTimeElapsedMillis = newLatestRuntimeElapsedMillis;