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

Commit 469cf9ad authored by Rambo Wang's avatar Rambo Wang Committed by Automerger Merge Worker
Browse files

Merge "Always call unbindService no matter what bindService returns" am:...

Merge "Always call unbindService no matter what bindService returns" am: b0a32912 am: 220b1056 am: edcb2dd7 am: a438d8df am: 0651ff84

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1854666

Change-Id: Ie20c31e3de972e9503d9f2df505307aa0c15d2ac
parents 6142ad67 0651ff84
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -71,9 +71,6 @@ public class CarrierServiceBindHelper {
    private final PackageChangeReceiver mPackageMonitor = new CarrierServicePackageMonitor();
    private final LocalLog mLocalLog = new LocalLog(100);

    // whether we have successfully bound to the service
    private boolean mServiceBound = false;

    private BroadcastReceiver mUserUnlockedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -291,7 +288,6 @@ public class CarrierServiceBindHelper {
                        (r) -> mHandler.post(r),
                        connection)) {
                    logdWithLocalLog("service bound");
                    mServiceBound = true;
                    return;
                }

@@ -346,17 +342,14 @@ public class CarrierServiceBindHelper {
            carrierPackage = null;
            carrierServiceClass = null;

            // Actually unbind
            if (mServiceBound) {
                logdWithLocalLog("Unbinding from carrier app");
                mServiceBound = false;
            // Always call unbindService, no matter if bindService succeed.
            if (connection != null) {
                mContext.unbindService(connection);
            } else {
                logdWithLocalLog("Not bound, skipping unbindService call");
            }
                logdWithLocalLog("Unbinding from carrier app");
                connection = null;
                mUnbindScheduledUptimeMillis = -1;
            }
        }

        private void cancelScheduledUnbind() {
            logdWithLocalLog("cancelScheduledUnbind");