mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Don't forward main looper messages to custom looper.
Our current custom looper implementation tries to handle all messages including those sent to the main looper. However, the main looper does not use our doLoop implementation and thus messages never get executed. This adds a check whether the target looper is the main looper and if so, uses the default message forwarding implementation. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194779214
This commit is contained in:
parent
410264954f
commit
c1e3cb767e
1 changed files with 4 additions and 2 deletions
|
|
@ -156,8 +156,10 @@ public final class RobolectricUtil {
|
|||
@Override
|
||||
public boolean enqueueMessage(Message msg, long when) {
|
||||
ShadowLooper looper = shadowOf(ShadowLooper.getLooperForThread(looperThread));
|
||||
if (looper instanceof CustomLooper) {
|
||||
if (looper instanceof CustomLooper && looper != ShadowLooper.getShadowMainLooper()) {
|
||||
((CustomLooper) looper).addPendingMessage(msg, when);
|
||||
} else {
|
||||
super.enqueueMessage(msg, when);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -165,7 +167,7 @@ public final class RobolectricUtil {
|
|||
@Implementation
|
||||
public void removeMessages(Handler handler, int what, Object object) {
|
||||
ShadowLooper looper = shadowOf(ShadowLooper.getLooperForThread(looperThread));
|
||||
if (looper instanceof CustomLooper) {
|
||||
if (looper instanceof CustomLooper && looper != ShadowLooper.getShadowMainLooper()) {
|
||||
((CustomLooper) looper).removeMessages(handler, what, object);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue