diff options
author | Youngsang Cho <youngsang@google.com> | 2014-08-22 15:54:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-22 15:54:12 +0000 |
commit | e91f83c88e9e15897e498f061fbcb62e4e58e031 (patch) | |
tree | 8ba3f20e68fd76ea40400fdb702c5a2665c657b1 /media | |
parent | ece4a834e8ae6d7e7cf09cd3134a2acd8f8427bd (diff) | |
parent | 9044be13dc0b625f10c459574abdd22603f86d50 (diff) | |
download | frameworks_base-e91f83c88e9e15897e498f061fbcb62e4e58e031.zip frameworks_base-e91f83c88e9e15897e498f061fbcb62e4e58e031.tar.gz frameworks_base-e91f83c88e9e15897e498f061fbcb62e4e58e031.tar.bz2 |
Merge "Send notification messages immediatelly" into lmp-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/tv/TvInputService.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index e3292b6..4efbc30 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -300,7 +300,7 @@ public abstract class TvInputService extends Service { if (eventType == null) { throw new IllegalArgumentException("eventType should not be null."); } - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -319,7 +319,7 @@ public abstract class TvInputService extends Service { * @param channelUri The URI of a channel. */ public void notifyChannelRetuned(final Uri channelUri) { - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -351,7 +351,7 @@ public abstract class TvInputService extends Service { trackIdSet.clear(); // TODO: Validate the track list. - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -375,7 +375,7 @@ public abstract class TvInputService extends Service { * @see #onSelectTrack */ public void notifyTrackSelected(final int type, final String trackId) { - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -393,7 +393,7 @@ public abstract class TvInputService extends Service { * been started. */ public void notifyVideoAvailable() { - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -423,7 +423,7 @@ public abstract class TvInputService extends Service { || reason > TvInputManager.VIDEO_UNAVAILABLE_REASON_END) { throw new IllegalArgumentException("Unknown reason: " + reason); } - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -462,7 +462,7 @@ public abstract class TvInputService extends Service { * @see TvInputManager */ public void notifyContentAllowed() { - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -502,7 +502,7 @@ public abstract class TvInputService extends Service { * @see TvInputManager */ public void notifyContentBlocked(final TvContentRating rating) { - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -531,7 +531,7 @@ public abstract class TvInputService extends Service { if (left > right || top > bottm) { throw new IllegalArgumentException("Invalid parameter"); } - mHandler.post(new Runnable() { + runOnMainThread(new Runnable() { @Override public void run() { try { @@ -1049,6 +1049,14 @@ public abstract class TvInputService extends Service { private void setSessionCallback(ITvInputSessionCallback callback) { mSessionCallback = callback; } + + private final void runOnMainThread(Runnable action) { + if (mHandler.getLooper().isCurrentThread()) { + action.run(); + } else { + mHandler.post(action); + } + } } /** |