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

Commit cbbca609 authored by Rambo Wang's avatar Rambo Wang
Browse files

Support multiple RANs per signal strength request in telephony

Multiple RANs per request for setting signal strength reporting
critiria has been supported in Radio HAL 2.0 and in the
TelephonManager interface. With the support in telephony, devices
with new Radio HAL can take advantage of the new API to have
better performance.

Bug: 206857183
Test: atest SignalStrengthControllerTest GsmCdmaPhoneTest
Test: atest android.telephony.cts.SignalStrengthUpdateRequestTest
Test: atest
com.android.internal.telephony.SignalStrengthUpdateRequestTest
Test: atest ServiceStateTrackerTest  DeviceStateMonitorTest
Test: Manual sanity test related to signal strength, including
go/signalstrength-s-ft
Test: atest VtsHalRadioTargetTest
(RadioNetworkTest#setSignalStrengthReportingCriteria_xxx) on two
products support radio hal 1.6 and 2.0

Merged-In: I627c528bffb2d731fac0cd0f07ef6c442dc0a824
Change-Id: I627c528bffb2d731fac0cd0f07ef6c442dc0a824
(cherry picked from commit e2c7eea7)
parent b8d76bd9
Loading
Loading
Loading
Loading
+11 −20
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
@@ -2393,30 +2394,20 @@ public interface CommandsInterface {
    void setUnsolResponseFilter(int filter, Message result);

    /**
     * Sets the signal strength reporting criteria.
     * Sets or clears the signal strength reporting criteria for multiple RANs in one request.
     *
     * The resulting reporting rules are the AND of all the supplied criteria. For each RAN
     * The hysteresisDb and thresholds apply to only the following measured quantities:
     * -GERAN    - RSSI
     * -CDMA2000 - RSSI
     * -UTRAN    - RSCP
     * -EUTRAN   - RSRP/RSRQ/RSSNR
     * -NGRAN    - SSRSRP/SSRSRQ/SSSINR
     * The reporting criteria are set individually for each combination of RAN and measurement type.
     * For each RAN type, if no reporting criteria are set, then the reporting of SignalStrength for
     * that RAN is implementation-defined. If any criteria are supplied for a RAN type, then
     * SignalStrength is only reported as specified by those criteria. For any RAN types not defined
     * by this HAL, reporting is implementation-defined.
     *
     * Note: Reporting criteria must be individually set for each RAN. For any unset reporting
     * criteria, the value is implementation-defined.
     *
     * Response callback is
     * IRadioResponse.setSignalStrengthReportingCriteriaResponse_1_5()
     *
     * @param signalThresholdInfo Signal threshold info including the threshold values,
     *                            hysteresisDb, and hysteresisMs. See @1.5::SignalThresholdInfo
     *                            for details.
     * @param ran The type of network for which to apply these thresholds.
     * @param signalThresholdInfos Collection of SignalThresholdInfo specifying the reporting
     *        criteria. See SignalThresholdInfo for details.
     * @param result callback message contains the information of SUCCESS/FAILURE
     */
    void setSignalStrengthReportingCriteria(SignalThresholdInfo signalThresholdInfo, int ran,
            Message result);
    void setSignalStrengthReportingCriteria(@NonNull List<SignalThresholdInfo> signalThresholdInfos,
            @Nullable Message result);

    /**
     * Send the link capacity reporting criteria to the modem
+1 −32
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ import android.telephony.PhoneNumberUtils;
import android.telephony.RadioAccessFamily;
import android.telephony.ServiceState;
import android.telephony.ServiceState.RilRadioTechnology;
import android.telephony.SignalThresholdInfo;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -145,11 +144,9 @@ public class GsmCdmaPhone extends Phone {
    private static final boolean DBG = true;
    private static final boolean VDBG = false; /* STOPSHIP if true */

    /** Required magnitude change between unsolicited SignalStrength reports. */
    private static final int REPORTING_HYSTERESIS_DB = 2;
    /** Required throughput change between unsolicited LinkCapacityEstimate reports. */
    private static final int REPORTING_HYSTERESIS_KBPS = 50;
    /** Minimum time between unsolicited SignalStrength and LinkCapacityEstimate reports. */
    /** Minimum time between unsolicited LinkCapacityEstimate reports. */
    private static final int REPORTING_HYSTERESIS_MILLIS = 3000;

    //GSM
@@ -4186,34 +4183,6 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    @Override
    public void setSignalStrengthReportingCriteria(int signalStrengthMeasure,
            int[] systemThresholds, int ran, boolean isEnabledForSystem) {
        int[] consolidatedThresholds = mSignalStrengthController.getConsolidatedSignalThresholds(
                ran,
                signalStrengthMeasure,
                isEnabledForSystem && mSignalStrengthController.shouldHonorSystemThresholds()
                        ? systemThresholds
                        : new int[]{},
                REPORTING_HYSTERESIS_DB);
        boolean isEnabledForAppRequest =
                mSignalStrengthController.shouldEnableSignalThresholdForAppRequest(
                        ran,
                        signalStrengthMeasure,
                        getSubId(),
                        isDeviceIdle());
        mCi.setSignalStrengthReportingCriteria(
                new SignalThresholdInfo.Builder()
                        .setRadioAccessNetworkType(ran)
                        .setSignalMeasurementType(signalStrengthMeasure)
                        .setHysteresisMs(REPORTING_HYSTERESIS_MILLIS)
                        .setHysteresisDb(REPORTING_HYSTERESIS_DB)
                        .setThresholds(consolidatedThresholds, true /*isSystem*/)
                        .setIsEnabled(isEnabledForSystem || isEnabledForAppRequest)
                        .build(),
                ran, null);
    }

    @Override
    public void setLinkCapacityReportingCriteria(int[] dlThresholds, int[] ulThresholds, int ran) {
        mCi.setLinkCapacityReportingCriteria(REPORTING_HYSTERESIS_MILLIS, REPORTING_HYSTERESIS_KBPS,
+0 −6
Original line number Diff line number Diff line
@@ -4541,12 +4541,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.setAllowedCarriers(carrierRestrictionRules, response, workSource);
    }

    /** Sets the SignalStrength reporting criteria. */
    public void setSignalStrengthReportingCriteria(
            int signalStrengthMeasure, int[] thresholds, int ran, boolean isEnabled) {
        // no-op default implementation
    }

    /** Sets the SignalStrength reporting criteria. */
    public void setLinkCapacityReportingCriteria(int[] dlThresholds, int[] ulThresholds, int ran) {
        // no-op default implementation
+3 −4
Original line number Diff line number Diff line
@@ -4458,8 +4458,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void setSignalStrengthReportingCriteria(SignalThresholdInfo signalThresholdInfo,
            int ran, Message result) {
    public void setSignalStrengthReportingCriteria(
            @NonNull List<SignalThresholdInfo> signalThresholdInfos, @Nullable Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
        if (networkProxy.isEmpty()) return;
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
@@ -4471,8 +4471,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                networkProxy.setSignalStrengthReportingCriteria(rr.mSerial, signalThresholdInfo,
                        ran);
                networkProxy.setSignalStrengthReportingCriteria(rr.mSerial, signalThresholdInfos);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(NETWORK_SERVICE,
                        "setSignalStrengthReportingCriteria", e);
+27 −17
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import static com.android.internal.telephony.RILConstants.REQUEST_NOT_SUPPORTED;

import android.annotation.NonNull;
import android.os.AsyncResult;
import android.os.Message;
import android.os.RemoteException;
@@ -587,30 +588,39 @@ public class RadioNetworkProxy extends RadioServiceProxy {
    /**
     * Call IRadioNetwork#setSignalStrengthReportingCriteria
     * @param serial Serial number of request
     * @param signalThresholdInfo Signal threshold info including the threshold values,
     *                            hysteresisDb, and hysteresisMs.
     * @param ran Radio access network for which to apply these thresholds
     * @param signalThresholdInfos a list of {@link SignalThresholdInfo} to set with.
     * @throws RemoteException
     */
    public void setSignalStrengthReportingCriteria(int serial,
            SignalThresholdInfo signalThresholdInfo, int ran) throws RemoteException {
            @NonNull List<SignalThresholdInfo> signalThresholdInfos) throws RemoteException {
        if (isEmpty() || mHalVersion.less(RIL.RADIO_HAL_VERSION_1_2)) return;
        if (isAidl()) {
            mNetworkProxy.setSignalStrengthReportingCriteria(serial,
                    new android.hardware.radio.network.SignalThresholdInfo[] {
                            RILUtils.convertToHalSignalThresholdInfoAidl(signalThresholdInfo)});
            android.hardware.radio.network.SignalThresholdInfo[] halSignalThresholdsInfos =
            new android.hardware.radio.network.SignalThresholdInfo[signalThresholdInfos.size()];
            for (int i = 0; i < signalThresholdInfos.size(); i++) {
                halSignalThresholdsInfos[i] = RILUtils.convertToHalSignalThresholdInfoAidl(
                        signalThresholdInfos.get(i));
            }
            mNetworkProxy.setSignalStrengthReportingCriteria(serial, halSignalThresholdsInfos);
        } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_5)) {
            for (SignalThresholdInfo signalThresholdInfo : signalThresholdInfos) {
                ((android.hardware.radio.V1_5.IRadio) mRadioProxy)
                        .setSignalStrengthReportingCriteria_1_5(serial,
                                RILUtils.convertToHalSignalThresholdInfo(signalThresholdInfo),
                    RILUtils.convertToHalAccessNetwork(ran));
                                RILUtils.convertToHalAccessNetwork(
                                        signalThresholdInfo.getRadioAccessNetworkType()));
            }
        } else {
            for (SignalThresholdInfo signalThresholdInfo : signalThresholdInfos) {
                ((android.hardware.radio.V1_2.IRadio) mRadioProxy)
                        .setSignalStrengthReportingCriteria(serial,
                                signalThresholdInfo.getHysteresisMs(),
                                signalThresholdInfo.getHysteresisDb(),
                    RILUtils.primitiveArrayToArrayList(signalThresholdInfo.getThresholds()),
                    RILUtils.convertToHalAccessNetwork(ran));
                                RILUtils.primitiveArrayToArrayList(
                                        signalThresholdInfo.getThresholds()),
                                RILUtils.convertToHalAccessNetwork(
                                        signalThresholdInfo.getRadioAccessNetworkType()));
            }
        }
    }

Loading