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

Commit 574b4199 authored by Kweku Adams's avatar Kweku Adams
Browse files

Updating proto enums.

Updating proto enums to differentiate between the internal job stop
reasons and the public stop reasons.

Bug: 138239687
Bug: 171305774
Test: make statsd_testdrive && ./out/host/linux-x86/bin/statsd_testdrive 8
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest ContentResolverTest (all)
Test: atest CtsJobSchedulerTestCases
Test: atest CtsSyncManagerTest
Test: atest SyncManagerTest
Test: atest SyncOperationTest
Test: atest SyncRequestTest
Change-Id: I8d51c4dfb57d52e9c507437107afbad48cc9cecd
parent 6decc507
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -45,25 +45,25 @@ public class JobParameters implements Parcelable {

    /** @hide */
    public static final int INTERNAL_STOP_REASON_CANCELED =
            JobProtoEnums.STOP_REASON_CANCELLED; // 0.
            JobProtoEnums.INTERNAL_STOP_REASON_CANCELLED; // 0.
    /** @hide */
    public static final int INTERNAL_STOP_REASON_CONSTRAINTS_NOT_SATISFIED =
            JobProtoEnums.STOP_REASON_CONSTRAINTS_NOT_SATISFIED; // 1.
            JobProtoEnums.INTERNAL_STOP_REASON_CONSTRAINTS_NOT_SATISFIED; // 1.
    /** @hide */
    public static final int INTERNAL_STOP_REASON_PREEMPT =
            JobProtoEnums.STOP_REASON_PREEMPT; // 2.
            JobProtoEnums.INTERNAL_STOP_REASON_PREEMPT; // 2.
    /**
     * The job ran for at least its minimum execution limit.
     * @hide
     */
    public static final int INTERNAL_STOP_REASON_TIMEOUT =
            JobProtoEnums.STOP_REASON_TIMEOUT; // 3.
            JobProtoEnums.INTERNAL_STOP_REASON_TIMEOUT; // 3.
    /** @hide */
    public static final int INTERNAL_STOP_REASON_DEVICE_IDLE =
            JobProtoEnums.STOP_REASON_DEVICE_IDLE; // 4.
            JobProtoEnums.INTERNAL_STOP_REASON_DEVICE_IDLE; // 4.
    /** @hide */
    public static final int INTERNAL_STOP_REASON_DEVICE_THERMAL =
            JobProtoEnums.STOP_REASON_DEVICE_THERMAL; // 5.
            JobProtoEnums.INTERNAL_STOP_REASON_DEVICE_THERMAL; // 5.
    /**
     * The job is in the {@link android.app.usage.UsageStatsManager#STANDBY_BUCKET_RESTRICTED}
     * bucket.
@@ -71,26 +71,30 @@ public class JobParameters implements Parcelable {
     * @hide
     */
    public static final int INTERNAL_STOP_REASON_RESTRICTED_BUCKET =
            JobProtoEnums.STOP_REASON_RESTRICTED_BUCKET; // 6.
            JobProtoEnums.INTERNAL_STOP_REASON_RESTRICTED_BUCKET; // 6.
    /**
     * The app was uninstalled.
     * @hide
     */
    public static final int INTERNAL_STOP_REASON_UNINSTALL = 7;
    public static final int INTERNAL_STOP_REASON_UNINSTALL =
            JobProtoEnums.INTERNAL_STOP_REASON_UNINSTALL; // 7.
    /**
     * The app's data was cleared.
     * @hide
     */
    public static final int INTERNAL_STOP_REASON_DATA_CLEARED = 8;
    public static final int INTERNAL_STOP_REASON_DATA_CLEARED =
            JobProtoEnums.INTERNAL_STOP_REASON_DATA_CLEARED; // 8.
    /**
     * @hide
     */
    public static final int INTERNAL_STOP_REASON_RTC_UPDATED = 9;
    public static final int INTERNAL_STOP_REASON_RTC_UPDATED =
            JobProtoEnums.INTERNAL_STOP_REASON_RTC_UPDATED; // 9.
    /**
     * The app called jobFinished() on its own.
     * @hide
     */
    public static final int INTERNAL_STOP_REASON_SUCCESSFUL_FINISH = 10;
    public static final int INTERNAL_STOP_REASON_SUCCESSFUL_FINISH =
            JobProtoEnums.INTERNAL_STOP_REASON_SUCCESSFUL_FINISH; // 10.

    /**
     * All the stop reason codes. This should be regarded as an immutable array at runtime.
@@ -109,6 +113,10 @@ public class JobParameters implements Parcelable {
            INTERNAL_STOP_REASON_DEVICE_IDLE,
            INTERNAL_STOP_REASON_DEVICE_THERMAL,
            INTERNAL_STOP_REASON_RESTRICTED_BUCKET,
            INTERNAL_STOP_REASON_UNINSTALL,
            INTERNAL_STOP_REASON_DATA_CLEARED,
            INTERNAL_STOP_REASON_RTC_UPDATED,
            INTERNAL_STOP_REASON_SUCCESSFUL_FINISH,
    };

    /**
+3 −2
Original line number Diff line number Diff line
@@ -1088,7 +1088,7 @@ public class JobSchedulerService extends com.android.server.SystemService
            FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
                    uId, null, jobStatus.getBatteryName(),
                    FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__SCHEDULED,
                    JobProtoEnums.STOP_REASON_UNKNOWN, jobStatus.getStandbyBucket(),
                    JobProtoEnums.INTERNAL_STOP_REASON_UNKNOWN, jobStatus.getStandbyBucket(),
                    jobStatus.getJobId(),
                    jobStatus.hasChargingConstraint(),
                    jobStatus.hasBatteryNotLowConstraint(),
@@ -1099,7 +1099,8 @@ public class JobSchedulerService extends com.android.server.SystemService
                    jobStatus.hasConnectivityConstraint(),
                    jobStatus.hasContentTriggerConstraint(),
                    jobStatus.isRequestedExpeditedJob(),
                    /* isRunningAsExpeditedJob */ false);
                    /* isRunningAsExpeditedJob */ false,
                    JobProtoEnums.STOP_REASON_UNDEFINED);

            // If the job is immediately ready to run, then we can just immediately
            // put it in the pending list and try to schedule it.  This is especially
