diff options
| author | 2024-04-02 13:19:54 +0000 | |
|---|---|---|
| committer | 2024-04-02 13:19:54 +0000 | |
| commit | 91a71dedac1e9c7f42a2ec021b2603cf76c38291 (patch) | |
| tree | 07717568d38947916d946167cbd835c1b273fd56 | |
| parent | 7225a89001e026e880e3e642bf55dd5db0547903 (diff) | |
| parent | 95ebdf396a67f686429ba6fd326caba70a59d3b3 (diff) | |
Merge "Fixing NPE before calling unbind" into main
| -rw-r--r-- | services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java | 12 |
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 |