Add MediaUtilsTest

PiperOrigin-RevId: 344384426
This commit is contained in:
sungsoo 2020-11-26 09:41:34 +00:00 committed by Andrew Lewis
parent 4602e3a927
commit 43713abe79

View file

@ -508,6 +508,10 @@ public final class Util {
* run. {@code false} otherwise.
*/
public static boolean postOrRun(Handler handler, Runnable runnable) {
Looper looper = handler.getLooper();
if (!looper.getThread().isAlive()) {
return false;
}
if (handler.getLooper() == Looper.myLooper()) {
runnable.run();
return true;