Use CompletableFuture instead
This CL converts our inhouse Completable class with CompletableFuture.
One of downsides of switching into CompletableFuture is performance.
It creates much more objects, especially in unsuccessful cases
including timeout scenarios:
* CompletableFuture#cancel() always creates a CancellationException
object with full stack trace. This is going to be problematic when
we start cancelling pending InputConnection tasks in Bug 195115071
from the IME client side.
* Timeout cases always creates a TimeoutException object with a full
stack trace.
* Exception cases always creates a ExecutionException object with
full stack trace.
Also, none of its getter methods directly fits our existing use cases
in the input method framework world. We must always use
CompletableFutureUtil to retrieve the result value so as not to
accidentally break existing APIs.
Other than above, there should be no observable semantic behavior
changes in this CL.
Bug: 192412909
Bug: 195699814
Test: presubmit
Test: atest -c FrameworksCoreTests:CompletableFutureUtilTest
Change-Id: I215bbc870f952effa262fa431064b36ace28e8f4
8 files changed