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

Commit ee6978dc authored by Sarah Kim's avatar Sarah Kim Committed by Sarah Chin
Browse files

Revert "RIL handle AIDL binder died for all services at the same time"

This reverts commit ec27b77d.

Reason for revert: b/260768727

Change-Id: I6c2cbc9e6b51109cf0050a32cfc691fbd9cb61e3
parent f6c02eb9
Loading
Loading
Loading
Loading
+14 −36
Original line number Diff line number Diff line
@@ -367,15 +367,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
                case EVENT_AIDL_PROXY_DEAD:
                    int aidlService = msg.arg1;
                    long msgCookie = (long) msg.obj;
                    if (msgCookie == mServiceCookies.get(aidlService).get()) {
                    riljLog("handleMessage: EVENT_AIDL_PROXY_DEAD cookie = " + msgCookie
                            + ", service = " + serviceToString(aidlService) + ", cookie = "
                            + mServiceCookies.get(aidlService));
                    if (msgCookie == mServiceCookies.get(aidlService).get()) {
                        mIsRadioProxyInitialized = false;
                        resetProxyAndRequestList(aidlService);
                    } else {
                        riljLog("Ignore stale EVENT_AIDL_PROXY_DEAD for service "
                                + serviceToString(aidlService));
                    }
                    break;
            }
@@ -420,7 +417,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        public void serviceDied(long cookie) {
            // Deal with service going away
            riljLog("serviceDied");
            mRilHandler.sendMessageAtFrontOfQueue(mRilHandler.obtainMessage(EVENT_RADIO_PROXY_DEAD,
            mRilHandler.sendMessage(mRilHandler.obtainMessage(EVENT_RADIO_PROXY_DEAD,
                    HAL_SERVICE_RADIO, 0 /* ignored arg2 */, cookie));
        }
    }
@@ -453,14 +450,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        @Override
        public void binderDied() {
            riljLog("Service " + serviceToString(mService) + " has died.");
            if (!mRilHandler.hasMessages(EVENT_AIDL_PROXY_DEAD)) {
                mRilHandler.sendMessageAtFrontOfQueue(mRilHandler.obtainMessage(
                        EVENT_AIDL_PROXY_DEAD, mService, 0 /* ignored arg2 */,
                        mServiceCookies.get(mService).get()));
            } else {
                riljLog("Not sending redundant EVENT_AIDL_PROXY_DEAD for service "
                        + serviceToString(mService));
            }
            mRilHandler.sendMessage(mRilHandler.obtainMessage(EVENT_AIDL_PROXY_DEAD, mService,
                    0 /* ignored arg2 */, mServiceCookies.get(mService).get()));
            unlinkToDeath();
        }
    }
@@ -469,19 +460,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
            mRadioProxy = null;
        } else {
            for (int i = MIN_SERVICE_IDX; i <= MAX_SERVICE_IDX; i++) {
                if (i == HAL_SERVICE_RADIO) continue;
                if (mServiceProxies.get(i) == null) {
                    // This should only happen in tests
                    riljLoge("Null service proxy for service " + serviceToString(i));
                    continue;
                }
                mServiceProxies.get(i).clear();
                // Increment the cookie so that death notification can be ignored
                mServiceCookies.get(i).incrementAndGet();
            }
            mServiceProxies.get(service).clear();
        }

        // Increment the cookie so that death notification can be ignored
        mServiceCookies.get(service).incrementAndGet();

        // TODO: If a service doesn't exist or is unimplemented, it shouldn't cause the radio to
        //  become unavailable for all other services
        setRadioState(TelephonyManager.RADIO_POWER_UNAVAILABLE, true /* forceNotifyRegistrants */);

        RILRequest.resetSerial();
@@ -491,15 +477,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
            getRadioProxy();
        } else {
            for (int i = MIN_SERVICE_IDX; i <= MAX_SERVICE_IDX; i++) {
                if (i == HAL_SERVICE_RADIO) continue;
                if (mServiceProxies.get(i) == null) {
                    // This should only happen in tests
                    riljLoge("Null service proxy for service " + serviceToString(i));
                    continue;
                }
                getRadioServiceProxy(i);
            }
            getRadioServiceProxy(service);
        }
    }