Merge "Remove redundant/deprecated method."

This commit is contained in:
TreeHugger Robot
2020-02-20 15:57:34 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 17 deletions

View File

@@ -77,11 +77,11 @@ public class JobParameters implements Parcelable {
/**
* @hide
* @deprecated use {@link #getReasonCodeDescription(int)}
*/
@Deprecated
public static String getReasonName(int reason) {
switch (reason) {
// TODO(142420609): make it @SystemApi for mainline
@NonNull
public static String getReasonCodeDescription(int reasonCode) {
switch (reasonCode) {
case REASON_CANCELED: return "canceled";
case REASON_CONSTRAINTS_NOT_SATISFIED: return "constraints";
case REASON_PREEMPT: return "preempt";
@@ -89,7 +89,7 @@ public class JobParameters implements Parcelable {
case REASON_DEVICE_IDLE: return "device_idle";
case REASON_DEVICE_THERMAL: return "thermal";
case REASON_RESTRAINED: return "restrained";
default: return "unknown:" + reason;
default: return "unknown:" + reasonCode;
}
}
@@ -100,13 +100,6 @@ public class JobParameters implements Parcelable {
return JOB_STOP_REASON_CODES;
}
/** @hide */
// @SystemApi TODO make it a system api for mainline
@NonNull
public static String getReasonCodeDescription(int reasonCode) {
return getReasonName(reasonCode);
}
@UnsupportedAppUsage
private final int jobId;
private final PersistableBundle extras;

View File

@@ -359,7 +359,8 @@ public final class JobPackageTracker {
}
pw.print(pe.stopReasons.valueAt(k));
pw.print("x ");
pw.print(JobParameters.getReasonName(pe.stopReasons.keyAt(k)));
pw.print(JobParameters
.getReasonCodeDescription(pe.stopReasons.keyAt(k)));
}
pw.println();
}
@@ -606,8 +607,9 @@ public final class JobPackageTracker {
if (reason != null) {
pw.print(mEventReasons[index]);
} else {
pw.print(JobParameters.getReasonName((mEventCmds[index] & EVENT_STOP_REASON_MASK)
>> EVENT_STOP_REASON_SHIFT));
pw.print(JobParameters.getReasonCodeDescription(
(mEventCmds[index] & EVENT_STOP_REASON_MASK)
>> EVENT_STOP_REASON_SHIFT));
}
}
pw.println();

View File

@@ -1963,7 +1963,7 @@ public class JobSchedulerService extends com.android.server.SystemService
if (restriction != null) {
final int reason = restriction.getReason();
serviceContext.cancelExecutingJobLocked(reason,
"restricted due to " + JobParameters.getReasonName(reason));
"restricted due to " + JobParameters.getReasonCodeDescription(reason));
}
}
}
@@ -3110,7 +3110,7 @@ public class JobSchedulerService extends com.android.server.SystemService
final JobRestriction restriction = mJobRestrictions.get(i);
if (restriction.isJobRestricted(job)) {
final int reason = restriction.getReason();
pw.write(" " + JobParameters.getReasonName(reason) + "[" + reason + "]");
pw.print(" " + JobParameters.getReasonCodeDescription(reason));
}
}
} else {