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

Commit 819c81bb authored by Sarah Kim's avatar Sarah Kim Committed by Automerger Merge Worker
Browse files

Revert "RIL handle AIDL binder died for all services at the same time" am: 1f515af2

parents 0e8f6827 1f515af2
Loading
Loading
Loading
Loading
+14 −36
Original line number Original line Diff line number Diff line
@@ -385,15 +385,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
                case EVENT_AIDL_PROXY_DEAD:
                case EVENT_AIDL_PROXY_DEAD:
                    int aidlService = msg.arg1;
                    int aidlService = msg.arg1;
                    long msgCookie = (long) msg.obj;
                    long msgCookie = (long) msg.obj;
                    if (msgCookie == mServiceCookies.get(aidlService).get()) {
                    riljLog("handleMessage: EVENT_AIDL_PROXY_DEAD cookie = " + msgCookie
                    riljLog("handleMessage: EVENT_AIDL_PROXY_DEAD cookie = " + msgCookie
                            + ", service = " + serviceToString(aidlService) + ", cookie = "
                            + ", service = " + serviceToString(aidlService) + ", cookie = "
                            + mServiceCookies.get(aidlService));
                            + mServiceCookies.get(aidlService));
                    if (msgCookie == mServiceCookies.get(aidlService).get()) {
                        mIsRadioProxyInitialized = false;
                        mIsRadioProxyInitialized = false;
                        resetProxyAndRequestList(aidlService);
                        resetProxyAndRequestList(aidlService);
                    } else {
                        riljLog("Ignore stale EVENT_AIDL_PROXY_DEAD for service "
                                + serviceToString(aidlService));
                    }
                    }
                    break;
                    break;
            }
            }
@@ -438,7 +435,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        public void serviceDied(long cookie) {
        public void serviceDied(long cookie) {
            // Deal with service going away
            // Deal with service going away
            riljLog("serviceDied");
            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));
                    HAL_SERVICE_RADIO, 0 /* ignored arg2 */, cookie));
        }
        }
    }
    }
@@ -471,14 +468,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        @Override
        @Override
        public void binderDied() {
        public void binderDied() {
            riljLog("Service " + serviceToString(mService) + " has died.");
            riljLog("Service " + serviceToString(mService) + " has died.");
            if (!mRilHandler.hasMessages(EVENT_AIDL_PROXY_DEAD)) {
            mRilHandler.sendMessage(mRilHandler.obtainMessage(EVENT_AIDL_PROXY_DEAD, mService,
                mRilHandler.sendMessageAtFrontOfQueue(mRilHandler.obtainMessage(
                    0 /* ignored arg2 */, mServiceCookies.get(mService).get()));
                        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));
            }
            unlinkToDeath();
            unlinkToDeath();
        }
        }
    }
    }
@@ -487,19 +478,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
        if (service == HAL_SERVICE_RADIO) {
            mRadioProxy = null;
            mRadioProxy = null;
        } else {
        } else {
            for (int i = MIN_SERVICE_IDX; i <= MAX_SERVICE_IDX; i++) {
            mServiceProxies.get(service).clear();
                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();
            }
        }
        }


        // 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 */);
        setRadioState(TelephonyManager.RADIO_POWER_UNAVAILABLE, true /* forceNotifyRegistrants */);


        RILRequest.resetSerial();
        RILRequest.resetSerial();
@@ -509,15 +495,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
        if (service == HAL_SERVICE_RADIO) {
            getRadioProxy(null);
            getRadioProxy(null);
        } else {
        } else {
            for (int i = MIN_SERVICE_IDX; i <= MAX_SERVICE_IDX; i++) {
            getRadioServiceProxy(service, null);
                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);
            }
        }
        }
    }
    }