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

Commit 9f0afd7a authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Add support for setSystemSelectionChannels"

parents 51995669 173a0818
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
@@ -27,6 +28,7 @@ import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.RadioAccessSpecifier;
import android.telephony.SignalThresholdInfo;
import android.telephony.data.DataProfile;
import android.telephony.emergency.EmergencyNumber;
@@ -2446,6 +2448,20 @@ public interface CommandsInterface {
     */
    default void enableUiccApplications(boolean enable, Message onCompleteMessage) {}

    /**
     * Specify which bands modem's background scan must act on.
     * If {@code specifiers} is non-empty, the scan will be restricted to the bands specified.
     * Otherwise, it scans all bands.
     *
     * For example, CBRS is only on LTE band 48. By specifying this band,
     * modem saves more power.
     *
     * @param specifiers which bands to scan.
     * @param onComplete a message to send when complete.
     */
    default void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers,
            Message onComplete) {}

    /**
     * Whether uicc applications are enabled or not.
     *
+6 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.RadioAccessFamily;
import android.telephony.RadioAccessSpecifier;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
@@ -2351,6 +2352,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.nvResetConfig(2 /* erase NV */, response);
    }

    public void setSystemSelectionChannels(List<RadioAccessSpecifier> specifiers,
            Message response) {
        mCi.setSystemSelectionChannels(specifiers, response);
    }

    public void notifyDataActivity() {
        mNotifier.notifyDataActivity(this);
    }
+72 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.telephony;
import static com.android.internal.telephony.RILConstants.*;
import static com.android.internal.util.Preconditions.checkNotNull;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.hardware.radio.V1_0.Carrier;
@@ -968,6 +969,75 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    @Override
    public void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers,
            Message onComplete) {
        IRadio radioProxy = getRadioProxy(onComplete);
        if (mRadioVersion.less(RADIO_HAL_VERSION_1_3)) {
            if (RILJ_LOGV) riljLog("setSystemSelectionChannels: not supported.");
            if (onComplete != null) {
                AsyncResult.forMessage(onComplete, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                onComplete.sendToTarget();
            }
            return;
        }

        RILRequest rr = obtainRequest(RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS, onComplete,
                mRILDefaultWorkSource);

        if (mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
            android.hardware.radio.V1_3.IRadio radioProxy13 =
                    (android.hardware.radio.V1_3.IRadio) radioProxy;
            if (radioProxy13 != null) {
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                            + " setSystemSelectionChannels_1.3= "
                            + specifiers);
                }

                ArrayList<android.hardware.radio.V1_1.RadioAccessSpecifier> halSpecifiers =
                        specifiers.stream()
                                .map(this::convertRadioAccessSpecifierToRadioHAL)
                                .collect(Collectors.toCollection(ArrayList::new));

                try {
                    radioProxy13.setSystemSelectionChannels(rr.mSerial,
                            !halSpecifiers.isEmpty(),
                            halSpecifiers);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSystemSelectionChannels", e);
                }
            }
        }

        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
            android.hardware.radio.V1_5.IRadio radioProxy15 =
                    (android.hardware.radio.V1_5.IRadio) radioProxy;

            if (radioProxy15 != null) {
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                            + " setSystemSelectionChannels_1.5= "
                            + specifiers);
                }

                ArrayList<android.hardware.radio.V1_5.RadioAccessSpecifier> halSpecifiers =
                        specifiers.stream()
                                .map(this::convertRadioAccessSpecifierToRadioHAL_1_5)
                                .collect(Collectors.toCollection(ArrayList::new));

                try {
                    radioProxy15.setSystemSelectionChannels_1_5(rr.mSerial,
                            !halSpecifiers.isEmpty(),
                            halSpecifiers);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSystemSelectionChannels", e);
                }
            }
        }
    }

    @Override
    public void getModemStatus(Message result) {
        IRadio radioProxy = getRadioProxy(result);
@@ -5948,6 +6018,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT";
            case RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE:
                return "RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE";
            case RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS:
                return "RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS";
            default: return "<unknown request>";
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -2395,4 +2395,8 @@ public class RadioResponse extends IRadioResponse.Stub {
            mRil.processResponseDone(rr, responseInfo, enabled);
        }
    }

    public void setSystemSelectionChannelsResponse_1_5(RadioResponseInfo info) {
        responseVoid(info);
    }
}