Loading telephony/java/android/telephony/CarrierConfigManager.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -2242,7 +2242,7 @@ public class CarrierConfigManager { * e.g.) To use RSCP by default, set the value to "rscp". The signal strength level will * e.g.) To use RSCP by default, set the value to "rscp". The signal strength level will * then be determined by #KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY * then be determined by #KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY * <p> * <p> * Currently this only supports the value "rscp" * Currently this supports the value "rscp" and "rssi". * @hide * @hide */ */ // FIXME: this key and related keys must not be exposed without a consistent philosophy for // FIXME: this key and related keys must not be exposed without a consistent philosophy for Loading Loading @@ -2690,7 +2690,7 @@ public class CarrierConfigManager { -95, /* SIGNAL_STRENGTH_GOOD */ -95, /* SIGNAL_STRENGTH_GOOD */ -85 /* SIGNAL_STRENGTH_GREAT */ -85 /* SIGNAL_STRENGTH_GREAT */ }); }); sDefaults.putString(KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, ""); sDefaults.putString(KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, "rssi"); sDefaults.putBoolean(KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL, false); sDefaults.putBoolean(KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL, false); sDefaults.putBoolean(KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL, false); sDefaults.putBoolean(KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL, false); sDefaults.putBoolean(KEY_CALL_FORWARDING_OVER_UT_WARNING_BOOL, false); sDefaults.putBoolean(KEY_CALL_FORWARDING_OVER_UT_WARNING_BOOL, false); Loading telephony/java/android/telephony/CellSignalStrength.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,9 @@ public abstract class CellSignalStrength { /** @hide */ /** @hide */ public static final int NUM_SIGNAL_STRENGTH_BINS = 5; public static final int NUM_SIGNAL_STRENGTH_BINS = 5; /** @hide */ protected static final int NUM_SIGNAL_STRENGTH_THRESHOLDS = NUM_SIGNAL_STRENGTH_BINS - 1; /** @hide */ /** @hide */ public static final String[] SIGNAL_STRENGTH_NAMES = { public static final String[] SIGNAL_STRENGTH_NAMES = { "none", "poor", "moderate", "good", "great" "none", "poor", "moderate", "good", "great" Loading telephony/java/android/telephony/CellSignalStrengthWcdma.java +58 −16 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.os.PersistableBundle; import android.os.PersistableBundle; import android.telephony.Rlog; import android.telephony.Rlog; import android.text.TextUtils; import java.lang.annotation.Retention; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy; Loading @@ -41,8 +42,18 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements private static final int WCDMA_RSSI_POOR = -107; private static final int WCDMA_RSSI_POOR = -107; private static final int WCDMA_RSSI_MIN = -113; private static final int WCDMA_RSSI_MIN = -113; private static final int WCDMA_RSCP_MIN = -120; private static final int[] sRssiThresholds = new int[]{ WCDMA_RSSI_POOR, WCDMA_RSSI_MODERATE, WCDMA_RSSI_GOOD, WCDMA_RSSI_GREAT}; private static final int WCDMA_RSCP_MAX = -24; private static final int WCDMA_RSCP_MAX = -24; private static final int WCDMA_RSCP_GREAT = -85; private static final int WCDMA_RSCP_GOOD = -95; private static final int WCDMA_RSCP_MODERATE = -105; private static final int WCDMA_RSCP_POOR = -115; private static final int WCDMA_RSCP_MIN = -120; private static final int[] sRscpThresholds = new int[] { WCDMA_RSCP_POOR, WCDMA_RSCP_MODERATE, WCDMA_RSCP_GOOD, WCDMA_RSCP_GREAT}; // TODO: Because these are used as values in CarrierConfig, they should be exposed somehow. // TODO: Because these are used as values in CarrierConfig, they should be exposed somehow. /** @hide */ /** @hide */ Loading @@ -54,6 +65,9 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements /** @hide */ /** @hide */ public static final String LEVEL_CALCULATION_METHOD_RSCP = "rscp"; public static final String LEVEL_CALCULATION_METHOD_RSCP = "rscp"; // Default to RSSI for backwards compatibility with older devices private static final String sLevelCalculationMethod = LEVEL_CALCULATION_METHOD_RSSI; private int mRssi; // in dBm [-113, 51] or CellInfo.UNAVAILABLE if unknown private int mRssi; // in dBm [-113, 51] or CellInfo.UNAVAILABLE if unknown private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or // CellInfo.UNAVAILABLE if unknown // CellInfo.UNAVAILABLE if unknown Loading Loading @@ -121,10 +135,6 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } } private static final String sLevelCalculationMethod = LEVEL_CALCULATION_METHOD_RSSI; private static final int[] sThresholds = new int[]{ WCDMA_RSSI_POOR, WCDMA_RSSI_GOOD, WCDMA_RSSI_GOOD, WCDMA_RSSI_GREAT}; /** /** * Retrieve an abstract level value for the overall signal strength. * Retrieve an abstract level value for the overall signal strength. * * Loading @@ -140,41 +150,46 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements @Override @Override public void updateLevel(PersistableBundle cc, ServiceState ss) { public void updateLevel(PersistableBundle cc, ServiceState ss) { String calcMethod; String calcMethod; int[] thresholds; int[] rscpThresholds; if (cc == null) { if (cc == null) { calcMethod = sLevelCalculationMethod; calcMethod = sLevelCalculationMethod; thresholds = sThresholds; rscpThresholds = sRscpThresholds; } else { } else { // TODO: abstract this entire thing into a series of functions // TODO: abstract this entire thing into a series of functions calcMethod = cc.getString( calcMethod = cc.getString( CarrierConfigManager.KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, CarrierConfigManager.KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, sLevelCalculationMethod); sLevelCalculationMethod); thresholds = cc.getIntArray( if (TextUtils.isEmpty(calcMethod)) calcMethod = sLevelCalculationMethod; rscpThresholds = cc.getIntArray( CarrierConfigManager.KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY); CarrierConfigManager.KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY); if (thresholds == null) thresholds = sThresholds; if (rscpThresholds == null || rscpThresholds.length != NUM_SIGNAL_STRENGTH_THRESHOLDS) { rscpThresholds = sRscpThresholds; } } } int level = thresholds.length; int level = NUM_SIGNAL_STRENGTH_THRESHOLDS; switch (calcMethod) { switch (calcMethod) { case LEVEL_CALCULATION_METHOD_RSCP: case LEVEL_CALCULATION_METHOD_RSCP: if (mRscp < WCDMA_RSCP_MIN || mRscp > WCDMA_RSCP_MAX) { if (mRscp < WCDMA_RSCP_MIN || mRscp > WCDMA_RSCP_MAX) { mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; return; return; } } while (level > 0 && mRscp < thresholds[level - 1]) level--; while (level > 0 && mRscp < rscpThresholds[level - 1]) level--; mLevel = level; mLevel = level; return; return; default: loge("Invalid Level Calculation Method for CellSignalStrengthWcdma = " + calcMethod); /** fall through */ case LEVEL_CALCULATION_METHOD_RSSI: case LEVEL_CALCULATION_METHOD_RSSI: if (mRssi < WCDMA_RSSI_MIN || mRssi > WCDMA_RSSI_MAX) { if (mRssi < WCDMA_RSSI_MIN || mRssi > WCDMA_RSSI_MAX) { mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; return; return; } } while (level > 0 && mRssi < thresholds[level - 1]) level--; while (level > 0 && mRssi < sRssiThresholds[level - 1]) level--; mLevel = level; mLevel = level; return; return; default: mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } } } } Loading Loading @@ -204,7 +219,7 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements } } /** /** * Get the signal strength as dBm * Get the RSSI as dBm * * * @hide * @hide */ */ Loading @@ -214,12 +229,32 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements /** /** * Get the RSCP as dBm * Get the RSCP as dBm * * @hide * @hide */ */ public int getRscp() { public int getRscp() { return mRscp; return mRscp; } } /** * Get the Ec/No as dB * * @hide */ public int getEcNo() { return mEcNo; } /** * Return the Bit Error Rate * * @returns the bit error rate (0-7, 99) as defined in TS 27.007 8.5 or UNAVAILABLE. * @hide */ public int getBitErrorRate() { return mBitErrorRate; } @Override @Override public int hashCode() { public int hashCode() { return Objects.hash(mRssi, mBitErrorRate, mRscp, mEcNo, mLevel); return Objects.hash(mRssi, mBitErrorRate, mRscp, mEcNo, mLevel); Loading Loading @@ -304,9 +339,16 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements }; }; /** /** * log * log warning */ */ private static void log(String s) { private static void log(String s) { Rlog.w(LOG_TAG, s); Rlog.w(LOG_TAG, s); } } /** * log error */ private static void loge(String s) { Rlog.e(LOG_TAG, s); } } } Loading
telephony/java/android/telephony/CarrierConfigManager.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -2242,7 +2242,7 @@ public class CarrierConfigManager { * e.g.) To use RSCP by default, set the value to "rscp". The signal strength level will * e.g.) To use RSCP by default, set the value to "rscp". The signal strength level will * then be determined by #KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY * then be determined by #KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY * <p> * <p> * Currently this only supports the value "rscp" * Currently this supports the value "rscp" and "rssi". * @hide * @hide */ */ // FIXME: this key and related keys must not be exposed without a consistent philosophy for // FIXME: this key and related keys must not be exposed without a consistent philosophy for Loading Loading @@ -2690,7 +2690,7 @@ public class CarrierConfigManager { -95, /* SIGNAL_STRENGTH_GOOD */ -95, /* SIGNAL_STRENGTH_GOOD */ -85 /* SIGNAL_STRENGTH_GREAT */ -85 /* SIGNAL_STRENGTH_GREAT */ }); }); sDefaults.putString(KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, ""); sDefaults.putString(KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, "rssi"); sDefaults.putBoolean(KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL, false); sDefaults.putBoolean(KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL, false); sDefaults.putBoolean(KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL, false); sDefaults.putBoolean(KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL, false); sDefaults.putBoolean(KEY_CALL_FORWARDING_OVER_UT_WARNING_BOOL, false); sDefaults.putBoolean(KEY_CALL_FORWARDING_OVER_UT_WARNING_BOOL, false); Loading
telephony/java/android/telephony/CellSignalStrength.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,9 @@ public abstract class CellSignalStrength { /** @hide */ /** @hide */ public static final int NUM_SIGNAL_STRENGTH_BINS = 5; public static final int NUM_SIGNAL_STRENGTH_BINS = 5; /** @hide */ protected static final int NUM_SIGNAL_STRENGTH_THRESHOLDS = NUM_SIGNAL_STRENGTH_BINS - 1; /** @hide */ /** @hide */ public static final String[] SIGNAL_STRENGTH_NAMES = { public static final String[] SIGNAL_STRENGTH_NAMES = { "none", "poor", "moderate", "good", "great" "none", "poor", "moderate", "good", "great" Loading
telephony/java/android/telephony/CellSignalStrengthWcdma.java +58 −16 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.os.PersistableBundle; import android.os.PersistableBundle; import android.telephony.Rlog; import android.telephony.Rlog; import android.text.TextUtils; import java.lang.annotation.Retention; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy; Loading @@ -41,8 +42,18 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements private static final int WCDMA_RSSI_POOR = -107; private static final int WCDMA_RSSI_POOR = -107; private static final int WCDMA_RSSI_MIN = -113; private static final int WCDMA_RSSI_MIN = -113; private static final int WCDMA_RSCP_MIN = -120; private static final int[] sRssiThresholds = new int[]{ WCDMA_RSSI_POOR, WCDMA_RSSI_MODERATE, WCDMA_RSSI_GOOD, WCDMA_RSSI_GREAT}; private static final int WCDMA_RSCP_MAX = -24; private static final int WCDMA_RSCP_MAX = -24; private static final int WCDMA_RSCP_GREAT = -85; private static final int WCDMA_RSCP_GOOD = -95; private static final int WCDMA_RSCP_MODERATE = -105; private static final int WCDMA_RSCP_POOR = -115; private static final int WCDMA_RSCP_MIN = -120; private static final int[] sRscpThresholds = new int[] { WCDMA_RSCP_POOR, WCDMA_RSCP_MODERATE, WCDMA_RSCP_GOOD, WCDMA_RSCP_GREAT}; // TODO: Because these are used as values in CarrierConfig, they should be exposed somehow. // TODO: Because these are used as values in CarrierConfig, they should be exposed somehow. /** @hide */ /** @hide */ Loading @@ -54,6 +65,9 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements /** @hide */ /** @hide */ public static final String LEVEL_CALCULATION_METHOD_RSCP = "rscp"; public static final String LEVEL_CALCULATION_METHOD_RSCP = "rscp"; // Default to RSSI for backwards compatibility with older devices private static final String sLevelCalculationMethod = LEVEL_CALCULATION_METHOD_RSSI; private int mRssi; // in dBm [-113, 51] or CellInfo.UNAVAILABLE if unknown private int mRssi; // in dBm [-113, 51] or CellInfo.UNAVAILABLE if unknown private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or // CellInfo.UNAVAILABLE if unknown // CellInfo.UNAVAILABLE if unknown Loading Loading @@ -121,10 +135,6 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } } private static final String sLevelCalculationMethod = LEVEL_CALCULATION_METHOD_RSSI; private static final int[] sThresholds = new int[]{ WCDMA_RSSI_POOR, WCDMA_RSSI_GOOD, WCDMA_RSSI_GOOD, WCDMA_RSSI_GREAT}; /** /** * Retrieve an abstract level value for the overall signal strength. * Retrieve an abstract level value for the overall signal strength. * * Loading @@ -140,41 +150,46 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements @Override @Override public void updateLevel(PersistableBundle cc, ServiceState ss) { public void updateLevel(PersistableBundle cc, ServiceState ss) { String calcMethod; String calcMethod; int[] thresholds; int[] rscpThresholds; if (cc == null) { if (cc == null) { calcMethod = sLevelCalculationMethod; calcMethod = sLevelCalculationMethod; thresholds = sThresholds; rscpThresholds = sRscpThresholds; } else { } else { // TODO: abstract this entire thing into a series of functions // TODO: abstract this entire thing into a series of functions calcMethod = cc.getString( calcMethod = cc.getString( CarrierConfigManager.KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, CarrierConfigManager.KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, sLevelCalculationMethod); sLevelCalculationMethod); thresholds = cc.getIntArray( if (TextUtils.isEmpty(calcMethod)) calcMethod = sLevelCalculationMethod; rscpThresholds = cc.getIntArray( CarrierConfigManager.KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY); CarrierConfigManager.KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY); if (thresholds == null) thresholds = sThresholds; if (rscpThresholds == null || rscpThresholds.length != NUM_SIGNAL_STRENGTH_THRESHOLDS) { rscpThresholds = sRscpThresholds; } } } int level = thresholds.length; int level = NUM_SIGNAL_STRENGTH_THRESHOLDS; switch (calcMethod) { switch (calcMethod) { case LEVEL_CALCULATION_METHOD_RSCP: case LEVEL_CALCULATION_METHOD_RSCP: if (mRscp < WCDMA_RSCP_MIN || mRscp > WCDMA_RSCP_MAX) { if (mRscp < WCDMA_RSCP_MIN || mRscp > WCDMA_RSCP_MAX) { mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; return; return; } } while (level > 0 && mRscp < thresholds[level - 1]) level--; while (level > 0 && mRscp < rscpThresholds[level - 1]) level--; mLevel = level; mLevel = level; return; return; default: loge("Invalid Level Calculation Method for CellSignalStrengthWcdma = " + calcMethod); /** fall through */ case LEVEL_CALCULATION_METHOD_RSSI: case LEVEL_CALCULATION_METHOD_RSSI: if (mRssi < WCDMA_RSSI_MIN || mRssi > WCDMA_RSSI_MAX) { if (mRssi < WCDMA_RSSI_MIN || mRssi > WCDMA_RSSI_MAX) { mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; return; return; } } while (level > 0 && mRssi < thresholds[level - 1]) level--; while (level > 0 && mRssi < sRssiThresholds[level - 1]) level--; mLevel = level; mLevel = level; return; return; default: mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } } } } Loading Loading @@ -204,7 +219,7 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements } } /** /** * Get the signal strength as dBm * Get the RSSI as dBm * * * @hide * @hide */ */ Loading @@ -214,12 +229,32 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements /** /** * Get the RSCP as dBm * Get the RSCP as dBm * * @hide * @hide */ */ public int getRscp() { public int getRscp() { return mRscp; return mRscp; } } /** * Get the Ec/No as dB * * @hide */ public int getEcNo() { return mEcNo; } /** * Return the Bit Error Rate * * @returns the bit error rate (0-7, 99) as defined in TS 27.007 8.5 or UNAVAILABLE. * @hide */ public int getBitErrorRate() { return mBitErrorRate; } @Override @Override public int hashCode() { public int hashCode() { return Objects.hash(mRssi, mBitErrorRate, mRscp, mEcNo, mLevel); return Objects.hash(mRssi, mBitErrorRate, mRscp, mEcNo, mLevel); Loading Loading @@ -304,9 +339,16 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements }; }; /** /** * log * log warning */ */ private static void log(String s) { private static void log(String s) { Rlog.w(LOG_TAG, s); Rlog.w(LOG_TAG, s); } } /** * log error */ private static void loge(String s) { Rlog.e(LOG_TAG, s); } } }