Merge "Propagate exceptions in RemoteInputConnectionImpl"

This commit is contained in:
TreeHugger Robot
2021-09-02 00:14:23 +00:00
committed by Android (Google) Code Review

View File

@@ -752,6 +752,15 @@ public final class RemoteInputConnectionImpl extends IInputContext.Stub {
private <T> void dispatch(@NonNull AndroidFuture untypedFuture, @NonNull Supplier<T> supplier) {
@SuppressWarnings("unchecked")
final AndroidFuture<T> future = untypedFuture;
dispatch(() -> future.complete(supplier.get()));
dispatch(() -> {
final T result;
try {
result = supplier.get();
} catch (Throwable throwable) {
future.completeExceptionally(throwable);
throw throwable;
}
future.complete(result);
});
}
}