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

Commit 9ca6fb1b authored by Rambo Wang's avatar Rambo Wang Committed by Automerger Merge Worker
Browse files

Merge "CarrierServiceBindHelper: context mismatch in bindService vs unbindservice" am: 5b78b2ff

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

Change-Id: Ibf19c88b39bd3af54d562ded7d4170d8da1a597c
parents bfe2397f 5b78b2ff
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public class CarrierServiceBindHelper {
    };

    public CarrierServiceBindHelper(Context context) {
        mContext = context;
        mContext = context.createContextAsUser(Process.myUserHandle(), 0);

        updateBindingsAndSimStates();

@@ -283,8 +283,8 @@ public class CarrierServiceBindHelper {

            String error;
            try {
                if (mContext.createContextAsUser(Process.myUserHandle(), 0)
                        .bindService(carrierService,
                if (mContext.bindService(
                        carrierService,
                        Context.BIND_AUTO_CREATE
                                | Context.BIND_FOREGROUND_SERVICE
                                | Context.BIND_INCLUDE_CAPABILITIES,
@@ -350,12 +350,7 @@ public class CarrierServiceBindHelper {
            if (mServiceBound) {
                logdWithLocalLog("Unbinding from carrier app");
                mServiceBound = false;
                try {
                mContext.unbindService(connection);
                } catch (IllegalArgumentException e) {
                    //TODO(b/151328766): Figure out why we unbind without binding
                    logeWithLocalLog("Tried to unbind without binding e=" + e);
                }
            } else {
                logdWithLocalLog("Not bound, skipping unbindService call");
            }