Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f97f208d authored by Jordan Liu's avatar Jordan Liu
Browse files

Catch exception when unbinding

This is a temporary fix to prevent the exception from crashing the phone
process.

Bug: 149946894
Test: manual and unit tests
Change-Id: I2d9d5f02f5123eb6658272bc5f53bb53906d5be6
Merged-In: I2d9d5f02f5123eb6658272bc5f53bb53906d5be6
parent 7dbf2457
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -282,6 +282,7 @@ public class CarrierServiceBindHelper {
                                Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,
                                (r) -> mHandler.post(r),
                                connection)) {
                    log("service bound");
                    mServiceBound = true;
                    return;
                }
@@ -340,7 +341,12 @@ public class CarrierServiceBindHelper {
            if (mServiceBound) {
                log("Unbinding from carrier app");
                mServiceBound = false;
                try {
                    mContext.unbindService(connection);
                } catch (IllegalArgumentException e) {
                    //TODO(b/151328766): Figure out why we unbind without binding
                    loge("Tried to unbind without binding e=" + e);
                }
            } else {
                log("Not bound, skipping unbindService call");
            }