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

Commit a6e6be79 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Cleanup flag com.android.server.job.create_work_chain_by_default." into main

parents 14426b1a b28108d6
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -39,16 +39,6 @@ flag {
   }
}

flag {
   name: "create_work_chain_by_default"
   namespace: "backstage_power"
   description: "Create a workchain by default when acquiring a wakelock"
   bug: "352676818"
   metadata {
       purpose: PURPOSE_BUGFIX
   }
}

flag {
   name: "remove_user_during_user_switch"
   namespace: "backstage_power"
+1 −2
Original line number Diff line number Diff line
@@ -1521,8 +1521,7 @@ class JobConcurrencyManager {
        final int numControllers = controllers.size();
        final PowerManager.WakeLock wl = mPowerManager.newWakeLock(
                PowerManager.PARTIAL_WAKE_LOCK, jobStatus.getWakelockTag());
        wl.setWorkSource(mService.deriveWorkSource(
                jobStatus.getSourceUid(), jobStatus.getSourcePackageName()));
        wl.setWorkSource(mService.deriveWorkSource(jobStatus.getSourceUid()));
        wl.setReferenceCounted(false);
        // Since the quota controller will start counting from the time prepareForExecutionLocked()
        // is called, hold a wakelock to make sure the CPU doesn't suspend between that call and
+7 −13
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package com.android.server.job;

import static android.app.job.JobParameters.OVERRIDE_HANDLE_ABANDONED_JOBS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.MANAGE_ACTIVITY_TASKS;
import static android.app.job.JobParameters.OVERRIDE_HANDLE_ABANDONED_JOBS;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
import static android.text.format.DateUtils.HOUR_IN_MILLIS;
@@ -1633,18 +1633,12 @@ public class JobSchedulerService extends com.android.server.SystemService
    }

    @NonNull
    public WorkSource deriveWorkSource(int sourceUid, @Nullable String sourcePackageName) {
        if (Flags.createWorkChainByDefault()
                || WorkSource.isChainedBatteryAttributionEnabled(getContext())) {
    public WorkSource deriveWorkSource(int sourceUid) {
        WorkSource ws = new WorkSource();
        ws.createWorkChain()
                .addNode(sourceUid, null)
                .addNode(Process.SYSTEM_UID, "JobScheduler");
        return ws;
        } else {
            return sourcePackageName == null
                    ? new WorkSource(sourceUid) : new WorkSource(sourceUid, sourcePackageName);
        }
    }

    @Nullable
+1 −2
Original line number Diff line number Diff line
@@ -447,8 +447,7 @@ public final class JobServiceContext implements ServiceConnection {

            mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
                    job.getWakelockTag());
            mWakeLock.setWorkSource(
                    mService.deriveWorkSource(job.getSourceUid(), job.getSourcePackageName()));
            mWakeLock.setWorkSource(mService.deriveWorkSource(job.getSourceUid()));
            mWakeLock.setReferenceCounted(false);
            mWakeLock.acquire();

+5 −6
Original line number Diff line number Diff line
@@ -114,8 +114,7 @@ public final class TimeController extends StateController {
            mTrackedJobs.add(job);

            job.setTrackingController(JobStatus.TRACKING_TIME);
            WorkSource ws =
                    mService.deriveWorkSource(job.getSourceUid(), job.getSourcePackageName());
            WorkSource ws = mService.deriveWorkSource(job.getSourceUid());

            // Only update alarms if the job would be ready with the relevant timing constraint
            // satisfied.
@@ -186,7 +185,7 @@ public final class TimeController extends StateController {
            } else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {
                // This job's deadline is earlier than the current set alarm. Update the alarm.
                setDeadlineExpiredAlarmLocked(job.getLatestRunTimeElapsed(),
                        mService.deriveWorkSource(job.getSourceUid(), job.getSourcePackageName()));
                        mService.deriveWorkSource(job.getSourceUid()));
            }
        }
        if (job.hasTimingDelayConstraint()
@@ -202,7 +201,7 @@ public final class TimeController extends StateController {
            } else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_TIMING_DELAY)) {
                // This job's delay is earlier than the current set alarm. Update the alarm.
                setDelayExpiredAlarmLocked(job.getEarliestRunTime(),
                        mService.deriveWorkSource(job.getSourceUid(), job.getSourcePackageName()));
                        mService.deriveWorkSource(job.getSourceUid()));
            }
        }
    }
@@ -275,7 +274,7 @@ public final class TimeController extends StateController {
                }
            }
            setDeadlineExpiredAlarmLocked(nextExpiryTime,
                    mService.deriveWorkSource(nextExpiryUid, nextExpiryPackageName));
                    mService.deriveWorkSource(nextExpiryUid));
        }
    }

@@ -337,7 +336,7 @@ public final class TimeController extends StateController {
                mStateChangedListener.onControllerStateChanged(changedJobs);
            }
            setDelayExpiredAlarmLocked(nextDelayTime,
                    mService.deriveWorkSource(nextDelayUid, nextDelayPackageName));
                    mService.deriveWorkSource(nextDelayUid));
        }
    }

Loading