diff --git a/core/api/current.txt b/core/api/current.txt index 35d8431e9ae0d..4b3e35ee1f188 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -43827,6 +43827,7 @@ package android.telephony { public final class SignalThresholdInfo implements android.os.Parcelable { method public int describeContents(); + method public int getHysteresisDb(); method public static int getMaximumNumberOfThresholdsAllowed(); method public static int getMinimumNumberOfThresholdsAllowed(); method public int getRadioAccessNetworkType(); @@ -43849,6 +43850,7 @@ package android.telephony { public static final class SignalThresholdInfo.Builder { ctor public SignalThresholdInfo.Builder(); method @NonNull public android.telephony.SignalThresholdInfo build(); + method @NonNull public android.telephony.SignalThresholdInfo.Builder setHysteresisDb(@IntRange(from=0) int); method @NonNull public android.telephony.SignalThresholdInfo.Builder setRadioAccessNetworkType(int); method @NonNull public android.telephony.SignalThresholdInfo.Builder setSignalMeasurementType(int); method @NonNull public android.telephony.SignalThresholdInfo.Builder setThresholds(@NonNull int[]); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index c4744ef21ead4..884458f0ec888 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -2989,6 +2989,39 @@ public class CarrierConfigManager { public static final String KEY_5G_NR_SSSINR_THRESHOLDS_INT_ARRAY = "5g_nr_sssinr_thresholds_int_array"; + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRP} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String + KEY_NGRAN_SSRSRP_HYSTERESIS_DB_INT = "ngran_ssrsrp_hysteresis_db_int"; + + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRQ} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + *@hide + */ + public static final String + KEY_NGRAN_SSRSRQ_HYSTERESIS_DB_INT = "ngran_ssrsrq_hysteresis_db_int"; + + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSSINR} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String + KEY_NGRAN_SSSINR_HYSTERESIS_DB_INT = "ngran_sssinr_hysteresis_db_int"; + /** * Bit-field integer to determine whether to use SS reference signal received power (SSRSRP), * SS reference signal received quality (SSRSRQ), or/and SS signal-to-noise and interference @@ -3325,6 +3358,38 @@ public class CarrierConfigManager { public static final String KEY_LTE_RSSNR_THRESHOLDS_INT_ARRAY = "lte_rssnr_thresholds_int_array"; + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRP} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String + KEY_EUTRAN_RSRP_HYSTERESIS_DB_INT = "eutran_rsrp_hysteresis_db_int"; + + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRQ} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String KEY_EUTRAN_RSRQ_HYSTERESIS_DB_INT = "eutran_rsrq_hysteresis_db_int"; + + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSNR} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String + KEY_EUTRAN_RSSNR_HYSTERESIS_DB_INT = "eutran_rssnr_hysteresis_db_int"; + /** * Decides when clients try to bind to iwlan network service, which package name will * the binding intent go to. @@ -3401,6 +3466,26 @@ public class CarrierConfigManager { public static final String KEY_WCDMA_ECNO_THRESHOLDS_INT_ARRAY = "wcdma_ecno_thresholds_int_array"; + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSCP} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String KEY_UTRAN_RSCP_HYSTERESIS_DB_INT = "utran_rscp_hysteresis_db_int"; + + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_ECNO} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String KEY_UTRAN_ECNO_HYSTERESIS_DB_INT = "utran_ecno_hysteresis_db_int"; + /** * The default measurement to use for signal strength reporting. If this is not specified, the * RSSI is used. @@ -8685,6 +8770,16 @@ public class CarrierConfigManager { public static final String KEY_GSM_RSSI_THRESHOLDS_INT_ARRAY = "gsm_rssi_thresholds_int_array"; + /** + * An interval in dB for {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSI} measurement + * type defining the required magnitude change between reports. + * + *

The default value is 2 and the minimum allowed value is 0. If no value or negative value + * is set, the default value 2 is used. + * @hide + */ + public static final String KEY_GERAN_RSSI_HYSTERESIS_DB_INT = "geran_rssi_hysteresis_db_int"; + /** * Determines whether Wireless Priority Service call is supported over IMS. * @@ -9666,6 +9761,15 @@ public class CarrierConfigManager { 15, /* SIGNAL_STRENGTH_GOOD */ 30 /* SIGNAL_STRENGTH_GREAT */ }); + sDefaults.putInt(KEY_GERAN_RSSI_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_UTRAN_RSCP_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_EUTRAN_RSRP_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_EUTRAN_RSRQ_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_EUTRAN_RSSNR_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_NGRAN_SSRSRP_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_NGRAN_SSRSRQ_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_NGRAN_SSSINR_HYSTERESIS_DB_INT, 2); + sDefaults.putInt(KEY_UTRAN_ECNO_HYSTERESIS_DB_INT, 2); sDefaults.putInt(KEY_PARAMETERS_USE_FOR_5G_NR_SIGNAL_BAR_INT, CellSignalStrengthNr.USE_SSRSRP); sDefaults.putBoolean(KEY_SIGNAL_STRENGTH_NR_NSA_USE_LTE_AS_PRIMARY_BOOL, true); diff --git a/telephony/java/android/telephony/SignalThresholdInfo.java b/telephony/java/android/telephony/SignalThresholdInfo.java index 7053b44df1a2c..80f1de1b2e8a2 100644 --- a/telephony/java/android/telephony/SignalThresholdInfo.java +++ b/telephony/java/android/telephony/SignalThresholdInfo.java @@ -17,6 +17,7 @@ package android.telephony; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; @@ -169,11 +170,18 @@ public final class SignalThresholdInfo implements Parcelable { public static final int HYSTERESIS_MS_DISABLED = 0; /** - * Indicates the hysteresisDb is disabled. + * Indicates the default hysteresis value in dB. * * @hide */ - public static final int HYSTERESIS_DB_DISABLED = 0; + private static final int HYSTERESIS_DB_DEFAULT = 2; + + /** + * Indicates the hysteresisDb value is not set and to be initialised to default value. + * + * @hide + */ + public static final int HYSTERESIS_DB_MINIMUM = 0; /** * Minimum valid value for {@link #SIGNAL_MEASUREMENT_TYPE_RSSI}. @@ -339,7 +347,7 @@ public final class SignalThresholdInfo implements Parcelable { mRan = ran; mSignalMeasurementType = signalMeasurementType; mHysteresisMs = hysteresisMs < 0 ? HYSTERESIS_MS_DISABLED : hysteresisMs; - mHysteresisDb = hysteresisDb < 0 ? HYSTERESIS_DB_DISABLED : hysteresisDb; + mHysteresisDb = hysteresisDb; mThresholds = thresholds; mIsEnabled = isEnabled; } @@ -351,7 +359,7 @@ public final class SignalThresholdInfo implements Parcelable { private int mRan = AccessNetworkConstants.AccessNetworkType.UNKNOWN; private int mSignalMeasurementType = SIGNAL_MEASUREMENT_TYPE_UNKNOWN; private int mHysteresisMs = HYSTERESIS_MS_DISABLED; - private int mHysteresisDb = HYSTERESIS_DB_DISABLED; + private int mHysteresisDb = HYSTERESIS_DB_DEFAULT; private int[] mThresholds = null; private boolean mIsEnabled = false; @@ -361,7 +369,8 @@ public final class SignalThresholdInfo implements Parcelable { * @param ran The radio access network type * @return the builder to facilitate the chaining */ - public @NonNull Builder setRadioAccessNetworkType( + @NonNull + public Builder setRadioAccessNetworkType( @AccessNetworkConstants.RadioAccessNetworkType int ran) { mRan = ran; return this; @@ -373,7 +382,8 @@ public final class SignalThresholdInfo implements Parcelable { * @param signalMeasurementType The signal measurement type * @return the builder to facilitate the chaining */ - public @NonNull Builder setSignalMeasurementType( + @NonNull + public Builder setSignalMeasurementType( @SignalMeasurementType int signalMeasurementType) { mSignalMeasurementType = signalMeasurementType; return this; @@ -387,20 +397,27 @@ public final class SignalThresholdInfo implements Parcelable { * @return the builder to facilitate the chaining * @hide */ - public @NonNull Builder setHysteresisMs(int hysteresisMs) { + @NonNull + public Builder setHysteresisMs(int hysteresisMs) { mHysteresisMs = hysteresisMs; return this; } /** - * Set the interval in dB defining the required magnitude change between reports. A value of - * zero disabled dB-based hysteresis restrictions. + * Set the interval in dB defining the required minimum magnitude change to report a + * signal strength change. A value of zero disables dB-based hysteresis restrictions. + * Note: + *

Default hysteresis db value is 2. Minimum hysteresis db value allowed to set is 0. + * If hysteresis db value is not set, default hysteresis db value of 2 will be used. * * @param hysteresisDb the interval in dB * @return the builder to facilitate the chaining - * @hide */ - public @NonNull Builder setHysteresisDb(int hysteresisDb) { + @NonNull + public Builder setHysteresisDb(@IntRange(from = 0) int hysteresisDb) { + if (hysteresisDb < 0) { + throw new IllegalArgumentException("hysteresis db value should not be less than 0"); + } mHysteresisDb = hysteresisDb; return this; } @@ -428,7 +445,8 @@ public final class SignalThresholdInfo implements Parcelable { * @see #SIGNAL_MEASUREMENT_TYPE_ECNO * @see #getThresholds() for more details on signal strength thresholds */ - public @NonNull Builder setThresholds(@NonNull int[] thresholds) { + @NonNull + public Builder setThresholds(@NonNull int[] thresholds) { return setThresholds(thresholds, false /*isSystem*/); } @@ -442,7 +460,8 @@ public final class SignalThresholdInfo implements Parcelable { * * @hide */ - public @NonNull Builder setThresholds(@NonNull int[] thresholds, boolean isSystem) { + @NonNull + public Builder setThresholds(@NonNull int[] thresholds, boolean isSystem) { Objects.requireNonNull(thresholds, "thresholds must not be null"); if (!isSystem && (thresholds.length < MINIMUM_NUMBER_OF_THRESHOLDS_ALLOWED @@ -465,7 +484,8 @@ public final class SignalThresholdInfo implements Parcelable { * @return the builder to facilitate the chaining * @hide */ - public @NonNull Builder setIsEnabled(boolean isEnabled) { + @NonNull + public Builder setIsEnabled(boolean isEnabled) { mIsEnabled = isEnabled; return this; } @@ -479,7 +499,8 @@ public final class SignalThresholdInfo implements Parcelable { * the thresholds is out of range, or the RAN is not allowed to set with the signal * measurement type */ - public @NonNull SignalThresholdInfo build() { + @NonNull + public SignalThresholdInfo build() { return new SignalThresholdInfo( mRan, mSignalMeasurementType, @@ -495,7 +516,8 @@ public final class SignalThresholdInfo implements Parcelable { * * @return radio access network type */ - public @AccessNetworkConstants.RadioAccessNetworkType int getRadioAccessNetworkType() { + @AccessNetworkConstants.RadioAccessNetworkType + public int getRadioAccessNetworkType() { return mRan; } @@ -504,7 +526,8 @@ public final class SignalThresholdInfo implements Parcelable { * * @return the SignalMeasurementType value */ - public @SignalMeasurementType int getSignalMeasurementType() { + @SignalMeasurementType + public int getSignalMeasurementType() { return mSignalMeasurementType; } @@ -513,7 +536,11 @@ public final class SignalThresholdInfo implements Parcelable { return mHysteresisMs; } - /** @hide */ + /** + * Get measurement hysteresis db. + * + * @return hysteresis db value + */ public int getHysteresisDb() { return mHysteresisDb; } @@ -544,7 +571,8 @@ public final class SignalThresholdInfo implements Parcelable { * @see #SIGNAL_MEASUREMENT_TYPE_SSSINR * @see #SIGNAL_MEASUREMENT_TYPE_ECNO */ - public @NonNull int[] getThresholds() { + @NonNull + public int[] getThresholds() { return mThresholds.clone(); } @@ -618,7 +646,8 @@ public final class SignalThresholdInfo implements Parcelable { mIsEnabled); } - public static final @NonNull Parcelable.Creator CREATOR = + @NonNull + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public SignalThresholdInfo createFromParcel(Parcel in) {