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

Commit 66e100a0 authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "HIDL only call setResponseFunction once" into tm-dev

parents e105763c a94fc650
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -186,6 +186,8 @@ public class RIL extends BaseCommands implements CommandsInterface {

    int mLastRadioPowerResult = RadioError.NONE;

    boolean mHidlSetResponseFunctionsCalled = false;

    // When we are testing emergency calls using ril.test.emergencynumber, this will trigger test
    // ECbM when the call is ended.
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@@ -352,6 +354,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            + ", service = " + serviceToString(service) + ", service cookie = "
                            + mServiceCookies.get(service));
                    if ((long) msg.obj == mServiceCookies.get(service).get()) {
                        mHidlSetResponseFunctionsCalled = false;
                        resetProxyAndRequestList(service);
                    }
                    break;
@@ -363,6 +366,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            + ", service = " + serviceToString(aidlService) + ", cookie = "
                            + mServiceCookies.get(aidlService));
                    if (obj.get() == mServiceCookies.get(aidlService).get()) {
                        mHidlSetResponseFunctionsCalled = false;
                        resetProxyAndRequestList(aidlService);
                    }
                    break;
@@ -522,6 +526,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            if (serviceBound) {
                mHidlSetResponseFunctionsCalled = false;
                for (int service = MIN_SERVICE_IDX; service <= MAX_SERVICE_IDX; service++) {
                    resetProxyAndRequestList(service);
                }
@@ -662,7 +667,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                if (mRadioProxy != null) {
                    mRadioProxy.linkToDeath(mRadioProxyDeathRecipient,
                            mServiceCookies.get(RADIO_SERVICE).incrementAndGet());
                    if (!mHidlSetResponseFunctionsCalled) {
                        mHidlSetResponseFunctionsCalled = true;
                        mRadioProxy.setResponseFunctions(mRadioResponse, mRadioIndication);
                    }
                } else {
                    mDisabledRadioServices.get(RADIO_SERVICE).add(mPhoneId);
                    riljLoge("getRadioProxy: set mRadioProxy for "
@@ -955,9 +963,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        }
                        serviceProxy.getHidl().linkToDeath(mRadioProxyDeathRecipient,
                                mServiceCookies.get(service).incrementAndGet());
                        if (!mHidlSetResponseFunctionsCalled) {
                            mHidlSetResponseFunctionsCalled = true;
                            serviceProxy.getHidl().setResponseFunctions(
                                    mRadioResponse, mRadioIndication);
                        }
                    }
                } else {
                    mDisabledRadioServices.get(service).add(mPhoneId);
                    riljLoge("getRadioServiceProxy: set " + serviceToString(service) + " for "
@@ -984,6 +995,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public synchronized void onSlotActiveStatusChange(boolean active) {
        mHidlSetResponseFunctionsCalled = false;
        for (int service = MIN_SERVICE_IDX; service <= MAX_SERVICE_IDX; service++) {
            if (active) {
                // Try to connect to RIL services and set response functions.
@@ -1169,6 +1181,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    private void handleRadioProxyExceptionForRR(int service, String caller, Exception e) {
        riljLoge(caller + ": " + e);
        e.printStackTrace();
        mHidlSetResponseFunctionsCalled = false;
        resetProxyAndRequestList(service);
    }