Loading core/java/android/os/Message.java +14 −1 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ public final class Message implements Parcelable { */ public Messenger replyTo; /*package*/ static final int FLAG_IN_USE = 1; /*package*/ int flags; /*package*/ long when; /*package*/ Bundle data; Loading Loading @@ -253,6 +257,7 @@ public final class Message implements Parcelable { * target/callback of the original message. */ public void copyFrom(Message o) { this.flags = o.flags; this.what = o.what; this.arg1 = o.arg1; this.arg2 = o.arg2; Loading Loading @@ -350,6 +355,7 @@ public final class Message implements Parcelable { } /*package*/ void clearForRecycle() { flags = 0; what = 0; arg1 = 0; arg2 = 0; Loading @@ -361,6 +367,14 @@ public final class Message implements Parcelable { data = null; } /*package*/ boolean isInUse() { return ((flags & FLAG_IN_USE) == FLAG_IN_USE); } /*package*/ void markInUse() { flags |= FLAG_IN_USE; } /** Constructor (but the preferred way to get a Message is to call {@link #obtain() Message.obtain()}). */ public Message() { Loading Loading @@ -453,4 +467,3 @@ public final class Message implements Parcelable { replyTo = Messenger.readMessengerOrNullFromParcel(source); } } core/java/android/os/MessageQueue.java +2 −1 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ public class MessageQueue { now = SystemClock.uptimeMillis(); Message msg = pullNextLocked(now); if (msg != null) { msg.markInUse(); return msg; } Loading Loading @@ -192,7 +193,7 @@ public class MessageQueue { } final boolean enqueueMessage(Message msg, long when) { if (msg.when != 0) { if (msg.isInUse()) { throw new AndroidRuntimeException(msg + " This message is already in use."); } Loading core/tests/coretests/src/android/os/MessageQueueTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,10 @@ public class MessageQueueTest extends TestCase { } public void handleMessage(Message msg) { if (!msg.isInUse()) { failure(new RuntimeException( "msg.isInuse is false, should always be true, #" + msg.what)); } if (mCount <= mLastMessage) { if (msg.what != mCount) { failure(new RuntimeException( Loading Loading @@ -100,4 +104,3 @@ public class MessageQueueTest extends TestCase { tester.doTest(1000); } } Loading
core/java/android/os/Message.java +14 −1 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ public final class Message implements Parcelable { */ public Messenger replyTo; /*package*/ static final int FLAG_IN_USE = 1; /*package*/ int flags; /*package*/ long when; /*package*/ Bundle data; Loading Loading @@ -253,6 +257,7 @@ public final class Message implements Parcelable { * target/callback of the original message. */ public void copyFrom(Message o) { this.flags = o.flags; this.what = o.what; this.arg1 = o.arg1; this.arg2 = o.arg2; Loading Loading @@ -350,6 +355,7 @@ public final class Message implements Parcelable { } /*package*/ void clearForRecycle() { flags = 0; what = 0; arg1 = 0; arg2 = 0; Loading @@ -361,6 +367,14 @@ public final class Message implements Parcelable { data = null; } /*package*/ boolean isInUse() { return ((flags & FLAG_IN_USE) == FLAG_IN_USE); } /*package*/ void markInUse() { flags |= FLAG_IN_USE; } /** Constructor (but the preferred way to get a Message is to call {@link #obtain() Message.obtain()}). */ public Message() { Loading Loading @@ -453,4 +467,3 @@ public final class Message implements Parcelable { replyTo = Messenger.readMessengerOrNullFromParcel(source); } }
core/java/android/os/MessageQueue.java +2 −1 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ public class MessageQueue { now = SystemClock.uptimeMillis(); Message msg = pullNextLocked(now); if (msg != null) { msg.markInUse(); return msg; } Loading Loading @@ -192,7 +193,7 @@ public class MessageQueue { } final boolean enqueueMessage(Message msg, long when) { if (msg.when != 0) { if (msg.isInUse()) { throw new AndroidRuntimeException(msg + " This message is already in use."); } Loading
core/tests/coretests/src/android/os/MessageQueueTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,10 @@ public class MessageQueueTest extends TestCase { } public void handleMessage(Message msg) { if (!msg.isInUse()) { failure(new RuntimeException( "msg.isInuse is false, should always be true, #" + msg.what)); } if (mCount <= mLastMessage) { if (msg.what != mCount) { failure(new RuntimeException( Loading Loading @@ -100,4 +104,3 @@ public class MessageQueueTest extends TestCase { tester.doTest(1000); } }