Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +13 −380 File changed.Preview size limit exceeded, changes collapsed. Show changes apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java +3 −11 Original line number Diff line number Diff line Loading @@ -340,15 +340,8 @@ public final class JobSchedulerShellCommand extends ShellCommand { private int doHeartbeat(PrintWriter pw) throws Exception { checkPermission("manipulate scheduler heartbeat"); final String arg = getNextArg(); final int numBeats = (arg != null) ? Integer.parseInt(arg) : 0; final long ident = Binder.clearCallingIdentity(); try { return mInternal.executeHeartbeatCommand(pw, numBeats); } finally { Binder.restoreCallingIdentity(ident); } pw.println("Heartbeat command is no longer supported"); return -1; } private int triggerDockState(PrintWriter pw) throws Exception { Loading Loading @@ -401,8 +394,7 @@ public final class JobSchedulerShellCommand extends ShellCommand { pw.println(" -u or --user: specify which user's job is to be run; the default is"); pw.println(" the primary or system user"); pw.println(" heartbeat [num]"); pw.println(" With no argument, prints the current standby heartbeat. With a positive"); pw.println(" argument, advances the standby heartbeat by that number."); pw.println(" No longer used."); pw.println(" monitor-battery [on|off]"); pw.println(" Control monitoring of all battery changes. Off by default. Turning"); pw.println(" on makes get-battery-seq useful."); Loading apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +0 −3 Original line number Diff line number Diff line Loading @@ -285,9 +285,6 @@ public final class JobServiceContext implements ServiceConnection { UsageStatsManagerInternal usageStats = LocalServices.getService(UsageStatsManagerInternal.class); usageStats.setLastJobRunTime(jobPackage, jobUserId, mExecutionStartTimeElapsed); JobSchedulerInternal jobScheduler = LocalServices.getService(JobSchedulerInternal.class); jobScheduler.noteJobStart(jobPackage, jobUserId); mAvailable = false; mStoppedReason = null; mStoppedTime = 0; Loading apex/jobscheduler/service/java/com/android/server/job/JobStore.java +2 −3 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ public final class JobStore { if (utcTimes != null) { Pair<Long, Long> elapsedRuntimes = convertRtcBoundsToElapsed(utcTimes, elapsedNow); JobStatus newJob = new JobStatus(job, job.getBaseHeartbeat(), JobStatus newJob = new JobStatus(job, elapsedRuntimes.first, elapsedRuntimes.second, 0, job.getLastSuccessfulRunTime(), job.getLastFailedRunTime()); newJob.prepareLocked(am); Loading Loading @@ -944,10 +944,9 @@ public final class JobStore { JobSchedulerInternal service = LocalServices.getService(JobSchedulerInternal.class); final int appBucket = JobSchedulerService.standbyBucketForPackage(sourcePackageName, sourceUserId, elapsedNow); long currentHeartbeat = service != null ? service.currentHeartbeat() : 0; JobStatus js = new JobStatus( jobBuilder.build(), uid, sourcePackageName, sourceUserId, appBucket, currentHeartbeat, sourceTag, appBucket, sourceTag, elapsedRuntimes.first, elapsedRuntimes.second, lastSuccessfulRunTime, lastFailedRunTime, (rtcIsGood) ? null : rtcRuntimes, internalFlags); Loading apex/jobscheduler/service/java/com/android/server/job/controllers/ConnectivityController.java +1 −35 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.server.LocalServices; import com.android.server.job.JobSchedulerService; import com.android.server.job.JobSchedulerService.Constants; import com.android.server.job.JobServiceContext; import com.android.server.job.StateControllerProto; import com.android.server.net.NetworkPolicyManagerInternal; Loading Loading @@ -88,8 +87,6 @@ public final class ConnectivityController extends StateController implements @GuardedBy("mLock") private final ArraySet<Network> mAvailableNetworks = new ArraySet<>(); private boolean mUseQuotaLimit; private static final int MSG_DATA_SAVER_TOGGLED = 0; private static final int MSG_UID_RULES_CHANGES = 1; private static final int MSG_REEVALUATE_JOBS = 2; Loading @@ -110,8 +107,6 @@ public final class ConnectivityController extends StateController implements mConnManager.registerNetworkCallback(request, mNetworkCallback); mNetPolicyManager.registerListener(mNetPolicyListener); mUseQuotaLimit = !mConstants.USE_HEARTBEATS; } @GuardedBy("mLock") Loading Loading @@ -142,24 +137,6 @@ public final class ConnectivityController extends StateController implements } } @GuardedBy("mLock") @Override public void onConstantsUpdatedLocked() { if (mConstants.USE_HEARTBEATS) { // App idle exceptions are only requested for the rolling quota system. if (DEBUG) Slog.i(TAG, "Revoking all standby exceptions"); for (int i = 0; i < mRequestedWhitelistJobs.size(); ++i) { int uid = mRequestedWhitelistJobs.keyAt(i); mNetPolicyManagerInternal.setAppIdleWhitelist(uid, false); } mRequestedWhitelistJobs.clear(); } if (mUseQuotaLimit == mConstants.USE_HEARTBEATS) { mUseQuotaLimit = !mConstants.USE_HEARTBEATS; mHandler.obtainMessage(MSG_REEVALUATE_JOBS).sendToTarget(); } } /** * Returns true if the job's requested network is available. This DOES NOT necesarilly mean * that the UID has been granted access to the network. Loading Loading @@ -237,11 +214,6 @@ public final class ConnectivityController extends StateController implements @GuardedBy("mLock") @Override public void evaluateStateLocked(JobStatus jobStatus) { if (mConstants.USE_HEARTBEATS) { // This should only be used for the rolling quota system. return; } if (!jobStatus.hasConnectivityConstraint()) { return; } Loading @@ -263,9 +235,6 @@ public final class ConnectivityController extends StateController implements @GuardedBy("mLock") @Override public void reevaluateStateLocked(final int uid) { if (mConstants.USE_HEARTBEATS) { return; } // Check if we still need a connectivity exception in case the JobService was disabled. ArraySet<JobStatus> jobs = mTrackedJobs.get(uid); if (jobs == null) { Loading Loading @@ -329,9 +298,7 @@ public final class ConnectivityController extends StateController implements */ private boolean isInsane(JobStatus jobStatus, Network network, NetworkCapabilities capabilities, Constants constants) { final long maxJobExecutionTimeMs = mUseQuotaLimit ? mService.getMaxJobExecutionTimeMs(jobStatus) : JobServiceContext.EXECUTING_TIMESLICE_MILLIS; final long maxJobExecutionTimeMs = mService.getMaxJobExecutionTimeMs(jobStatus); final long downloadBytes = jobStatus.getEstimatedNetworkDownloadBytes(); if (downloadBytes != JobInfo.NETWORK_BYTES_UNKNOWN) { Loading Loading @@ -617,7 +584,6 @@ public final class ConnectivityController extends StateController implements @Override public void dumpControllerStateLocked(IndentingPrintWriter pw, Predicate<JobStatus> predicate) { pw.print("mUseQuotaLimit="); pw.println(mUseQuotaLimit); if (mRequestedWhitelistJobs.size() > 0) { pw.print("Requested standby exceptions:"); Loading Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +13 −380 File changed.Preview size limit exceeded, changes collapsed. Show changes
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java +3 −11 Original line number Diff line number Diff line Loading @@ -340,15 +340,8 @@ public final class JobSchedulerShellCommand extends ShellCommand { private int doHeartbeat(PrintWriter pw) throws Exception { checkPermission("manipulate scheduler heartbeat"); final String arg = getNextArg(); final int numBeats = (arg != null) ? Integer.parseInt(arg) : 0; final long ident = Binder.clearCallingIdentity(); try { return mInternal.executeHeartbeatCommand(pw, numBeats); } finally { Binder.restoreCallingIdentity(ident); } pw.println("Heartbeat command is no longer supported"); return -1; } private int triggerDockState(PrintWriter pw) throws Exception { Loading Loading @@ -401,8 +394,7 @@ public final class JobSchedulerShellCommand extends ShellCommand { pw.println(" -u or --user: specify which user's job is to be run; the default is"); pw.println(" the primary or system user"); pw.println(" heartbeat [num]"); pw.println(" With no argument, prints the current standby heartbeat. With a positive"); pw.println(" argument, advances the standby heartbeat by that number."); pw.println(" No longer used."); pw.println(" monitor-battery [on|off]"); pw.println(" Control monitoring of all battery changes. Off by default. Turning"); pw.println(" on makes get-battery-seq useful."); Loading
apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +0 −3 Original line number Diff line number Diff line Loading @@ -285,9 +285,6 @@ public final class JobServiceContext implements ServiceConnection { UsageStatsManagerInternal usageStats = LocalServices.getService(UsageStatsManagerInternal.class); usageStats.setLastJobRunTime(jobPackage, jobUserId, mExecutionStartTimeElapsed); JobSchedulerInternal jobScheduler = LocalServices.getService(JobSchedulerInternal.class); jobScheduler.noteJobStart(jobPackage, jobUserId); mAvailable = false; mStoppedReason = null; mStoppedTime = 0; Loading
apex/jobscheduler/service/java/com/android/server/job/JobStore.java +2 −3 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ public final class JobStore { if (utcTimes != null) { Pair<Long, Long> elapsedRuntimes = convertRtcBoundsToElapsed(utcTimes, elapsedNow); JobStatus newJob = new JobStatus(job, job.getBaseHeartbeat(), JobStatus newJob = new JobStatus(job, elapsedRuntimes.first, elapsedRuntimes.second, 0, job.getLastSuccessfulRunTime(), job.getLastFailedRunTime()); newJob.prepareLocked(am); Loading Loading @@ -944,10 +944,9 @@ public final class JobStore { JobSchedulerInternal service = LocalServices.getService(JobSchedulerInternal.class); final int appBucket = JobSchedulerService.standbyBucketForPackage(sourcePackageName, sourceUserId, elapsedNow); long currentHeartbeat = service != null ? service.currentHeartbeat() : 0; JobStatus js = new JobStatus( jobBuilder.build(), uid, sourcePackageName, sourceUserId, appBucket, currentHeartbeat, sourceTag, appBucket, sourceTag, elapsedRuntimes.first, elapsedRuntimes.second, lastSuccessfulRunTime, lastFailedRunTime, (rtcIsGood) ? null : rtcRuntimes, internalFlags); Loading
apex/jobscheduler/service/java/com/android/server/job/controllers/ConnectivityController.java +1 −35 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.server.LocalServices; import com.android.server.job.JobSchedulerService; import com.android.server.job.JobSchedulerService.Constants; import com.android.server.job.JobServiceContext; import com.android.server.job.StateControllerProto; import com.android.server.net.NetworkPolicyManagerInternal; Loading Loading @@ -88,8 +87,6 @@ public final class ConnectivityController extends StateController implements @GuardedBy("mLock") private final ArraySet<Network> mAvailableNetworks = new ArraySet<>(); private boolean mUseQuotaLimit; private static final int MSG_DATA_SAVER_TOGGLED = 0; private static final int MSG_UID_RULES_CHANGES = 1; private static final int MSG_REEVALUATE_JOBS = 2; Loading @@ -110,8 +107,6 @@ public final class ConnectivityController extends StateController implements mConnManager.registerNetworkCallback(request, mNetworkCallback); mNetPolicyManager.registerListener(mNetPolicyListener); mUseQuotaLimit = !mConstants.USE_HEARTBEATS; } @GuardedBy("mLock") Loading Loading @@ -142,24 +137,6 @@ public final class ConnectivityController extends StateController implements } } @GuardedBy("mLock") @Override public void onConstantsUpdatedLocked() { if (mConstants.USE_HEARTBEATS) { // App idle exceptions are only requested for the rolling quota system. if (DEBUG) Slog.i(TAG, "Revoking all standby exceptions"); for (int i = 0; i < mRequestedWhitelistJobs.size(); ++i) { int uid = mRequestedWhitelistJobs.keyAt(i); mNetPolicyManagerInternal.setAppIdleWhitelist(uid, false); } mRequestedWhitelistJobs.clear(); } if (mUseQuotaLimit == mConstants.USE_HEARTBEATS) { mUseQuotaLimit = !mConstants.USE_HEARTBEATS; mHandler.obtainMessage(MSG_REEVALUATE_JOBS).sendToTarget(); } } /** * Returns true if the job's requested network is available. This DOES NOT necesarilly mean * that the UID has been granted access to the network. Loading Loading @@ -237,11 +214,6 @@ public final class ConnectivityController extends StateController implements @GuardedBy("mLock") @Override public void evaluateStateLocked(JobStatus jobStatus) { if (mConstants.USE_HEARTBEATS) { // This should only be used for the rolling quota system. return; } if (!jobStatus.hasConnectivityConstraint()) { return; } Loading @@ -263,9 +235,6 @@ public final class ConnectivityController extends StateController implements @GuardedBy("mLock") @Override public void reevaluateStateLocked(final int uid) { if (mConstants.USE_HEARTBEATS) { return; } // Check if we still need a connectivity exception in case the JobService was disabled. ArraySet<JobStatus> jobs = mTrackedJobs.get(uid); if (jobs == null) { Loading Loading @@ -329,9 +298,7 @@ public final class ConnectivityController extends StateController implements */ private boolean isInsane(JobStatus jobStatus, Network network, NetworkCapabilities capabilities, Constants constants) { final long maxJobExecutionTimeMs = mUseQuotaLimit ? mService.getMaxJobExecutionTimeMs(jobStatus) : JobServiceContext.EXECUTING_TIMESLICE_MILLIS; final long maxJobExecutionTimeMs = mService.getMaxJobExecutionTimeMs(jobStatus); final long downloadBytes = jobStatus.getEstimatedNetworkDownloadBytes(); if (downloadBytes != JobInfo.NETWORK_BYTES_UNKNOWN) { Loading Loading @@ -617,7 +584,6 @@ public final class ConnectivityController extends StateController implements @Override public void dumpControllerStateLocked(IndentingPrintWriter pw, Predicate<JobStatus> predicate) { pw.print("mUseQuotaLimit="); pw.println(mUseQuotaLimit); if (mRequestedWhitelistJobs.size() > 0) { pw.print("Requested standby exceptions:"); Loading