summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lei Ju <leiju@google.com> 2023-02-15 16:31:49 -0800
committer Lei Ju <leiju@google.com> 2023-02-23 12:05:29 -0800
commit92e8b01449d010080c5651959b274364a5dbeb96 (patch)
tree4e493453606f6f4007fc0d65c9bbc269b589e0c8
parent9007d0a77e62da8bcb3382da31dfd2867b198bb0 (diff)
Register callback before calling other hal APIs
Test: manual test on a device Bug: 269525639 Change-Id: I97944079d78c1723a5422e7ac9b019ce61aaafbd Merged-In: I97944079d78c1723a5422e7ac9b019ce61aaafbd
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubService.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubService.java b/services/core/java/com/android/server/location/contexthub/ContextHubService.java
index 8f657756eed3..25fd5eaed5a4 100644
--- a/services/core/java/com/android/server/location/contexthub/ContextHubService.java
+++ b/services/core/java/com/android/server/location/contexthub/ContextHubService.java
@@ -370,11 +370,6 @@ public class ContextHubService extends IContextHubService.Stub {
mLastRestartTimestampMap.put(contextHubId,
new AtomicLong(SystemClock.elapsedRealtimeNanos()));
- IContextHubClient client = mClientManager.registerClient(
- contextHubInfo, createDefaultClientCallback(contextHubId),
- /* attributionTag= */ null, mTransactionManager, mContext.getPackageName());
- defaultClientMap.put(contextHubId, client);
-
try {
mContextHubWrapper.registerCallback(contextHubId,
new ContextHubServiceCallback(contextHubId));
@@ -383,6 +378,11 @@ public class ContextHubService extends IContextHubService.Stub {
+ contextHubId + ")", e);
}
+ IContextHubClient client = mClientManager.registerClient(
+ contextHubInfo, createDefaultClientCallback(contextHubId),
+ /* attributionTag= */ null, mTransactionManager, mContext.getPackageName());
+ defaultClientMap.put(contextHubId, client);
+
// Do a query to initialize the service cache list of nanoapps
// TODO(b/194289715): Remove this when old API is deprecated
queryNanoAppsInternal(contextHubId);