Recheck the scedule job when the device is full charged and add more logs

Bug: 298539147
Fix: 298539147
Test: manual
Change-Id: Id9fdba17b24cbc6558bc29576f8cd93782854ee4
This commit is contained in:
Zaiyue Xue
2023-09-06 12:24:33 +08:00
parent f2735decd6
commit 13695adf07
3 changed files with 16 additions and 2 deletions

View File

@@ -68,6 +68,8 @@ public final class PeriodicJobManager {
/** Schedules the next alarm job if it is available. */
public void refreshJob(final boolean fromBoot) {
if (mAlarmManager == null) {
BatteryUsageLogUtils.writeLog(mContext, Action.SCHEDULE_JOB,
"cannot schedule next alarm job due to AlarmManager is null");
Log.e(TAG, "cannot schedule next alarm job");
return;
}
@@ -80,8 +82,8 @@ public final class PeriodicJobManager {
AlarmManager.RTC_WAKEUP, triggerAtMillis, pendingIntent);
final String utcToLocalTime = ConvertUtils.utcToLocalTimeForLogging(triggerAtMillis);
BatteryUsageLogUtils.writeLog(
mContext, Action.SCHEDULE_JOB, "triggerTime=" + utcToLocalTime);
BatteryUsageLogUtils.writeLog(mContext, Action.SCHEDULE_JOB,
String.format("triggerTime=%s, fromBoot=%b", utcToLocalTime, fromBoot));
Log.d(TAG, "schedule next alarm job at " + utcToLocalTime);
}