diff options
| author | 2013-04-01 13:00:33 -0700 | |
|---|---|---|
| committer | 2013-04-01 14:27:57 -0700 | |
| commit | 67fc67cf3e1dba17b0eae4f3923f3e93a78c7575 (patch) | |
| tree | f1fe18baf44caa53ada1f970e4c1c06ce950e822 | |
| parent | 53de5c296a579e9012d152f8a25c08f6f6091b3b (diff) | |
Make MessageQueue and Looper final.
Applications already cannot subclass these classes because
their constructors are not visible.
Change-Id: Id979d86dd05f7bcc888fe4ea499ab9b95d3d5dde
| -rw-r--r-- | api/current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/os/Looper.java | 6 | ||||
| -rw-r--r-- | core/java/android/os/MessageQueue.java | 26 |
3 files changed, 20 insertions, 20 deletions
diff --git a/api/current.txt b/api/current.txt index 31acb354cfdf..3da60967cc94 100644 --- a/api/current.txt +++ b/api/current.txt @@ -16509,7 +16509,7 @@ package android.os { method public abstract android.os.IBinder asBinder(); } - public class Looper { + public final class Looper { method public void dump(android.util.Printer, java.lang.String); method public static android.os.Looper getMainLooper(); method public java.lang.Thread getThread(); @@ -16564,9 +16564,9 @@ package android.os { field public int what; } - public class MessageQueue { - method public final void addIdleHandler(android.os.MessageQueue.IdleHandler); - method public final void removeIdleHandler(android.os.MessageQueue.IdleHandler); + public final class MessageQueue { + method public void addIdleHandler(android.os.MessageQueue.IdleHandler); + method public void removeIdleHandler(android.os.MessageQueue.IdleHandler); } public static abstract interface MessageQueue.IdleHandler { diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java index 02135bc18e9d..38f4d5e54f13 100644 --- a/core/java/android/os/Looper.java +++ b/core/java/android/os/Looper.java @@ -50,7 +50,7 @@ import android.util.PrefixPrinter; * } * }</pre> */ -public class Looper { +public final class Looper { private static final String TAG = "Looper"; // sThreadLocal.get() will return null unless you've called prepare(). @@ -223,7 +223,7 @@ public class Looper { * * @hide */ - public final int postSyncBarrier() { + public int postSyncBarrier() { return mQueue.enqueueSyncBarrier(SystemClock.uptimeMillis()); } @@ -238,7 +238,7 @@ public class Looper { * * @hide */ - public final void removeSyncBarrier(int token) { + public void removeSyncBarrier(int token) { mQueue.removeSyncBarrier(token); } diff --git a/core/java/android/os/MessageQueue.java b/core/java/android/os/MessageQueue.java index 222578a95513..e0d40c96aafa 100644 --- a/core/java/android/os/MessageQueue.java +++ b/core/java/android/os/MessageQueue.java @@ -29,7 +29,7 @@ import java.util.ArrayList; * <p>You can retrieve the MessageQueue for the current thread with * {@link Looper#myQueue() Looper.myQueue()}. */ -public class MessageQueue { +public final class MessageQueue { // True if the message queue can be quit. private final boolean mQuitAllowed; @@ -78,7 +78,7 @@ public class MessageQueue { * * @param handler The IdleHandler to be added. */ - public final void addIdleHandler(IdleHandler handler) { + public void addIdleHandler(IdleHandler handler) { if (handler == null) { throw new NullPointerException("Can't add a null IdleHandler"); } @@ -94,7 +94,7 @@ public class MessageQueue { * * @param handler The IdleHandler to be removed. */ - public final void removeIdleHandler(IdleHandler handler) { + public void removeIdleHandler(IdleHandler handler) { synchronized (this) { mIdleHandlers.remove(handler); } @@ -121,7 +121,7 @@ public class MessageQueue { } } - final Message next() { + Message next() { int pendingIdleHandlerCount = -1; // -1 only during first iteration int nextPollTimeoutMillis = 0; @@ -218,7 +218,7 @@ public class MessageQueue { } } - final void quit() { + void quit() { if (!mQuitAllowed) { throw new RuntimeException("Main thread not allowed to quit."); } @@ -232,7 +232,7 @@ public class MessageQueue { nativeWake(mPtr); } - final int enqueueSyncBarrier(long when) { + int enqueueSyncBarrier(long when) { // Enqueue a new sync barrier token. // We don't need to wake the queue because the purpose of a barrier is to stall it. synchronized (this) { @@ -259,7 +259,7 @@ public class MessageQueue { } } - final void removeSyncBarrier(int token) { + void removeSyncBarrier(int token) { // Remove a sync barrier token from the queue. // If the queue is no longer stalled by a barrier then wake it. final boolean needWake; @@ -288,7 +288,7 @@ public class MessageQueue { } } - final boolean enqueueMessage(Message msg, long when) { + boolean enqueueMessage(Message msg, long when) { if (msg.isInUse()) { throw new AndroidRuntimeException(msg + " This message is already in use."); } @@ -338,7 +338,7 @@ public class MessageQueue { return true; } - final boolean hasMessages(Handler h, int what, Object object) { + boolean hasMessages(Handler h, int what, Object object) { if (h == null) { return false; } @@ -355,7 +355,7 @@ public class MessageQueue { } } - final boolean hasMessages(Handler h, Runnable r, Object object) { + boolean hasMessages(Handler h, Runnable r, Object object) { if (h == null) { return false; } @@ -372,7 +372,7 @@ public class MessageQueue { } } - final void removeMessages(Handler h, int what, Object object) { + void removeMessages(Handler h, int what, Object object) { if (h == null) { return; } @@ -406,7 +406,7 @@ public class MessageQueue { } } - final void removeMessages(Handler h, Runnable r, Object object) { + void removeMessages(Handler h, Runnable r, Object object) { if (h == null || r == null) { return; } @@ -440,7 +440,7 @@ public class MessageQueue { } } - final void removeCallbacksAndMessages(Handler h, Object object) { + void removeCallbacksAndMessages(Handler h, Object object) { if (h == null) { return; } |