Loading core/java/android/os/CountDownTimer.java +12 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,11 @@ public abstract class CountDownTimer { private long mStopTimeInFuture; /** * boolean representing if the timer was cancelled */ private boolean mCancelled = false; /** * @param millisInFuture The number of millis in the future from the call * to {@link #start()} until the countdown is done and {@link #onFinish()} Loading @@ -70,7 +75,8 @@ public abstract class CountDownTimer { /** * Cancel the countdown. */ public final void cancel() { public synchronized final void cancel() { mCancelled = true; mHandler.removeMessages(MSG); } Loading @@ -78,6 +84,7 @@ public abstract class CountDownTimer { * Start the countdown. */ public synchronized final CountDownTimer start() { mCancelled = false; if (mMillisInFuture <= 0) { onFinish(); return this; Loading Loading @@ -110,6 +117,10 @@ public abstract class CountDownTimer { public void handleMessage(Message msg) { synchronized (CountDownTimer.this) { if (mCancelled) { return; } final long millisLeft = mStopTimeInFuture - SystemClock.elapsedRealtime(); if (millisLeft <= 0) { Loading Loading
core/java/android/os/CountDownTimer.java +12 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,11 @@ public abstract class CountDownTimer { private long mStopTimeInFuture; /** * boolean representing if the timer was cancelled */ private boolean mCancelled = false; /** * @param millisInFuture The number of millis in the future from the call * to {@link #start()} until the countdown is done and {@link #onFinish()} Loading @@ -70,7 +75,8 @@ public abstract class CountDownTimer { /** * Cancel the countdown. */ public final void cancel() { public synchronized final void cancel() { mCancelled = true; mHandler.removeMessages(MSG); } Loading @@ -78,6 +84,7 @@ public abstract class CountDownTimer { * Start the countdown. */ public synchronized final CountDownTimer start() { mCancelled = false; if (mMillisInFuture <= 0) { onFinish(); return this; Loading Loading @@ -110,6 +117,10 @@ public abstract class CountDownTimer { public void handleMessage(Message msg) { synchronized (CountDownTimer.this) { if (mCancelled) { return; } final long millisLeft = mStopTimeInFuture - SystemClock.elapsedRealtime(); if (millisLeft <= 0) { Loading