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

Commit 3d527835 authored by Hunsuk Choi's avatar Hunsuk Choi
Browse files

Fix the way to detect the Radio Aidl HAL version

Test: manual
Bug: 243344927
Change-Id: I00242aca87e3112946e4fe3ae8d7278b49767987
parent f4d76e75
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -159,6 +159,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
    /** @hide */
    public static final HalVersion RADIO_HAL_VERSION_2_0 = new HalVersion(2, 0);

    /** @hide */
    public static final HalVersion RADIO_HAL_VERSION_2_1 = new HalVersion(2, 1);

    // IRadio version
    private HalVersion mRadioVersion = RADIO_HAL_VERSION_UNKNOWN;

@@ -768,8 +771,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            binder = mMockModem.getServiceBinder(DATA_SERVICE);
                        }
                        if (binder != null) {
                            mRadioVersion = RADIO_HAL_VERSION_2_0;
                            ((RadioDataProxy) serviceProxy).setAidl(mRadioVersion,
                            mRadioVersion = ((RadioDataProxy) serviceProxy).setAidl(mRadioVersion,
                                    android.hardware.radio.data.IRadioData.Stub.asInterface(
                                            binder));
                        }
@@ -783,8 +785,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            binder = mMockModem.getServiceBinder(MESSAGING_SERVICE);
                        }
                        if (binder != null) {
                            mRadioVersion = RADIO_HAL_VERSION_2_0;
                            ((RadioMessagingProxy) serviceProxy).setAidl(mRadioVersion,
                            mRadioVersion = ((RadioMessagingProxy) serviceProxy).setAidl(
                                    mRadioVersion,
                                    android.hardware.radio.messaging.IRadioMessaging.Stub
                                            .asInterface(binder));
                        }
@@ -798,8 +800,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            binder = mMockModem.getServiceBinder(MODEM_SERVICE);
                        }
                        if (binder != null) {
                            mRadioVersion = RADIO_HAL_VERSION_2_0;
                            ((RadioModemProxy) serviceProxy).setAidl(mRadioVersion,
                            mRadioVersion = ((RadioModemProxy) serviceProxy).setAidl(mRadioVersion,
                                    android.hardware.radio.modem.IRadioModem.Stub
                                            .asInterface(binder));
                        }
@@ -813,8 +814,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            binder = mMockModem.getServiceBinder(NETWORK_SERVICE);
                        }
                        if (binder != null) {
                            mRadioVersion = RADIO_HAL_VERSION_2_0;
                            ((RadioNetworkProxy) serviceProxy).setAidl(mRadioVersion,
                            mRadioVersion = ((RadioNetworkProxy) serviceProxy).setAidl(
                                    mRadioVersion,
                                    android.hardware.radio.network.IRadioNetwork.Stub
                                            .asInterface(binder));
                        }
@@ -828,8 +829,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            binder = mMockModem.getServiceBinder(SIM_SERVICE);
                        }
                        if (binder != null) {
                            mRadioVersion = RADIO_HAL_VERSION_2_0;
                            ((RadioSimProxy) serviceProxy).setAidl(mRadioVersion,
                            mRadioVersion = ((RadioSimProxy) serviceProxy).setAidl(mRadioVersion,
                                    android.hardware.radio.sim.IRadioSim.Stub
                                            .asInterface(binder));
                        }
@@ -843,8 +843,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            binder = mMockModem.getServiceBinder(VOICE_SERVICE);
                        }
                        if (binder != null) {
                            mRadioVersion = RADIO_HAL_VERSION_2_0;
                            ((RadioVoiceProxy) serviceProxy).setAidl(mRadioVersion,
                            mRadioVersion = ((RadioVoiceProxy) serviceProxy).setAidl(mRadioVersion,
                                    android.hardware.radio.voice.IRadioVoice.Stub
                                            .asInterface(binder));
                        }
+23 −2
Original line number Diff line number Diff line
@@ -45,12 +45,33 @@ public class RadioDataProxy extends RadioServiceProxy {
     * Set IRadioData as the AIDL implementation for RadioServiceProxy
     * @param halVersion Radio HAL version
     * @param data IRadioData implementation
     *
     * @return updated HAL version
     */
    public void setAidl(HalVersion halVersion, android.hardware.radio.data.IRadioData data) {
    public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.data.IRadioData data) {
        mHalVersion = halVersion;
        mDataProxy = data;
        mIsAidl = true;
        Rlog.d(TAG, "AIDL initialized");

        try {
            HalVersion newHalVersion;
            int version = data.getInterfaceVersion();
            switch(version) {
                default:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_0;
                    break;
            }
            Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion);

            if (mHalVersion.less(newHalVersion)) {
                mHalVersion = newHalVersion;
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "setAidl: " + e);
        }

        Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion);
        return mHalVersion;
    }

    /**
+23 −2
Original line number Diff line number Diff line
@@ -36,13 +36,34 @@ public class RadioMessagingProxy extends RadioServiceProxy {
     * Set IRadioMessaging as the AIDL implementation for RadioServiceProxy
     * @param halVersion Radio HAL version
     * @param messaging IRadioMessaging implementation
     *
     * @return updated HAL version
     */
    public void setAidl(HalVersion halVersion,
    public HalVersion setAidl(HalVersion halVersion,
            android.hardware.radio.messaging.IRadioMessaging messaging) {
        mHalVersion = halVersion;
        mMessagingProxy = messaging;
        mIsAidl = true;
        Rlog.d(TAG, "AIDL initialized");

        try {
            HalVersion newHalVersion;
            int version = messaging.getInterfaceVersion();
            switch(version) {
                default:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_0;
                    break;
            }
            Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion);

            if (mHalVersion.less(newHalVersion)) {
                mHalVersion = newHalVersion;
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "setAidl: " + e);
        }

        Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion);
        return mHalVersion;
    }

    /**
+23 −2
Original line number Diff line number Diff line
@@ -31,13 +31,34 @@ public class RadioModemProxy extends RadioServiceProxy {
     * Set IRadioModem as the AIDL implementation for RadioServiceProxy
     * @param halVersion Radio HAL version
     * @param modem IRadioModem implementation
     *
     * @return updated HAL version
     */
    public void setAidl(HalVersion halVersion,
    public HalVersion setAidl(HalVersion halVersion,
            android.hardware.radio.modem.IRadioModem modem) {
        mHalVersion = halVersion;
        mModemProxy = modem;
        mIsAidl = true;
        Rlog.d(TAG, "AIDL initialized");

        try {
            HalVersion newHalVersion;
            int version = modem.getInterfaceVersion();
            switch(version) {
                default:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_0;
                    break;
            }
            Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion);

            if (mHalVersion.less(newHalVersion)) {
                mHalVersion = newHalVersion;
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "setAidl: " + e);
        }

        Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion);
        return mHalVersion;
    }

    /**
+26 −2
Original line number Diff line number Diff line
@@ -65,13 +65,37 @@ public class RadioNetworkProxy extends RadioServiceProxy {
     * Set IRadioNetwork as the AIDL implementation for RadioServiceProxy
     * @param halVersion Radio HAL version
     * @param network IRadioNetwork implementation
     *
     * @return updated HAL version
     */
    public void setAidl(HalVersion halVersion,
    public HalVersion setAidl(HalVersion halVersion,
            android.hardware.radio.network.IRadioNetwork network) {
        mHalVersion = halVersion;
        mNetworkProxy = network;
        mIsAidl = true;
        Rlog.d(TAG, "AIDL initialized");

        try {
            HalVersion newHalVersion;
            int version = network.getInterfaceVersion();
            switch(version) {
                case 2:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_1;
                    break;
                default:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_0;
                    break;
            }
            Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion);

            if (mHalVersion.less(newHalVersion)) {
                mHalVersion = newHalVersion;
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "setAidl: " + e);
        }

        Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion);
        return mHalVersion;
    }

    /**
Loading