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

am: 7b0b2422ed

Change-Id: Ideaea9c44cbcda65111306b12079e75bbb5ce367
This commit is contained in:
Tej Singh
2018-03-22 02:20:22 +00:00
committed by android-build-merger
7 changed files with 36 additions and 27 deletions

View File

@@ -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) {

View File

@@ -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()) {