Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int getSignalIconLevel(String type) {
- int iconLevel = 0;
- if (isCdma() || isLTE()) {
- /* TODO: Test on AT&T LTE.
- But it seems LTE's signal is in getCdmaRaw() */
- if (isEvdo()){
- iconLevel = getEvdoRaw();
- } else {
- iconLevel = getCdmaRaw();
- }
- } else if (isGSM()) {
- if (type.equals(RAW_TYPE)) {
- iconLevel = mSignalStrength.getGsmSignalStrength();
- } else if (type.equals(BAR_TYPE)) {
- int asu = mSignalStrength.getGsmSignalStrength();
- // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
- // asu = 0 (-113dB or less) is very weak
- // signal, its better to show 0 bars to the user in such cases.
- // asu = 99 is a special case, where the signal strength is unknown.
- if (asu <= 2 || asu == 99) iconLevel = 0;
- else if (asu >= 12) iconLevel = 4;
- else if (asu >= 8) iconLevel = 3;
- else if (asu >= 5) iconLevel = 2;
- else iconLevel = 1;
- }
- }
- }
- return iconLevel;
- }
Add Comment
Please, Sign In to add comment