Merge "Send onCreatePredictionSession, sortAppTargets, requestPredictionUpdate immediately instead of sending them to main thread Looper queue of ChooserActivity." into rvc-dev

This commit is contained in:
Song Hu
2020-05-06 19:03:46 +00:00
committed by Android (Google) Code Review
3 changed files with 38 additions and 10 deletions

View File

@@ -321,6 +321,20 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
obtainMessage(AbstractRemoteService::handlePendingRequest, this, asyncRequest));
}
/**
* Executes an async request immediately instead of sending it to Handler queue as what
* {@link scheduleAsyncRequest} does.
*
* <p>This request is not expecting a callback from the service, hence it's represented by
* a simple {@link Runnable}.
*/
protected void executeAsyncRequest(@NonNull AsyncRequest<I> request) {
// TODO(b/117779333): fix generics below
@SuppressWarnings({"unchecked", "rawtypes"})
final MyAsyncPendingRequest<S, I> asyncRequest = new MyAsyncPendingRequest(this, request);
handlePendingRequest(asyncRequest);
}
private void cancelScheduledUnbind() {
mHandler.removeMessages(MSG_UNBIND);
}