diff options
| author | 2017-12-20 16:11:53 -0800 | |
|---|---|---|
| committer | 2017-12-21 11:03:50 -0800 | |
| commit | 9b9c9d85e8109ff82eb62227d3fdfa8a9b25edac (patch) | |
| tree | 507e1c2e015dbc88acde11ed4778b3a2e7bcab1a | |
| parent | e35a6debaaec952800cf74020886e6bb50618f7d (diff) | |
Adds a createClient method with no Executor argument
Bug: 67734082
Test: make
Change-Id: Id2d6cb6d125ed0f58ebafc5d6e45aff4408595bf
| -rw-r--r-- | core/java/android/hardware/location/ContextHubManager.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/hardware/location/ContextHubManager.java b/core/java/android/hardware/location/ContextHubManager.java index aadfec080195..4cea0acd3809 100644 --- a/core/java/android/hardware/location/ContextHubManager.java +++ b/core/java/android/hardware/location/ContextHubManager.java @@ -23,6 +23,7 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.content.Context; import android.os.Handler; +import android.os.HandlerExecutor; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; @@ -601,6 +602,25 @@ public final class ContextHubManager { } /** + * Equivalent to {@link #createClient(ContextHubInfo, ContextHubClientCallback, Executor)} + * with the executor using the main thread's Looper. + * + * @param hubInfo the hub to attach this client to + * @param callback the notification callback to register + * @return the registered client object + * + * @throws IllegalArgumentException if hubInfo does not represent a valid hub + * @throws IllegalStateException if there were too many registered clients at the service + * @throws NullPointerException if callback or hubInfo is null + * @hide + * @see ContextHubClientCallback + */ + @NonNull public ContextHubClient createClient( + @NonNull ContextHubInfo hubInfo, @NonNull ContextHubClientCallback callback) { + return createClient(hubInfo, callback, new HandlerExecutor(Handler.getMain())); + } + + /** * Unregister a callback for receive messages from the context hub. * * @see Callback |