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

Commit fb8eb00b authored by John Spurlock's avatar John Spurlock
Browse files

Dump the countdown condition, if active.

Change-Id: I3fa1d239379565bae74094dc2bc2da76326f41dd
parent c12aab2a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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 + ")";
        }