+6 −3
Original line number Diff line number Diff line
@@ -314,7 +314,8 @@ public final class JobServiceContext implements ServiceConnection {
            FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
                    job.getSourceUid(), null, job.getBatteryName(),
                    FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__STARTED,
                    JobProtoEnums.STOP_REASON_UNKNOWN, job.getStandbyBucket(), job.getJobId(),
                    JobProtoEnums.INTERNAL_STOP_REASON_UNKNOWN,
                    job.getStandbyBucket(), job.getJobId(),
                    job.hasChargingConstraint(),
                    job.hasBatteryNotLowConstraint(),
                    job.hasStorageNotLowConstraint(),
@@ -324,7 +325,8 @@ public final class JobServiceContext implements ServiceConnection {
                    job.hasConnectivityConstraint(),
                    job.hasContentTriggerConstraint(),
                    job.isRequestedExpeditedJob(),
                    job.shouldTreatAsExpeditedJob());
                    job.shouldTreatAsExpeditedJob(),
                    JobProtoEnums.STOP_REASON_UNDEFINED);
            try {
                mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid());
            } catch (RemoteException e) {
@@ -923,7 +925,8 @@ public final class JobServiceContext implements ServiceConnection {
                completedJob.hasConnectivityConstraint(),
                completedJob.hasContentTriggerConstraint(),
                completedJob.isRequestedExpeditedJob(),
                completedJob.startedAsExpeditedJob);
                completedJob.startedAsExpeditedJob,
                mParams.getStopReason());
        try {
            mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(), mRunningJob.getSourceUid(),
                    internalStopReason);
+1 −1
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ message UidProto {
        message ReasonCount {
            option (android.msg_privacy).dest = DEST_AUTOMATIC;

            optional android.app.job.StopReasonEnum name = 1;
            optional android.app.job.InternalStopReasonEnum name = 1;
            optional int32 count = 2;
        }
        repeated ReasonCount reason_count = 2;
+3 −3
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ message JobSchedulerServiceDumpProto {
    message JobRestriction {
        option (.android.msg_privacy).dest = DEST_AUTOMATIC;

        optional .android.app.job.StopReasonEnum reason = 1;
        optional .android.app.job.InternalStopReasonEnum reason = 1;
        optional bool is_restricting = 2;
    }

@@ -856,7 +856,7 @@ message DataSetProto {
        message StopReasonCount {
            option (.android.msg_privacy).dest = DEST_AUTOMATIC;

            optional .android.app.job.StopReasonEnum reason = 1;
            optional .android.app.job.InternalStopReasonEnum reason = 1;
            optional int32 count = 2;
        }
        repeated StopReasonCount stop_reasons = 9;
@@ -907,7 +907,7 @@ message JobPackageHistoryProto {
        optional int32 job_id = 4;
        optional string tag = 5;
        // Only valid for STOP_JOB or STOP_PERIODIC_JOB Events.
        optional .android.app.job.StopReasonEnum stop_reason = 6;
        optional .android.app.job.InternalStopReasonEnum stop_reason = 6;
    }
    repeated HistoryEvent history_event = 1;
}