summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/os/Handler.java28
2 files changed, 29 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 892584661084..9741fbc0db7f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -31570,6 +31570,7 @@ package android.os {
method public final boolean postAtTime(java.lang.Runnable, long);
method public final boolean postAtTime(java.lang.Runnable, java.lang.Object, long);
method public final boolean postDelayed(java.lang.Runnable, long);
+ method public final boolean postDelayed(java.lang.Runnable, java.lang.Object, long);
method public final void removeCallbacks(java.lang.Runnable);
method public final void removeCallbacks(java.lang.Runnable, java.lang.Object);
method public final void removeCallbacksAndMessages(java.lang.Object);
diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java
index 3ca1005b8c98..5c5e351d2eeb 100644
--- a/core/java/android/os/Handler.java
+++ b/core/java/android/os/Handler.java
@@ -388,6 +388,8 @@ public class Handler {
* The runnable will be run on the thread to which this handler is attached.
*
* @param r The Runnable that will be executed.
+ * @param token An instance which can be used to cancel {@code r} via
+ * {@link #removeCallbacksAndMessages}.
* @param uptimeMillis The absolute time at which the callback should run,
* using the {@link android.os.SystemClock#uptimeMillis} time-base.
*
@@ -430,6 +432,32 @@ public class Handler {
}
/**
+ * Causes the Runnable r to be added to the message queue, to be run
+ * after the specified amount of time elapses.
+ * The runnable will be run on the thread to which this handler
+ * is attached.
+ * <b>The time-base is {@link android.os.SystemClock#uptimeMillis}.</b>
+ * Time spent in deep sleep will add an additional delay to execution.
+ *
+ * @param r The Runnable that will be executed.
+ * @param token An instance which can be used to cancel {@code r} via
+ * {@link #removeCallbacksAndMessages}.
+ * @param delayMillis The delay (in milliseconds) until the Runnable
+ * will be executed.
+ *
+ * @return Returns true if the Runnable was successfully placed in to the
+ * message queue. Returns false on failure, usually because the
+ * looper processing the message queue is exiting. Note that a
+ * result of true does not mean the Runnable will be processed --
+ * if the looper is quit before the delivery time of the message
+ * occurs then the message will be dropped.
+ */
+ public final boolean postDelayed(Runnable r, Object token, long delayMillis)
+ {
+ return sendMessageDelayed(getPostMessage(r, token), delayMillis);
+ }
+
+ /**
* Posts a message to an object that implements Runnable.
* Causes the Runnable r to executed on the next iteration through the
* message queue. The runnable will be run on the thread to which this