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

Commit a4341f69 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add metrics around scheduling failures." into udc-dev am: 07c181c7 am: 24a50870

parents e0d554e4 24a50870
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1443,6 +1443,9 @@ public class JobSchedulerService extends com.android.server.SystemService
        if (mActivityManagerInternal.isAppStartModeDisabled(uId, servicePkg)) {
            Slog.w(TAG, "Not scheduling job " + uId + ":" + job.toString()
                    + " -- package not allowed to start");
            Counter.logIncrementWithUid(
                    "job_scheduler.value_cntr_w_uid_schedule_failure_app_start_mode_disabled",
                    uId);
            return JobScheduler.RESULT_FAILURE;
        }

@@ -1519,6 +1522,9 @@ public class JobSchedulerService extends com.android.server.SystemService
                if ((mConstants.USE_TARE_POLICY && !mTareController.canScheduleEJ(jobStatus))
                        || (!mConstants.USE_TARE_POLICY
                        && !mQuotaController.isWithinEJQuotaLocked(jobStatus))) {
                    Counter.logIncrementWithUid(
                            "job_scheduler.value_cntr_w_uid_schedule_failure_ej_out_of_quota",
                            uId);
                    return JobScheduler.RESULT_FAILURE;
                }
            }
@@ -4083,6 +4089,9 @@ public class JobSchedulerService extends com.android.server.SystemService
                if (!isInStateToScheduleUiJobSource && !isInStateToScheduleUiJobCalling) {
                    Slog.e(TAG, "Uid(s) " + sourceUid + "/" + callingUid
                            + " not in a state to schedule user-initiated jobs");
                    Counter.logIncrementWithUid(
                            "job_scheduler.value_cntr_w_uid_schedule_failure_uij_invalid_state",
                            callingUid);
                    return JobScheduler.RESULT_FAILURE;
                }
            }
@@ -4136,10 +4145,14 @@ public class JobSchedulerService extends com.android.server.SystemService
        private int validateRunUserInitiatedJobsPermission(int uid, String packageName) {
            final int state = getRunUserInitiatedJobsPermissionState(uid, packageName);
            if (state == PermissionChecker.PERMISSION_HARD_DENIED) {
                Counter.logIncrementWithUid(
                        "job_scheduler.value_cntr_w_uid_schedule_failure_uij_no_permission", uid);
                throw new SecurityException(android.Manifest.permission.RUN_USER_INITIATED_JOBS
                        + " required to schedule user-initiated jobs.");
            }
            if (state == PermissionChecker.PERMISSION_SOFT_DENIED) {
                Counter.logIncrementWithUid(
                        "job_scheduler.value_cntr_w_uid_schedule_failure_uij_no_permission", uid);
                return JobScheduler.RESULT_FAILURE;
            }
            return JobScheduler.RESULT_SUCCESS;