mirror of https://github.com/Genymobile/scrcpy
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
574 B
Java
24 lines
574 B
Java
package com.genymobile.scrcpy;
|
|
|
|
import android.os.Handler;
|
|
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.RejectedExecutionException;
|
|
|
|
// Inspired from hidden android.os.HandlerExecutor
|
|
|
|
public class HandlerExecutor implements Executor {
|
|
private final Handler handler;
|
|
|
|
public HandlerExecutor(Handler handler) {
|
|
this.handler = handler;
|
|
}
|
|
|
|
@Override
|
|
public void execute(Runnable command) {
|
|
if (!handler.post(command)) {
|
|
throw new RejectedExecutionException(handler + " is shutting down");
|
|
}
|
|
}
|
|
}
|