After this method returns, subsequent calls to {@link #isDone} will * always return true. Subsequent calls to {@link #isCancelled} * will always return true if this method returned true. * * @param mayInterruptIfRunning true if the thread executing this * task should be interrupted; otherwise, in-progress tasks are allowed * to complete * @return false if the task could not be cancelled, * typically because it has already completed normally; * true otherwise */ boolean cancel(boolean mayInterruptIfRunning); /** * Returns true if this task was cancelled before it completed * normally. * * @return true if this task was cancelled before it completed */ boolean isCancelled(); /** * Returns true if this task completed. * * Completion may be due to normal termination, an exception, or * cancellation -- in all of these cases, this method will return * true. * * @return true if this task completed */ boolean isDone(); /** * Wrapper for {@link java.util.concurrent.Future#get()}. If the get() throws * {@link InterruptedException} then the * {@link AccountManagerFuture} is canceled and * {@link android.accounts.OperationCanceledException} is thrown. * @return the {@link android.os.Bundle} that is returned by get() * @throws android.accounts.OperationCanceledException if get() throws the unchecked * CancellationException * or if the Future was interrupted. */ V getResult() throws OperationCanceledException, IOException, AuthenticatorException; /** * Wrapper for {@link java.util.concurrent.Future#get()}. If the get() throws * {@link InterruptedException} then the * {@link AccountManagerFuture} is canceled and * {@link android.accounts.OperationCanceledException} is thrown. * @param timeout the maximum time to wait * @param unit the time unit of the timeout argument * @return the {@link android.os.Bundle} that is returned by * {@link java.util.concurrent.Future#get()} * @throws android.accounts.OperationCanceledException if get() throws the unchecked * {@link java.util.concurrent.CancellationException} or if the {@link AccountManagerFuture} * was interrupted. */ V getResult(long timeout, TimeUnit unit) throws OperationCanceledException, IOException, AuthenticatorException; }