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

Commit 6839c374 authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Add support for setSystemSelectionChannels"

parents 781162ff f75ba447
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.internal.telephony;
package com.android.internal.telephony;


import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.net.KeepalivePacketData;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.net.LinkProperties;
@@ -26,6 +27,7 @@ import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
import android.telephony.ClientRequestStats;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.NetworkScanRequest;
import android.telephony.RadioAccessSpecifier;
import android.telephony.SignalThresholdInfo;
import android.telephony.SignalThresholdInfo;
import android.telephony.data.DataProfile;
import android.telephony.data.DataProfile;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber;
@@ -2431,6 +2433,20 @@ public interface CommandsInterface {
     */
     */
    default void enableUiccApplications(boolean enable, Message onCompleteMessage) {}
    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.
     * Whether uicc applications are enabled or not.
     *
     *
+6 −0
Original line number Original line Diff line number Diff line
@@ -53,6 +53,7 @@ import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.PreciseDataConnectionState;
import android.telephony.RadioAccessFamily;
import android.telephony.RadioAccessFamily;
import android.telephony.RadioAccessSpecifier;
import android.telephony.ServiceState;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager;
@@ -2318,6 +2319,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.nvResetConfig(2 /* erase NV */, response);
        mCi.nvResetConfig(2 /* erase NV */, response);
    }
    }


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

    public void notifyDataActivity() {
    public void notifyDataActivity() {
        mNotifier.notifyDataActivity(this);
        mNotifier.notifyDataActivity(this);
    }
    }
+72 −0
Original line number Original line 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.telephony.RILConstants.*;
import static com.android.internal.util.Preconditions.checkNotNull;
import static com.android.internal.util.Preconditions.checkNotNull;


import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.hardware.radio.V1_0.Carrier;
import android.hardware.radio.V1_0.Carrier;
@@ -967,6 +968,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
    @Override
    public void getModemStatus(Message result) {
    public void getModemStatus(Message result) {
        IRadio radioProxy = getRadioProxy(result);
        IRadio radioProxy = getRadioProxy(result);
@@ -5875,6 +5945,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_ENABLE_UICC_APPLICATIONS";
                return "RIL_REQUEST_ENABLE_UICC_APPLICATIONS";
            case RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT:
            case RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT:
                return "RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT";
                return "RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT";
            case RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS:
                return "RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS";
            default: return "<unknown request>";
            default: return "<unknown request>";
        }
        }
    }
    }
+4 −0
Original line number Original line Diff line number Diff line
@@ -2386,4 +2386,8 @@ public class RadioResponse extends IRadioResponse.Stub {
            mRil.processResponseDone(rr, responseInfo, enabled);
            mRil.processResponseDone(rr, responseInfo, enabled);
        }
        }
    }
    }

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