SignalStrength.java revision 5d7b9271b3f8a5f27c789a2b673e4bfd532b280c
1/*
2 * Copyright (C) 2009 Qualcomm Innovation Center, Inc.  All Rights Reserved.
3 * Copyright (C) 2009 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package android.telephony;
19
20import android.os.Bundle;
21import android.os.Parcel;
22import android.os.Parcelable;
23import android.util.Log;
24
25/**
26 * Contains phone signal strength related information.
27 */
28public class SignalStrength implements Parcelable {
29
30    private static final String LOG_TAG = "SignalStrength";
31    private static final boolean DBG = false;
32
33    /** @hide */
34    public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
35    /** @hide */
36    public static final int SIGNAL_STRENGTH_POOR = 1;
37    /** @hide */
38    public static final int SIGNAL_STRENGTH_MODERATE = 2;
39    /** @hide */
40    public static final int SIGNAL_STRENGTH_GOOD = 3;
41    /** @hide */
42    public static final int SIGNAL_STRENGTH_GREAT = 4;
43    /** @hide */
44    public static final int NUM_SIGNAL_STRENGTH_BINS = 5;
45    /** @hide */
46    public static final String[] SIGNAL_STRENGTH_NAMES = {
47        "none", "poor", "moderate", "good", "great"
48    };
49
50    private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5
51    private int mGsmBitErrorRate;   // bit error rate (0-7, 99) as defined in TS 27.007 8.5
52    private int mCdmaDbm;   // This value is the RSSI value
53    private int mCdmaEcio;  // This value is the Ec/Io
54    private int mEvdoDbm;   // This value is the EVDO RSSI value
55    private int mEvdoEcio;  // This value is the EVDO Ec/Io
56    private int mEvdoSnr;   // Valid values are 0-8.  8 is the highest signal to noise ratio
57    private int mLteSignalStrength;
58    private int mLteRsrp;
59    private int mLteRsrq;
60    private int mLteRssnr;
61    private int mLteCqi;
62
63    private boolean isGsm; // This value is set by the ServiceStateTracker onSignalStrengthResult
64
65    /**
66     * Create a new SignalStrength from a intent notifier Bundle
67     *
68     * This method is used by PhoneStateIntentReceiver and maybe by
69     * external applications.
70     *
71     * @param m Bundle from intent notifier
72     * @return newly created SignalStrength
73     *
74     * @hide
75     */
76    public static SignalStrength newFromBundle(Bundle m) {
77        SignalStrength ret;
78        ret = new SignalStrength();
79        ret.setFromNotifierBundle(m);
80        return ret;
81    }
82
83    /**
84     * Empty constructor
85     *
86     * @hide
87     */
88    public SignalStrength() {
89        mGsmSignalStrength = 99;
90        mGsmBitErrorRate = -1;
91        mCdmaDbm = -1;
92        mCdmaEcio = -1;
93        mEvdoDbm = -1;
94        mEvdoEcio = -1;
95        mEvdoSnr = -1;
96        mLteSignalStrength = -1;
97        mLteRsrp = -1;
98        mLteRsrq = -1;
99        mLteRssnr = -1;
100        mLteCqi = -1;
101        isGsm = true;
102    }
103
104    /**
105     * Constructor
106     *
107     * @hide
108     */
109    public SignalStrength(int gsmSignalStrength, int gsmBitErrorRate,
110            int cdmaDbm, int cdmaEcio,
111            int evdoDbm, int evdoEcio, int evdoSnr,
112            int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi,
113            boolean gsm) {
114        mGsmSignalStrength = gsmSignalStrength;
115        mGsmBitErrorRate = gsmBitErrorRate;
116        mCdmaDbm = cdmaDbm;
117        mCdmaEcio = cdmaEcio;
118        mEvdoDbm = evdoDbm;
119        mEvdoEcio = evdoEcio;
120        mEvdoSnr = evdoSnr;
121        mLteSignalStrength = lteSignalStrength;
122        mLteRsrp = lteRsrp;
123        mLteRsrq = lteRsrq;
124        mLteRssnr = lteRssnr;
125        mLteCqi = lteCqi;
126        isGsm = gsm;
127    }
128
129    /**
130     * Constructor
131     *
132     * @hide
133     */
134    public SignalStrength(int gsmSignalStrength, int gsmBitErrorRate,
135            int cdmaDbm, int cdmaEcio,
136            int evdoDbm, int evdoEcio, int evdoSnr,
137            boolean gsm) {
138        this(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
139                evdoDbm, evdoEcio, evdoSnr, -1, -1, -1, -1, -1, gsm);
140    }
141
142    /**
143     * Copy constructors
144     *
145     * @param s Source SignalStrength
146     *
147     * @hide
148     */
149    public SignalStrength(SignalStrength s) {
150        copyFrom(s);
151    }
152
153    /**
154     * @hide
155     */
156    protected void copyFrom(SignalStrength s) {
157        mGsmSignalStrength = s.mGsmSignalStrength;
158        mGsmBitErrorRate = s.mGsmBitErrorRate;
159        mCdmaDbm = s.mCdmaDbm;
160        mCdmaEcio = s.mCdmaEcio;
161        mEvdoDbm = s.mEvdoDbm;
162        mEvdoEcio = s.mEvdoEcio;
163        mEvdoSnr = s.mEvdoSnr;
164        mLteSignalStrength = s.mLteSignalStrength;
165        mLteRsrp = s.mLteRsrp;
166        mLteRsrq = s.mLteRsrq;
167        mLteRssnr = s.mLteRssnr;
168        mLteCqi = s.mLteCqi;
169        isGsm = s.isGsm;
170    }
171
172    /**
173     * Construct a SignalStrength object from the given parcel.
174     *
175     * @hide
176     */
177    public SignalStrength(Parcel in) {
178        mGsmSignalStrength = in.readInt();
179        mGsmBitErrorRate = in.readInt();
180        mCdmaDbm = in.readInt();
181        mCdmaEcio = in.readInt();
182        mEvdoDbm = in.readInt();
183        mEvdoEcio = in.readInt();
184        mEvdoSnr = in.readInt();
185        mLteSignalStrength = in.readInt();
186        mLteRsrp = in.readInt();
187        mLteRsrq = in.readInt();
188        mLteRssnr = in.readInt();
189        mLteCqi = in.readInt();
190        isGsm = (in.readInt() != 0);
191    }
192
193    /**
194     * {@link Parcelable#writeToParcel}
195     */
196    public void writeToParcel(Parcel out, int flags) {
197        out.writeInt(mGsmSignalStrength);
198        out.writeInt(mGsmBitErrorRate);
199        out.writeInt(mCdmaDbm);
200        out.writeInt(mCdmaEcio);
201        out.writeInt(mEvdoDbm);
202        out.writeInt(mEvdoEcio);
203        out.writeInt(mEvdoSnr);
204        out.writeInt(mLteSignalStrength);
205        out.writeInt(mLteRsrp);
206        out.writeInt(mLteRsrq);
207        out.writeInt(mLteRssnr);
208        out.writeInt(mLteCqi);
209        out.writeInt(isGsm ? 1 : 0);
210    }
211
212    /**
213     * {@link Parcelable#describeContents}
214     */
215    public int describeContents() {
216        return 0;
217    }
218
219    /**
220     * {@link Parcelable.Creator}
221     *
222     * @hide
223     */
224    public static final Parcelable.Creator<SignalStrength> CREATOR = new Parcelable.Creator() {
225        public SignalStrength createFromParcel(Parcel in) {
226            return new SignalStrength(in);
227        }
228
229        public SignalStrength[] newArray(int size) {
230            return new SignalStrength[size];
231        }
232    };
233
234    /**
235     * Get the GSM Signal Strength, valid values are (0-31, 99) as defined in TS 27.007 8.5
236     */
237    public int getGsmSignalStrength() {
238        return this.mGsmSignalStrength;
239    }
240
241    /**
242     * Get the GSM bit error rate (0-7, 99) as defined in TS 27.007 8.5
243     */
244    public int getGsmBitErrorRate() {
245        return this.mGsmBitErrorRate;
246    }
247
248    /**
249     * Get the CDMA RSSI value in dBm
250     */
251    public int getCdmaDbm() {
252        return this.mCdmaDbm;
253    }
254
255    /**
256     * Get the CDMA Ec/Io value in dB*10
257     */
258    public int getCdmaEcio() {
259        return this.mCdmaEcio;
260    }
261
262    /**
263     * Get the EVDO RSSI value in dBm
264     */
265    public int getEvdoDbm() {
266        return this.mEvdoDbm;
267    }
268
269    /**
270     * Get the EVDO Ec/Io value in dB*10
271     */
272    public int getEvdoEcio() {
273        return this.mEvdoEcio;
274    }
275
276    /**
277     * Get the signal to noise ratio. Valid values are 0-8. 8 is the highest.
278     */
279    public int getEvdoSnr() {
280        return this.mEvdoSnr;
281    }
282
283    /**
284     * Get signal level as an int from 0..4
285     *
286     * @hide
287     */
288    public int getLevel() {
289        int level;
290
291        if (isGsm) {
292            if ((mLteSignalStrength == -1)
293                    && (mLteRsrp == -1)
294                    && (mLteRsrq == -1)
295                    && (mLteRssnr == -1)
296                    && (mLteCqi == -1)) {
297                level = getGsmLevel();
298            } else {
299                level = getLteLevel();
300            }
301        } else {
302            int cdmaLevel = getCdmaLevel();
303            int evdoLevel = getEvdoLevel();
304            if (evdoLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
305                /* We don't know evdo, use cdma */
306                level = getCdmaLevel();
307            } else if (cdmaLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
308                /* We don't know cdma, use evdo */
309                level = getEvdoLevel();
310            } else {
311                /* We know both, use the lowest level */
312                level = cdmaLevel < evdoLevel ? cdmaLevel : evdoLevel;
313            }
314        }
315        if (DBG) log("getLevel=" + level);
316        return level;
317    }
318
319    /**
320     * Get the signal level as an asu value between 0..31, 99 is unknown
321     *
322     * @hide
323     */
324    public int getAsuLevel() {
325        int asuLevel;
326        if (isGsm) {
327            if ((mLteSignalStrength == -1)
328                    && (mLteRsrp == -1)
329                    && (mLteRsrq == -1)
330                    && (mLteRssnr == -1)
331                    && (mLteCqi == -1)) {
332                asuLevel = getGsmAsuLevel();
333            } else {
334                asuLevel = getLteAsuLevel();
335            }
336        } else {
337            int cdmaAsuLevel = getCdmaAsuLevel();
338            int evdoAsuLevel = getEvdoAsuLevel();
339            if (evdoAsuLevel == 0) {
340                /* We don't know evdo use, cdma */
341                asuLevel = cdmaAsuLevel;
342            } else if (cdmaAsuLevel == 0) {
343                /* We don't know cdma use, evdo */
344                asuLevel = evdoAsuLevel;
345            } else {
346                /* We know both, use the lowest level */
347                asuLevel = cdmaAsuLevel < evdoAsuLevel ? cdmaAsuLevel : evdoAsuLevel;
348            }
349        }
350        if (DBG) log("getAsuLevel=" + asuLevel);
351        return asuLevel;
352    }
353
354    /**
355     * Get the signal strength as dBm
356     *
357     * @hide
358     */
359    public int getDbm() {
360        int dBm;
361
362        if(isGsm()) {
363            if ((mLteSignalStrength == -1)
364                    && (mLteRsrp == -1)
365                    && (mLteRsrq == -1)
366                    && (mLteRssnr == -1)
367                    && (mLteCqi == -1)) {
368                dBm = getGsmDbm();
369            } else {
370                dBm = getLteDbm();
371            }
372        } else {
373            dBm = getCdmaDbm();
374        }
375        if (DBG) log("getDbm=" + dBm);
376        return dBm;
377    }
378
379    /**
380     * Get Gsm signal strength as dBm
381     *
382     * @hide
383     */
384    public int getGsmDbm() {
385        int dBm;
386
387        int gsmSignalStrength = getGsmSignalStrength();
388        int asu = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength);
389        if (asu != -1) {
390            dBm = -113 + (2 * asu);
391        } else {
392            dBm = -1;
393        }
394        if (DBG) log("getGsmDbm=" + dBm);
395        return dBm;
396    }
397
398    /**
399     * Get gsm as level 0..4
400     *
401     * @hide
402     */
403    public int getGsmLevel() {
404        int level;
405
406        // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
407        // asu = 0 (-113dB or less) is very weak
408        // signal, its better to show 0 bars to the user in such cases.
409        // asu = 99 is a special case, where the signal strength is unknown.
410        int asu = getGsmSignalStrength();
411        if (asu <= 2 || asu == 99) level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
412        else if (asu >= 12) level = SIGNAL_STRENGTH_GREAT;
413        else if (asu >= 8)  level = SIGNAL_STRENGTH_GOOD;
414        else if (asu >= 5)  level = SIGNAL_STRENGTH_MODERATE;
415        else level = SIGNAL_STRENGTH_POOR;
416        if (DBG) log("getGsmLevel=" + level);
417        return level;
418    }
419
420    /**
421     * Get the gsm signal level as an asu value between 0..31, 99 is unknown
422     *
423     * @hide
424     */
425    public int getGsmAsuLevel() {
426        // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
427        // asu = 0 (-113dB or less) is very weak
428        // signal, its better to show 0 bars to the user in such cases.
429        // asu = 99 is a special case, where the signal strength is unknown.
430        int level = getGsmSignalStrength();
431        if (DBG) log("getGsmAsuLevel=" + level);
432        return level;
433    }
434
435    /**
436     * Get cdma as level 0..4
437     *
438     * @hide
439     */
440    public int getCdmaLevel() {
441        final int cdmaDbm = getCdmaDbm();
442        final int cdmaEcio = getCdmaEcio();
443        int levelDbm;
444        int levelEcio;
445
446        if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT;
447        else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD;
448        else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE;
449        else if (cdmaDbm >= -100) levelDbm = SIGNAL_STRENGTH_POOR;
450        else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
451
452        // Ec/Io are in dB*10
453        if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT;
454        else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD;
455        else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE;
456        else if (cdmaEcio >= -150) levelEcio = SIGNAL_STRENGTH_POOR;
457        else levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
458
459        int level = (levelDbm < levelEcio) ? levelDbm : levelEcio;
460        if (DBG) log("getCdmaLevel=" + level);
461        return level;
462    }
463
464    /**
465     * Get the cdma signal level as an asu value between 0..31, 99 is unknown
466     *
467     * @hide
468     */
469    public int getCdmaAsuLevel() {
470        final int cdmaDbm = getCdmaDbm();
471        final int cdmaEcio = getCdmaEcio();
472        int cdmaAsuLevel;
473        int ecioAsuLevel;
474
475        if (cdmaDbm >= -75) cdmaAsuLevel = 16;
476        else if (cdmaDbm >= -82) cdmaAsuLevel = 8;
477        else if (cdmaDbm >= -90) cdmaAsuLevel = 4;
478        else if (cdmaDbm >= -95) cdmaAsuLevel = 2;
479        else if (cdmaDbm >= -100) cdmaAsuLevel = 1;
480        else cdmaAsuLevel = 99;
481
482        // Ec/Io are in dB*10
483        if (cdmaEcio >= -90) ecioAsuLevel = 16;
484        else if (cdmaEcio >= -100) ecioAsuLevel = 8;
485        else if (cdmaEcio >= -115) ecioAsuLevel = 4;
486        else if (cdmaEcio >= -130) ecioAsuLevel = 2;
487        else if (cdmaEcio >= -150) ecioAsuLevel = 1;
488        else ecioAsuLevel = 99;
489
490        int level = (cdmaAsuLevel < ecioAsuLevel) ? cdmaAsuLevel : ecioAsuLevel;
491        if (DBG) log("getCdmaAsuLevel=" + level);
492        return level;
493    }
494
495    /**
496     * Get Evdo as level 0..4
497     *
498     * @hide
499     */
500    public int getEvdoLevel() {
501        int evdoDbm = getEvdoDbm();
502        int evdoSnr = getEvdoSnr();
503        int levelEvdoDbm;
504        int levelEvdoSnr;
505
506        if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT;
507        else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD;
508        else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE;
509        else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR;
510        else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
511
512        if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT;
513        else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD;
514        else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE;
515        else if (evdoSnr >= 1) levelEvdoSnr = SIGNAL_STRENGTH_POOR;
516        else levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
517
518        int level = (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
519        if (DBG) log("getEvdoLevel=" + level);
520        return level;
521    }
522
523    /**
524     * Get the evdo signal level as an asu value between 0..31, 99 is unknown
525     *
526     * @hide
527     */
528    public int getEvdoAsuLevel() {
529        int evdoDbm = getEvdoDbm();
530        int evdoSnr = getEvdoSnr();
531        int levelEvdoDbm;
532        int levelEvdoSnr;
533
534        if (evdoDbm >= -65) levelEvdoDbm = 16;
535        else if (evdoDbm >= -75) levelEvdoDbm = 8;
536        else if (evdoDbm >= -85) levelEvdoDbm = 4;
537        else if (evdoDbm >= -95) levelEvdoDbm = 2;
538        else if (evdoDbm >= -105) levelEvdoDbm = 1;
539        else levelEvdoDbm = 99;
540
541        if (evdoSnr >= 7) levelEvdoSnr = 16;
542        else if (evdoSnr >= 6) levelEvdoSnr = 8;
543        else if (evdoSnr >= 5) levelEvdoSnr = 4;
544        else if (evdoSnr >= 3) levelEvdoSnr = 2;
545        else if (evdoSnr >= 1) levelEvdoSnr = 1;
546        else levelEvdoSnr = 99;
547
548        int level = (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
549        if (DBG) log("getEvdoAsuLevel=" + level);
550        return level;
551    }
552
553    /**
554     * Get LTE as dBm
555     *
556     * @hide
557     */
558    public int getLteDbm() {
559        return mLteRsrp;
560    }
561
562    /**
563     * Get LTE as level 0..4
564     *
565     * @hide
566     */
567    public int getLteLevel() {
568        int levelLteRsrp = 0;
569
570        if (mLteRsrp == -1) levelLteRsrp = 0;
571        else if (mLteRsrp >= -85) levelLteRsrp = SIGNAL_STRENGTH_GREAT;
572        else if (mLteRsrp >= -95) levelLteRsrp = SIGNAL_STRENGTH_GOOD;
573        else if (mLteRsrp >= -105) levelLteRsrp = SIGNAL_STRENGTH_MODERATE;
574        else if (mLteRsrp >= -115) levelLteRsrp = SIGNAL_STRENGTH_POOR;
575        else levelLteRsrp = 0;
576
577        if (DBG) log("Lte level: "+levelLteRsrp);
578        return levelLteRsrp;
579    }
580
581    /**
582     * Get the LTE signal level as an asu value between 0..97, 99 is unknown
583     * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
584     *
585     * @hide
586     */
587    public int getLteAsuLevel() {
588        int lteAsuLevel = 99;
589        int lteDbm = getLteDbm();
590        if (lteDbm <= -140) lteAsuLevel = 0;
591        else if (lteDbm >= -43) lteAsuLevel = 97;
592        else lteAsuLevel = lteDbm + 140;
593        if (DBG) log("Lte Asu level: "+lteAsuLevel);
594        return lteAsuLevel;
595    }
596
597    /**
598     * @return true if this is for GSM
599     */
600    public boolean isGsm() {
601        return this.isGsm;
602    }
603
604    /**
605     * @return hash code
606     */
607    @Override
608    public int hashCode() {
609        int primeNum = 31;
610        return ((mGsmSignalStrength * primeNum)
611                + (mGsmBitErrorRate * primeNum)
612                + (mCdmaDbm * primeNum) + (mCdmaEcio * primeNum)
613                + (mEvdoDbm * primeNum) + (mEvdoEcio * primeNum) + (mEvdoSnr * primeNum)
614                + (mLteSignalStrength * primeNum) + (mLteRsrp * primeNum)
615                + (mLteRsrq * primeNum) + (mLteRssnr * primeNum) + (mLteCqi * primeNum)
616                + (isGsm ? 1 : 0));
617    }
618
619    /**
620     * @return true if the signal strengths are the same
621     */
622    @Override
623    public boolean equals (Object o) {
624        SignalStrength s;
625
626        try {
627            s = (SignalStrength) o;
628        } catch (ClassCastException ex) {
629            return false;
630        }
631
632        if (o == null) {
633            return false;
634        }
635
636        return (mGsmSignalStrength == s.mGsmSignalStrength
637                && mGsmBitErrorRate == s.mGsmBitErrorRate
638                && mCdmaDbm == s.mCdmaDbm
639                && mCdmaEcio == s.mCdmaEcio
640                && mEvdoDbm == s.mEvdoDbm
641                && mEvdoEcio == s.mEvdoEcio
642                && mEvdoSnr == s.mEvdoSnr
643                && mLteSignalStrength == s.mLteSignalStrength
644                && mLteRsrp == s.mLteRsrp
645                && mLteRsrq == s.mLteRsrq
646                && mLteRssnr == s.mLteRssnr
647                && mLteCqi == s.mLteCqi
648                && isGsm == s.isGsm);
649    }
650
651    /**
652     * @return string representation.
653     */
654    @Override
655    public String toString() {
656        return ("SignalStrength:"
657                + " " + mGsmSignalStrength
658                + " " + mGsmBitErrorRate
659                + " " + mCdmaDbm
660                + " " + mCdmaEcio
661                + " " + mEvdoDbm
662                + " " + mEvdoEcio
663                + " " + mEvdoSnr
664                + " " + mLteSignalStrength
665                + " " + mLteRsrp
666                + " " + mLteRsrq
667                + " " + mLteRssnr
668                + " " + mLteCqi
669                + " " + (isGsm ? "gsm|lte" : "cdma"));
670    }
671
672    /**
673     * Set SignalStrength based on intent notifier map
674     *
675     * @param m intent notifier map
676     * @hide
677     */
678    private void setFromNotifierBundle(Bundle m) {
679        mGsmSignalStrength = m.getInt("GsmSignalStrength");
680        mGsmBitErrorRate = m.getInt("GsmBitErrorRate");
681        mCdmaDbm = m.getInt("CdmaDbm");
682        mCdmaEcio = m.getInt("CdmaEcio");
683        mEvdoDbm = m.getInt("EvdoDbm");
684        mEvdoEcio = m.getInt("EvdoEcio");
685        mEvdoSnr = m.getInt("EvdoSnr");
686        mLteSignalStrength = m.getInt("LteSignalStrength");
687        mLteRsrp = m.getInt("LteRsrp");
688        mLteRsrq = m.getInt("LteRsrq");
689        mLteRssnr = m.getInt("LteRssnr");
690        mLteCqi = m.getInt("LteCqi");
691        isGsm = m.getBoolean("isGsm");
692    }
693
694    /**
695     * Set intent notifier Bundle based on SignalStrength
696     *
697     * @param m intent notifier Bundle
698     * @hide
699     */
700    public void fillInNotifierBundle(Bundle m) {
701        m.putInt("GsmSignalStrength", mGsmSignalStrength);
702        m.putInt("GsmBitErrorRate", mGsmBitErrorRate);
703        m.putInt("CdmaDbm", mCdmaDbm);
704        m.putInt("CdmaEcio", mCdmaEcio);
705        m.putInt("EvdoDbm", mEvdoDbm);
706        m.putInt("EvdoEcio", mEvdoEcio);
707        m.putInt("EvdoSnr", mEvdoSnr);
708        m.putInt("LteSignalStrength", mLteSignalStrength);
709        m.putInt("LteRsrp", mLteRsrp);
710        m.putInt("LteRsrq", mLteRsrq);
711        m.putInt("LteRssnr", mLteRssnr);
712        m.putInt("LteCqi", mLteCqi);
713        m.putBoolean("isGsm", Boolean.valueOf(isGsm));
714    }
715
716    /**
717     * log
718     */
719    private static void log(String s) {
720        Log.w(LOG_TAG, s);
721    }
722}
723