Dump the countdown condition, if active.

Change-Id: I3fa1d239379565bae74094dc2bc2da76326f41dd
This commit is contained in:
John Spurlock
2014-05-19 20:43:48 -04:00
parent c12aab2afe
commit fb8eb00bcd

View File

@@ -88,6 +88,8 @@ public class ConditionProviders extends ManagedServices {
for (int i = 0; i < mRecords.size(); i++) {
pw.print(" "); pw.println(mRecords.get(i));
}
pw.print(" mCountdownHelper: ");
pw.println(mCountdownHelper.getCurrentConditionDescription());
}
}
@@ -474,6 +476,16 @@ public class ConditionProviders extends ManagedServices {
}
}
public String getCurrentConditionDescription() {
if (mCurrent == 0) return null;
final long time = mCurrent;
final long now = System.currentTimeMillis();
final CharSequence span =
DateUtils.getRelativeTimeSpanString(time, now, DateUtils.MINUTE_IN_MILLIS);
return String.format("Scheduled for %s, %s in the future (%s), now=%s",
ts(time), time - now, span, ts(now));
}
private String ts(long time) {
return new Date(time) + " (" + time + ")";
}