summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yifei Zhang <yfz@google.com> 2024-12-30 17:16:37 -0800
committer Yifei Zhang <yfz@google.com> 2024-12-30 17:16:37 -0800
commit303e42fb57bba4ce804cbf6f39febb45501d7a50 (patch)
tree8d1f5bb168745048cfce812acf14edbe31cb034c
parent9330fc991c646110d2c47e38974a9704bcb60826 (diff)
contexthub: fix NPE at handleServiceRestart
NPE is possible when mHubInfoRegistry doesn't exist. Skip recovery logic. Bug: 386842901 Test: build Flag: EXEMPT, bug fix Change-Id: I85525b8d3fc6e704b4f68ad2f31fbfcb458d3f2d
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubService.java4
1 files changed, 3 insertions, 1 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 165f9d3340e3..f91b030dd1ba 100644
--- a/services/core/java/com/android/server/location/contexthub/ContextHubService.java
+++ b/services/core/java/com/android/server/location/contexthub/ContextHubService.java
@@ -256,7 +256,9 @@ public class ContextHubService extends IContextHubService.Stub {
public void handleServiceRestart() {
Log.i(TAG, "Recovering from Context Hub HAL restart...");
initExistingCallbacks();
- mHubInfoRegistry.onHalRestart();
+ if (mHubInfoRegistry != null) {
+ mHubInfoRegistry.onHalRestart();
+ }
resetSettings();
if (Flags.reconnectHostEndpointsAfterHalRestart()) {
mClientManager.forEachClientOfHub(mContextHubId,