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 Diff line number Diff line
@@ -692,9 +692,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) {
@@ -715,16 +716,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) {
@@ -732,7 +734,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