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

Commit 4d2f7975 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:...

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

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



Change-Id: Ie81b0813fd1512a50b326b5dffd2d59a3bc49bf5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 78a688e5 755d239d
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);
        }
    }