summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java b/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java
index d39debb8458f..a4a6221a25ab 100644
--- a/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java
+++ b/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java
@@ -539,10 +539,14 @@ public class OnDeviceIntelligenceManagerService extends SystemService {
Manifest.permission.USE_ON_DEVICE_INTELLIGENCE, TAG);
synchronized (mLock) {
mTemporaryServiceNames = componentNames;
- mRemoteInferenceService.unbind();
- mRemoteOnDeviceIntelligenceService.unbind();
- mRemoteOnDeviceIntelligenceService = null;
- mRemoteInferenceService = null;
+ if (mRemoteInferenceService != null) {
+ mRemoteInferenceService.unbind();
+ mRemoteInferenceService = null;
+ }
+ if (mRemoteOnDeviceIntelligenceService != null) {
+ mRemoteOnDeviceIntelligenceService.unbind();
+ mRemoteOnDeviceIntelligenceService = null;
+ }
if (mTemporaryHandler == null) {
mTemporaryHandler = new Handler(Looper.getMainLooper(), null, true) {
@Override