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

Commit 1f515af2 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 c588593f.

Reason for revert: b/260768727

Change-Id: I8043a9d6e63e1c3c6df34a3fd11ded8932de8d51
Merged-In: I6c2cbc9e6b51109cf0050a32cfc691fbd9cb61e3
parent c689b1f4
Loading
Loading
Loading
Loading
+14 −36
Original line number Diff line number Diff line
@@ -385,15 +385,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;
            }
@@ -438,7 +435,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));
        }
    }
@@ -471,14 +468,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();
        }
    }
@@ -487,19 +478,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();
@@ -509,15 +495,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
            getRadioProxy(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;
                }
                getRadioServiceProxy(i, null);
            }
            getRadioServiceProxy(service, null);
        }
    }