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

Commit 5475c166 authored by Shuaihui Ren's avatar Shuaihui Ren Committed by terrycrhuang
Browse files

Correct the value of cookie

The cookie in EVENT_AIDL_PROXY_DEAD is used to check if the death
notification should be ignored. The cookie object is passed by reference which causes the msg.obj.get() always equal to mServiceCookies.get(aidlService).get() when handling EVENT_AIDL_PROXY_DEAD. So pass the long type value of cookie in EVENT_AIDL_PROXY_DEAD message. And since the service is RADIO_SERVICE when handling EVENT_RADIO_PROXY_DEAD, the cookie of RADIO_SERVICE should be used for linkToDeath() when radio version is less than 2.0.

Bug: 258390132
Test: Manual test by force killing RILD
Change-Id: I7087f01fb56a611c21a2f976b05b85f67dafa50b
parent cce2ff30
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -387,11 +387,11 @@ public class RIL extends BaseCommands implements CommandsInterface {

                case EVENT_AIDL_PROXY_DEAD:
                    int aidlService = msg.arg1;
                    AtomicLong obj = (AtomicLong) msg.obj;
                    riljLog("handleMessage: EVENT_AIDL_PROXY_DEAD cookie = " + msg.obj
                    long msgCookie = (long) msg.obj;
                    riljLog("handleMessage: EVENT_AIDL_PROXY_DEAD cookie = " + msgCookie
                            + ", service = " + serviceToString(aidlService) + ", cookie = "
                            + mServiceCookies.get(aidlService));
                    if (obj.get() == mServiceCookies.get(aidlService).get()) {
                    if (msgCookie == mServiceCookies.get(aidlService).get()) {
                        mIsRadioProxyInitialized = false;
                        resetProxyAndRequestList(aidlService);
                    }
@@ -473,7 +473,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        public void binderDied() {
            riljLog("Service " + serviceToString(mService) + " has died.");
            mRilHandler.sendMessage(mRilHandler.obtainMessage(EVENT_AIDL_PROXY_DEAD, mService,
                    0 /* ignored arg2 */, mServiceCookies.get(mService)));
                    0 /* ignored arg2 */, mServiceCookies.get(mService).get()));
            unlinkToDeath();
        }
    }
@@ -1072,7 +1072,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        if (!mIsRadioProxyInitialized) {
                            mIsRadioProxyInitialized = true;
                            serviceProxy.getHidl().linkToDeath(mRadioProxyDeathRecipient,
                                    mServiceCookies.get(service).incrementAndGet());
                                    mServiceCookies.get(HAL_SERVICE_RADIO).incrementAndGet());
                            serviceProxy.getHidl().setResponseFunctions(
                                    mRadioResponse, mRadioIndication);
                        }