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

Commit 5036a600 authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju
Browse files

Integrate 3g ECNO measurement type support

1.Support 3G ECNO measurement type @ SignalThresholdInfo
2.Expose ECNO Measurement type as public

Bug: 247985661
Test: make update-api
Change-Id: I8d3f8a4f697db49f173df416a56750cc4fe95962
parent c78e7fc6
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -43073,6 +43073,7 @@ package android.telephony {
    method @NonNull public int[] getThresholds();
    method @NonNull public int[] getThresholds();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalThresholdInfo> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalThresholdInfo> CREATOR;
    field public static final int SIGNAL_MEASUREMENT_TYPE_ECNO = 9; // 0x9
    field public static final int SIGNAL_MEASUREMENT_TYPE_RSCP = 2; // 0x2
    field public static final int SIGNAL_MEASUREMENT_TYPE_RSCP = 2; // 0x2
    field public static final int SIGNAL_MEASUREMENT_TYPE_RSRP = 3; // 0x3
    field public static final int SIGNAL_MEASUREMENT_TYPE_RSRP = 3; // 0x3
    field public static final int SIGNAL_MEASUREMENT_TYPE_RSRQ = 4; // 0x4
    field public static final int SIGNAL_MEASUREMENT_TYPE_RSRQ = 4; // 0x4
+93 −41
Original line number Original line Diff line number Diff line
@@ -100,8 +100,19 @@ public final class SignalThresholdInfo implements Parcelable {
     */
     */
    public static final int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8;
    public static final int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8;


    /**
     * The ratio between the received energy from the pilot signal CPICH per chip (Ec) to the
     * noise density (No).
     * Range: -24 dBm to 1 dBm.
     * Used RAN: {@link AccessNetworkConstants.AccessNetworkType#UTRAN}
     * Reference: 3GPP TS 25.215 5.1.5
     */
    public static final int SIGNAL_MEASUREMENT_TYPE_ECNO = 9;

    /** @hide */
    /** @hide */
    @IntDef(prefix = {"SIGNAL_MEASUREMENT_TYPE_"}, value = {
    @IntDef(
            prefix = {"SIGNAL_MEASUREMENT_TYPE_"},
            value = {
                SIGNAL_MEASUREMENT_TYPE_UNKNOWN,
                SIGNAL_MEASUREMENT_TYPE_UNKNOWN,
                SIGNAL_MEASUREMENT_TYPE_RSSI,
                SIGNAL_MEASUREMENT_TYPE_RSSI,
                SIGNAL_MEASUREMENT_TYPE_RSCP,
                SIGNAL_MEASUREMENT_TYPE_RSCP,
@@ -110,14 +121,13 @@ public final class SignalThresholdInfo implements Parcelable {
                SIGNAL_MEASUREMENT_TYPE_RSSNR,
                SIGNAL_MEASUREMENT_TYPE_RSSNR,
                SIGNAL_MEASUREMENT_TYPE_SSRSRP,
                SIGNAL_MEASUREMENT_TYPE_SSRSRP,
                SIGNAL_MEASUREMENT_TYPE_SSRSRQ,
                SIGNAL_MEASUREMENT_TYPE_SSRSRQ,
            SIGNAL_MEASUREMENT_TYPE_SSSINR
                SIGNAL_MEASUREMENT_TYPE_SSSINR,
                SIGNAL_MEASUREMENT_TYPE_ECNO
            })
            })
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    public @interface SignalMeasurementType {
    public @interface SignalMeasurementType {}
    }


    @SignalMeasurementType
    @SignalMeasurementType private final int mSignalMeasurementType;
    private final int mSignalMeasurementType;


    /**
    /**
     * A hysteresis time in milliseconds to prevent flapping.
     * A hysteresis time in milliseconds to prevent flapping.
@@ -149,8 +159,7 @@ public final class SignalThresholdInfo implements Parcelable {
    /**
    /**
     * The radio access network type associated with the signal thresholds.
     * The radio access network type associated with the signal thresholds.
     */
     */
    @AccessNetworkConstants.RadioAccessNetworkType
    @AccessNetworkConstants.RadioAccessNetworkType private final int mRan;
    private final int mRan;


    /**
    /**
     * Indicates the hysteresisMs is disabled.
     * Indicates the hysteresisMs is disabled.
@@ -166,7 +175,6 @@ public final class SignalThresholdInfo implements Parcelable {
     */
     */
    public static final int HYSTERESIS_DB_DISABLED = 0;
    public static final int HYSTERESIS_DB_DISABLED = 0;



    /**
    /**
     * Minimum valid value for {@link #SIGNAL_MEASUREMENT_TYPE_RSSI}.
     * Minimum valid value for {@link #SIGNAL_MEASUREMENT_TYPE_RSSI}.
     *
     *
@@ -279,6 +287,20 @@ public final class SignalThresholdInfo implements Parcelable {
     */
     */
    public static final int SIGNAL_SSSINR_MAX_VALUE = 40;
    public static final int SIGNAL_SSSINR_MAX_VALUE = 40;


    /**
     * Minimum valid value for {@link #SIGNAL_MEASUREMENT_TYPE_ECNO}.
     *
     * @hide
     */
    public static final int SIGNAL_ECNO_MIN_VALUE = -24;

    /**
     * Maximum valid value for {@link #SIGNAL_MEASUREMENT_TYPE_ECNO}.
     *
     * @hide
     */
    public static final int SIGNAL_ECNO_MAX_VALUE = 1;

    /**
    /**
     * The minimum number of thresholds allowed in each SignalThresholdInfo.
     * The minimum number of thresholds allowed in each SignalThresholdInfo.
     *
     *
@@ -303,9 +325,13 @@ public final class SignalThresholdInfo implements Parcelable {
     * @param thresholds        threshold value
     * @param thresholds        threshold value
     * @param isEnabled         isEnabled
     * @param isEnabled         isEnabled
     */
     */
    private SignalThresholdInfo(@AccessNetworkConstants.RadioAccessNetworkType int ran,
    private SignalThresholdInfo(
            @SignalMeasurementType int signalMeasurementType, int hysteresisMs, int hysteresisDb,
            @AccessNetworkConstants.RadioAccessNetworkType int ran,
            @NonNull int[] thresholds, boolean isEnabled) {
            @SignalMeasurementType int signalMeasurementType,
            int hysteresisMs,
            int hysteresisDb,
            @NonNull int[] thresholds,
            boolean isEnabled) {
        Objects.requireNonNull(thresholds, "thresholds must not be null");
        Objects.requireNonNull(thresholds, "thresholds must not be null");
        validateRanWithMeasurementType(ran, signalMeasurementType);
        validateRanWithMeasurementType(ran, signalMeasurementType);
        validateThresholdRange(signalMeasurementType, thresholds);
        validateThresholdRange(signalMeasurementType, thresholds);
@@ -399,6 +425,7 @@ public final class SignalThresholdInfo implements Parcelable {
         * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRP
         * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRP
         * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRQ
         * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRQ
         * @see #SIGNAL_MEASUREMENT_TYPE_SSSINR
         * @see #SIGNAL_MEASUREMENT_TYPE_SSSINR
         * @see #SIGNAL_MEASUREMENT_TYPE_ECNO
         * @see #getThresholds() for more details on signal strength thresholds
         * @see #getThresholds() for more details on signal strength thresholds
         */
         */
        public @NonNull Builder setThresholds(@NonNull int[] thresholds) {
        public @NonNull Builder setThresholds(@NonNull int[] thresholds) {
@@ -417,18 +444,20 @@ public final class SignalThresholdInfo implements Parcelable {
         */
         */
        public @NonNull Builder setThresholds(@NonNull int[] thresholds, boolean isSystem) {
        public @NonNull Builder setThresholds(@NonNull int[] thresholds, boolean isSystem) {
            Objects.requireNonNull(thresholds, "thresholds must not be null");
            Objects.requireNonNull(thresholds, "thresholds must not be null");
            if (!isSystem && (thresholds.length < MINIMUM_NUMBER_OF_THRESHOLDS_ALLOWED
            if (!isSystem
                    && (thresholds.length < MINIMUM_NUMBER_OF_THRESHOLDS_ALLOWED
                            || thresholds.length > MAXIMUM_NUMBER_OF_THRESHOLDS_ALLOWED)) {
                            || thresholds.length > MAXIMUM_NUMBER_OF_THRESHOLDS_ALLOWED)) {
                throw new IllegalArgumentException(
                throw new IllegalArgumentException(
                        "thresholds length must between " + MINIMUM_NUMBER_OF_THRESHOLDS_ALLOWED
                        "thresholds length must between "
                                + " and " + MAXIMUM_NUMBER_OF_THRESHOLDS_ALLOWED);
                                + MINIMUM_NUMBER_OF_THRESHOLDS_ALLOWED
                                + " and "
                                + MAXIMUM_NUMBER_OF_THRESHOLDS_ALLOWED);
            }
            }
            mThresholds = thresholds.clone();
            mThresholds = thresholds.clone();
            Arrays.sort(mThresholds);
            Arrays.sort(mThresholds);
            return this;
            return this;
        }
        }



        /**
        /**
         * Set if the modem should trigger the report based on the criteria.
         * Set if the modem should trigger the report based on the criteria.
         *
         *
@@ -451,8 +480,13 @@ public final class SignalThresholdInfo implements Parcelable {
         * measurement type
         * measurement type
         */
         */
        public @NonNull SignalThresholdInfo build() {
        public @NonNull SignalThresholdInfo build() {
            return new SignalThresholdInfo(mRan, mSignalMeasurementType, mHysteresisMs,
            return new SignalThresholdInfo(
                    mHysteresisDb, mThresholds, mIsEnabled);
                    mRan,
                    mSignalMeasurementType,
                    mHysteresisMs,
                    mHysteresisDb,
                    mThresholds,
                    mIsEnabled);
        }
        }
    }
    }


@@ -508,6 +542,7 @@ public final class SignalThresholdInfo implements Parcelable {
     * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRP
     * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRP
     * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRQ
     * @see #SIGNAL_MEASUREMENT_TYPE_SSRSRQ
     * @see #SIGNAL_MEASUREMENT_TYPE_SSSINR
     * @see #SIGNAL_MEASUREMENT_TYPE_SSSINR
     * @see #SIGNAL_MEASUREMENT_TYPE_ECNO
     */
     */
    public @NonNull int[] getThresholds() {
    public @NonNull int[] getThresholds() {
        return mThresholds.clone();
        return mThresholds.clone();
@@ -574,8 +609,13 @@ public final class SignalThresholdInfo implements Parcelable {


    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mRan, mSignalMeasurementType, mHysteresisMs, mHysteresisDb,
        return Objects.hash(
                Arrays.hashCode(mThresholds), mIsEnabled);
                mRan,
                mSignalMeasurementType,
                mHysteresisMs,
                mHysteresisDb,
                Arrays.hashCode(mThresholds),
                mIsEnabled);
    }
    }


    public static final @NonNull Parcelable.Creator<SignalThresholdInfo> CREATOR =
    public static final @NonNull Parcelable.Creator<SignalThresholdInfo> CREATOR =
@@ -594,13 +634,20 @@ public final class SignalThresholdInfo implements Parcelable {
    @Override
    @Override
    public String toString() {
    public String toString() {
        return new StringBuilder("SignalThresholdInfo{")
        return new StringBuilder("SignalThresholdInfo{")
                .append("mRan=").append(mRan)
                .append("mRan=")
                .append(" mSignalMeasurementType=").append(mSignalMeasurementType)
                .append(mRan)
                .append(" mHysteresisMs=").append(mHysteresisMs)
                .append(" mSignalMeasurementType=")
                .append(" mHysteresisDb=").append(mHysteresisDb)
                .append(mSignalMeasurementType)
                .append(" mThresholds=").append(Arrays.toString(mThresholds))
                .append(" mHysteresisMs=")
                .append(" mIsEnabled=").append(mIsEnabled)
                .append(mHysteresisMs)
                .append("}").toString();
                .append(" mHysteresisDb=")
                .append(mHysteresisDb)
                .append(" mThresholds=")
                .append(Arrays.toString(mThresholds))
                .append(" mIsEnabled=")
                .append(mIsEnabled)
                .append("}")
                .toString();
    }
    }


    /**
    /**
@@ -624,6 +671,8 @@ public final class SignalThresholdInfo implements Parcelable {
                return threshold >= SIGNAL_SSRSRQ_MIN_VALUE && threshold <= SIGNAL_SSRSRQ_MAX_VALUE;
                return threshold >= SIGNAL_SSRSRQ_MIN_VALUE && threshold <= SIGNAL_SSRSRQ_MAX_VALUE;
            case SIGNAL_MEASUREMENT_TYPE_SSSINR:
            case SIGNAL_MEASUREMENT_TYPE_SSSINR:
                return threshold >= SIGNAL_SSSINR_MIN_VALUE && threshold <= SIGNAL_SSSINR_MAX_VALUE;
                return threshold >= SIGNAL_SSSINR_MIN_VALUE && threshold <= SIGNAL_SSSINR_MAX_VALUE;
            case SIGNAL_MEASUREMENT_TYPE_ECNO:
                return threshold >= SIGNAL_ECNO_MIN_VALUE && threshold <= SIGNAL_ECNO_MAX_VALUE;
            default:
            default:
                return false;
                return false;
        }
        }
@@ -640,6 +689,7 @@ public final class SignalThresholdInfo implements Parcelable {
                return ran == AccessNetworkConstants.AccessNetworkType.GERAN
                return ran == AccessNetworkConstants.AccessNetworkType.GERAN
                        || ran == AccessNetworkConstants.AccessNetworkType.CDMA2000;
                        || ran == AccessNetworkConstants.AccessNetworkType.CDMA2000;
            case SIGNAL_MEASUREMENT_TYPE_RSCP:
            case SIGNAL_MEASUREMENT_TYPE_RSCP:
            case SIGNAL_MEASUREMENT_TYPE_ECNO:
                return ran == AccessNetworkConstants.AccessNetworkType.UTRAN;
                return ran == AccessNetworkConstants.AccessNetworkType.UTRAN;
            case SIGNAL_MEASUREMENT_TYPE_RSRP:
            case SIGNAL_MEASUREMENT_TYPE_RSRP:
            case SIGNAL_MEASUREMENT_TYPE_RSRQ:
            case SIGNAL_MEASUREMENT_TYPE_RSRQ:
@@ -663,13 +713,15 @@ public final class SignalThresholdInfo implements Parcelable {
        }
        }
    }
    }


    private void validateThresholdRange(@SignalMeasurementType int signalMeasurement,
    private void validateThresholdRange(
            int[] thresholds) {
            @SignalMeasurementType int signalMeasurement, int[] thresholds) {
        for (int threshold : thresholds) {
        for (int threshold : thresholds) {
            if (!isValidThreshold(signalMeasurement, threshold)) {
            if (!isValidThreshold(signalMeasurement, threshold)) {
                throw new IllegalArgumentException(
                throw new IllegalArgumentException(
                        "invalid signal measurement type: " + signalMeasurement
                        "invalid signal measurement type: "
                                + " with threshold: " + threshold);
                                + signalMeasurement
                                + " with threshold: "
                                + threshold);
            }
            }
        }
        }
    }
    }