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

Commit e7dc5eab authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

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

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1988809

Change-Id: I9b4501b3fa3c7c647f9e55ce42d9a7844a2a799c
parents 87b015d6 a1b4bd7a
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -692,9 +692,10 @@ public class RIL extends BaseCommands implements CommandsInterface {


    /**
    /**
     * Returns a {@link RadioDataProxy}, {@link RadioMessagingProxy}, {@link RadioModemProxy},
     * Returns a {@link RadioDataProxy}, {@link RadioMessagingProxy}, {@link RadioModemProxy},
     * {@link RadioNetworkProxy}, {@link RadioSimProxy}, {@link RadioVoiceProxy}, or null if the
     * {@link RadioNetworkProxy}, {@link RadioSimProxy}, {@link RadioVoiceProxy}, or an empty {@link RadioServiceProxy}
     * service is not available.
     * if the service is not available.
     */
     */
    @NonNull
    public <T extends RadioServiceProxy> T getRadioServiceProxy(Class<T> serviceClass,
    public <T extends RadioServiceProxy> T getRadioServiceProxy(Class<T> serviceClass,
            Message result) {
            Message result) {
        if (serviceClass == RadioDataProxy.class) {
        if (serviceClass == RadioDataProxy.class) {
@@ -715,16 +716,17 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (serviceClass == RadioVoiceProxy.class) {
        if (serviceClass == RadioVoiceProxy.class) {
            return (T) getRadioServiceProxy(VOICE_SERVICE, result);
            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.
     * For RADIO_SERVICE, use {@link #getRadioProxy} instead, as this will always return null.
     */
     */
    @VisibleForTesting
    @VisibleForTesting
    @NonNull
    public synchronized RadioServiceProxy getRadioServiceProxy(int service, Message result) {
    public synchronized RadioServiceProxy getRadioServiceProxy(int service, Message result) {
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return null;
        if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return new RadioServiceProxy();
        if (!mIsCellularSupported) {
        if (!mIsCellularSupported) {
            if (RILJ_LOGV) riljLog("getRadioServiceProxy: Not calling getService(): wifi-only");
            if (RILJ_LOGV) riljLog("getRadioServiceProxy: Not calling getService(): wifi-only");
            if (result != null) {
            if (result != null) {
@@ -732,7 +734,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
                result.sendToTarget();
            }
            }
            return null;
            return new RadioServiceProxy();
        }
        }


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


    /**
    /**
     * Check whether a RadioData implementation exists
     * 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
    @Override
    public boolean isEmpty() {
    public boolean isEmpty() {
+2 −3
Original line number Original line Diff line number Diff line
@@ -58,14 +58,13 @@ public class RadioMessagingProxy extends RadioServiceProxy {
     */
     */
    @Override
    @Override
    public void clear() {
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        super.clear();
        mRadioProxy = null;
        mMessagingProxy = null;
        mMessagingProxy = null;
    }
    }


    /**
    /**
     * Check whether a RadioMessaging implementation exists
     * 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
    @Override
    public boolean isEmpty() {
    public boolean isEmpty() {
+2 −3
Original line number Original line Diff line number Diff line
@@ -53,14 +53,13 @@ public class RadioModemProxy extends RadioServiceProxy {
     */
     */
    @Override
    @Override
    public void clear() {
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        super.clear();
        mRadioProxy = null;
        mModemProxy = null;
        mModemProxy = null;
    }
    }


    /**
    /**
     * Check whether a RadioModem implementation exists
     * 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
    @Override
    public boolean isEmpty() {
    public boolean isEmpty() {
+2 −3
Original line number Original line Diff line number Diff line
@@ -86,14 +86,13 @@ public class RadioNetworkProxy extends RadioServiceProxy {
     */
     */
    @Override
    @Override
    public void clear() {
    public void clear() {
        mHalVersion = RIL.RADIO_HAL_VERSION_UNKNOWN;
        super.clear();
        mRadioProxy = null;
        mNetworkProxy = null;
        mNetworkProxy = null;
    }
    }


    /**
    /**
     * Check whether a RadioNetwork implementation exists
     * 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
    @Override
    public boolean isEmpty() {
    public boolean isEmpty() {
Loading