From b4a7acf9fd3af745efaf3093ad9fe1470c88a02f Mon Sep 17 00:00:00 2001 From: Pranav Madapurmath Date: Wed, 13 Aug 2025 10:47:58 -0700 Subject: [PATCH] Catch IllegalArgumentException when unbinding CallRedirectionServiceConnection Wrap the `mContext.unbindService` call in a try-catch block to handle `IllegalArgumentException`. This can occur if the service connection isn't registered when the timeout occurs, preventing a crash. Bug: 438408401 Flag: EXEMPT bug fix Test: m Telecom (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:615a452b1eb9a1165b6892b715ca9acb39c9fc48) Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:6688e377e404f55c90a2873b96f2fdfa1c7de408 Merged-In: I9494b1bf209579125b30fb859ad62cd58b5dffd7 Change-Id: I9494b1bf209579125b30fb859ad62cd58b5dffd7 --- .../telecom/callredirection/CallRedirectionProcessor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java b/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java index 15b8aa942..96c5a0638 100644 --- a/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java +++ b/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java @@ -136,8 +136,12 @@ public class CallRedirectionProcessor implements CallRedirectionCallback { Log.i(this, "notifyTimeout: call redirection has timed out so " + "unbinding the connection"); if (mConnection != null) { - // We still need to call unbind even if the service disconnected. - mContext.unbindService(mConnection); + try { + // We still need to call unbind even if the service disconnected. + mContext.unbindService(mConnection); + } catch (IllegalArgumentException e) { + Log.e(this, e, "Error unbinding the connection"); + } mConnection = null; } mService = null; -- GitLab