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

Commit 7b0b2422 authored by Tej Singh's avatar Tej Singh Committed by android-build-merger
Browse files

Merge "ScheduledJobStateChanged: add stop reason" into pi-dev

am: dcccfd97

Change-Id: Ie6d83624f3d607c5bd3d24aea0bcd28829a2f11a
parents 5e8a50f1 dcccfd97
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ option java_outer_classname = "AtomsProto";

import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
import "frameworks/base/core/proto/android/app/enums.proto";
import "frameworks/base/core/proto/android/app/job/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/enums.proto";
import "frameworks/base/core/proto/android/os/enums.proto";
import "frameworks/base/core/proto/android/server/enums.proto";
@@ -362,7 +363,10 @@ message ScheduledJobStateChanged {
    }
    optional State state = 3;

    // TODO: Consider adding the stopReason (int)
    // The reason a job has stopped.
    // This is only applicable when the state is FINISHED.
    // The default value is CANCELED.
    optional android.app.job.StopReasonEnum stop_reason = 4;
}

/**
+6 −5
Original line number Diff line number Diff line
@@ -36,15 +36,16 @@ import android.os.RemoteException;
public class JobParameters implements Parcelable {

    /** @hide */
    public static final int REASON_CANCELED = 0;
    public static final int REASON_CANCELED = JobProtoEnums.STOP_REASON_CANCELLED; // 0.
    /** @hide */
    public static final int REASON_CONSTRAINTS_NOT_SATISFIED = 1;
    public static final int REASON_CONSTRAINTS_NOT_SATISFIED =
            JobProtoEnums.STOP_REASON_CONSTRAINTS_NOT_SATISFIED; //1.
    /** @hide */
    public static final int REASON_PREEMPT = 2;
    public static final int REASON_PREEMPT = JobProtoEnums.STOP_REASON_PREEMPT; // 2.
    /** @hide */
    public static final int REASON_TIMEOUT = 3;
    public static final int REASON_TIMEOUT = JobProtoEnums.STOP_REASON_TIMEOUT; // 3.
    /** @hide */
    public static final int REASON_DEVICE_IDLE = 4;
    public static final int REASON_DEVICE_IDLE = JobProtoEnums.STOP_REASON_DEVICE_IDLE; // 4.

    /** @hide */
    public static String getReasonName(int reason) {
+5 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.os;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.job.JobProtoEnums;
import android.bluetooth.BluetoothActivityEnergyInfo;
import android.bluetooth.UidTraffic;
import android.content.ContentResolver;
@@ -10045,7 +10046,8 @@ public class BatteryStatsImpl extends BatteryStats {
            if (t != null) {
                t.startRunningLocked(elapsedRealtimeMs);
                StatsLog.write_non_chained(StatsLog.SCHEDULED_JOB_STATE_CHANGED, getUid(), null,
                        name, StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__STARTED);
                        name, StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__STARTED,
                        JobProtoEnums.STOP_REASON_CANCELLED);
            }
        }
@@ -10055,7 +10057,8 @@ public class BatteryStatsImpl extends BatteryStats {
                t.stopRunningLocked(elapsedRealtimeMs);
                if (!t.isRunningLocked()) { // only tell statsd if truly stopped
                    StatsLog.write_non_chained(StatsLog.SCHEDULED_JOB_STATE_CHANGED, getUid(), null,
                            name, StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__FINISHED);
                            name, StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__FINISHED,
                            stopReason);
                }
            }
            if (mBsi.mOnBatteryTimeBase.isRunning()) {
+12 −13
Original line number Diff line number Diff line
@@ -15,19 +15,18 @@
 */

syntax = "proto2";
option java_multiple_files = true;

package android.app;
package android.app.job;

/**
 * An android.app.JobParameters object.
 */
message JobParametersProto {
    enum CancelReason {
        REASON_CANCELLED = 0;
        REASON_CONSTRAINTS_NOT_SATISFIED = 1;
        REASON_PREEMPT = 2;
        REASON_TIMEOUT = 3;
        REASON_DEVICE_IDLE = 4;
    }
option java_outer_classname = "JobProtoEnums";
option java_multiple_files = true;

// Reasons a job is stopped.
// Primarily used in android.app.job.JobParameters.java.
enum StopReasonEnum {
  STOP_REASON_CANCELLED = 0;
  STOP_REASON_CONSTRAINTS_NOT_SATISFIED = 1;
  STOP_REASON_PREEMPT = 2;
  STOP_REASON_TIMEOUT = 3;
  STOP_REASON_DEVICE_IDLE = 4;
}
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ option java_multiple_files = true;

package android.os;

import "frameworks/base/core/proto/android/app/jobparameters.proto";
import "frameworks/base/core/proto/android/app/job/enums.proto";
import "frameworks/base/core/proto/android/os/powermanager.proto";
import "frameworks/base/core/proto/android/telephony/enums.proto";
import "frameworks/base/libs/incident/proto/android/privacy.proto";
@@ -637,7 +637,7 @@ message UidProto {
    message ReasonCount {
      option (android.msg_privacy).dest = DEST_AUTOMATIC;

      optional android.app.JobParametersProto.CancelReason name = 1;
      optional android.app.job.StopReasonEnum name = 1;
      optional int32 count = 2;
    }
    repeated ReasonCount reason_count = 2;
Loading