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

Commit 8ddb0be4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "RIL handle AIDL binder died for all services at the same time" into udc-dev

parents fa76a092 c588593f
Loading
Loading
Loading
Loading
+39 −19
Original line number Diff line number Diff line
@@ -385,12 +385,15 @@ 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;
            }
@@ -435,9 +438,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        public void serviceDied(long cookie) {
            // Deal with service going away
            riljLog("serviceDied");
            mRilHandler.sendMessage(mRilHandler.obtainMessage(EVENT_RADIO_PROXY_DEAD,
                    HAL_SERVICE_RADIO,
                    0 /* ignored arg2 */, cookie));
            mRilHandler.sendMessageAtFrontOfQueue(mRilHandler.obtainMessage(EVENT_RADIO_PROXY_DEAD,
                    HAL_SERVICE_RADIO, 0 /* ignored arg2 */, cookie));
        }
    }

@@ -469,8 +471,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
        @Override
        public void binderDied() {
            riljLog("Service " + serviceToString(mService) + " has died.");
            mRilHandler.sendMessage(mRilHandler.obtainMessage(EVENT_AIDL_PROXY_DEAD, mService,
                    0 /* ignored arg2 */, mServiceCookies.get(mService).get()));
            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));
            }
            unlinkToDeath();
        }
    }
@@ -479,14 +487,19 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
            mRadioProxy = null;
        } else {
            mServiceProxies.get(service).clear();
        }

            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(service).incrementAndGet();
                mServiceCookies.get(i).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();
@@ -496,7 +509,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (service == HAL_SERVICE_RADIO) {
            getRadioProxy(null);
        } else {
            getRadioServiceProxy(service, null);
            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);
            }
        }
    }

@@ -781,8 +802,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @NonNull
    public synchronized RadioServiceProxy getRadioServiceProxy(int service, Message result) {
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return mServiceProxies.get(service);
        if ((service >= HAL_SERVICE_IMS)
                && !isRadioServiceSupported(service)) {
        if ((service >= HAL_SERVICE_IMS) && !isRadioServiceSupported(service)) {
            return mServiceProxies.get(service);
        }
        if (!mIsCellularSupported) {
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DATA_REGIS
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEACTIVATE_DATA_CALL;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DELETE_SMS_ON_SIM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEVICE_IDENTITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEVICE_IMEI;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DIAL;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DTMF;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DTMF_START;
@@ -5262,6 +5263,8 @@ public class RILUtils {
                return "GET_SIM_PHONEBOOK_RECORDS";
            case RIL_REQUEST_UPDATE_SIM_PHONEBOOK_RECORD:
                return "UPDATE_SIM_PHONEBOOK_RECORD";
            case RIL_REQUEST_DEVICE_IMEI:
                return "DEVICE_IMEI";
            case RIL_REQUEST_GET_SLOT_STATUS:
                return "GET_SLOT_STATUS";
            case RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING: