(Context context)
| 376 | } |
| 377 | |
| 378 | void cancel(Context context) { |
| 379 | try { |
| 380 | ExecutorService executor = getExecutor(context); |
| 381 | if (executor instanceof ThreadPoolExecutor && future instanceof Runnable) { |
| 382 | boolean removed = ((ThreadPoolExecutor) executor).remove((Runnable) future); |
| 383 | Log.i("Remove task=" + name + " removed=" + removed); |
| 384 | } |
| 385 | } catch (Throwable ex) { |
| 386 | Log.e(ex); |
| 387 | } |
| 388 | |
| 389 | if (future != null && future.cancel(false)) { |
| 390 | Log.i("Cancelled task=" + name); |
| 391 | cleanup(context); |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | private void cleanup(Context context) { |
| 396 | started = 0; |
no test coverage detected