diff --git a/core/java/com/android/internal/infra/ServiceConnector.java b/core/java/com/android/internal/infra/ServiceConnector.java index cb162674eb167..6489c8ed30aea 100644 --- a/core/java/com/android/internal/infra/ServiceConnector.java +++ b/core/java/com/android/internal/infra/ServiceConnector.java @@ -745,6 +745,10 @@ public interface ServiceConnector { boolean mAsync = false; private String mDebugName; { + // The timeout handler must be set before any calls to set timeouts on the + // AndroidFuture, to ensure they are posted on the proper thread. + setTimeoutHandler(getJobHandler()); + long requestTimeout = getRequestTimeoutMs(); if (requestTimeout > 0) { orTimeout(requestTimeout, TimeUnit.MILLISECONDS);