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

Commit 6dbafc8f authored by Ling Ma's avatar Ling Ma
Browse files

Bugfix - getRadioServiceProxy cast exception

Bug: 219603423
Test: build
Change-Id: I2c865e372544aaa42eeed7d374d1cd14f549587b
parent a1b4bd7a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -716,7 +716,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (serviceClass == RadioVoiceProxy.class) {
            return (T) getRadioServiceProxy(VOICE_SERVICE, result);
        }
        return (T) new RadioServiceProxy();
        riljLoge("getRadioServiceProxy: unrecognized " + serviceClass);
        return null;
    }

    /**
@@ -726,7 +727,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @VisibleForTesting
    @NonNull
    public synchronized RadioServiceProxy getRadioServiceProxy(int service, Message result) {
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return new RadioServiceProxy();
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return mServiceProxies.get(service);
        if (!mIsCellularSupported) {
            if (RILJ_LOGV) riljLog("getRadioServiceProxy: Not calling getService(): wifi-only");
            if (result != null) {
@@ -734,7 +735,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
            }
            return new RadioServiceProxy();
            return mServiceProxies.get(service);
        }

        RadioServiceProxy serviceProxy = mServiceProxies.get(service);
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.os.RemoteException;
 * A holder for IRadio services. Use getHidl to get IRadio 1.0 and call the HIDL implementations or
 * getAidl to get the AIDL service and call the AIDL implementations of the HAL APIs.
 */
public class RadioServiceProxy {
public abstract class RadioServiceProxy {
    boolean mIsAidl;
    HalVersion mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
    volatile android.hardware.radio.V1_0.IRadio mRadioProxy = null;
@@ -69,6 +69,7 @@ public class RadioServiceProxy {
    public boolean isEmpty() {
        return mRadioProxy == null;
    }

    /**
     * Call responseAcknowledgement for the service
     * @throws RemoteException