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

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

Merge "Change RadioServiceProxy from null to empty when service not available"

parents 341d7a61 02b3a8a6
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -693,9 +693,10 @@ public class RIL extends BaseCommands implements CommandsInterface {

    /**
     * Returns a {@link RadioDataProxy}, {@link RadioMessagingProxy}, {@link RadioModemProxy},
     * {@link RadioNetworkProxy}, {@link RadioSimProxy}, {@link RadioVoiceProxy}, or null if the
     * service is not available.
     * {@link RadioNetworkProxy}, {@link RadioSimProxy}, {@link RadioVoiceProxy}, or an empty {@link RadioServiceProxy}
     * if the service is not available.
     */
    @NonNull
    public <T extends RadioServiceProxy> T getRadioServiceProxy(Class<T> serviceClass,
            Message result) {
        if (serviceClass == RadioDataProxy.class) {
@@ -716,16 +717,17 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (serviceClass == RadioVoiceProxy.class) {
            return (T) getRadioServiceProxy(VOICE_SERVICE, result);
        }
        return null;
        return (T) new RadioServiceProxy();
    }

    /**
     * Returns a {@link RadioServiceProxy} or null if the service is not available.
     * Returns a {@link RadioServiceProxy}, which is empty if the service is not available.
     * For RADIO_SERVICE, use {@link #getRadioProxy} instead, as this will always return null.
     */
    @VisibleForTesting
    @NonNull
    public synchronized RadioServiceProxy getRadioServiceProxy(int service, Message result) {
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return null;
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return new RadioServiceProxy();
        if (!mIsCellularSupported) {
            if (RILJ_LOGV) riljLog("getRadioServiceProxy: Not calling getService(): wifi-only");
            if (result != null) {
@@ -733,7 +735,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
            }
            return null;
            return new RadioServiceProxy();
        }

        RadioServiceProxy serviceProxy = mServiceProxies.get(service);
+2 −3
Original line number Diff line number Diff line
@@ -66,14 +66,13 @@ public class RadioDataProxy extends RadioServiceProxy {
     */
    @Override
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        mRadioProxy = null;
        super.clear();
        mDataProxy = null;
    }

    /**
     * Check whether a RadioData implementation exists
     * @return false if there is neither a HIDL nor AIDL implementation
     * @return true if there is neither a HIDL nor AIDL implementation
     */
    @Override
    public boolean isEmpty() {
+2 −3
Original line number Diff line number Diff line
@@ -58,14 +58,13 @@ public class RadioMessagingProxy extends RadioServiceProxy {
     */
    @Override
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        mRadioProxy = null;
        super.clear();
        mMessagingProxy = null;
    }

    /**
     * Check whether a RadioMessaging implementation exists
     * @return false if there is neither a HIDL nor AIDL implementation
     * @return true if there is neither a HIDL nor AIDL implementation
     */
    @Override
    public boolean isEmpty() {
+2 −3
Original line number Diff line number Diff line
@@ -53,14 +53,13 @@ public class RadioModemProxy extends RadioServiceProxy {
     */
    @Override
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        mRadioProxy = null;
        super.clear();
        mModemProxy = null;
    }

    /**
     * Check whether a RadioModem implementation exists
     * @return false if there is neither a HIDL nor AIDL implementation
     * @return true if there is neither a HIDL nor AIDL implementation
     */
    @Override
    public boolean isEmpty() {
+2 −3
Original line number Diff line number Diff line
@@ -86,14 +86,13 @@ public class RadioNetworkProxy extends RadioServiceProxy {
     */
    @Override
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        mRadioProxy = null;
        super.clear();
        mNetworkProxy = null;
    }

    /**
     * Check whether a RadioNetwork implementation exists
     * @return false if there is neither a HIDL nor AIDL implementation
     * @return true if there is neither a HIDL nor AIDL implementation
     */
    @Override
    public boolean isEmpty() {
Loading