SignalStrength.java revision 2c911b24163c9bcb50bc548c828b7fc2f6ef8bce
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 >= -95) levelLteRsrp = SIGNAL_STRENGTH_GREAT;
572        else if (mLteRsrp >= -105) levelLteRsrp = SIGNAL_STRENGTH_GOOD;
573        else if (mLteRsrp >= -115) levelLteRsrp = SIGNAL_STRENGTH_MODERATE;
574        else levelLteRsrp = SIGNAL_STRENGTH_POOR;
575
576        if (DBG) log("Lte level: "+levelLteRsrp);
577        return levelLteRsrp;
578    }
579
580    /**
581     * Get the LTE signal level as an asu value between 0..97, 99 is unknown
582     * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
583     *
584     * @hide
585     */
586    public int getLteAsuLevel() {
587        int lteAsuLevel = 99;
588        int lteDbm = getLteDbm();
589        if (lteDbm <= -140) lteAsuLevel = 0;
590        else if (lteDbm >= -43) lteAsuLevel = 97;
591        else lteAsuLevel = lteDbm + 140;
592        if (DBG) log("Lte Asu level: "+lteAsuLevel);
593        return lteAsuLevel;
594    }
595
596    /**
597     * @return true if this is for GSM
598     */
599    public boolean isGsm() {
600        return this.isGsm;
601    }
602
603    /**
604     * @return hash code
605     */
606    @Override
607    public int hashCode() {
608        int primeNum = 31;
609        return ((mGsmSignalStrength * primeNum)
610                + (mGsmBitErrorRate * primeNum)
611                + (mCdmaDbm * primeNum) + (mCdmaEcio * primeNum)
612                + (mEvdoDbm * primeNum) + (mEvdoEcio * primeNum) + (mEvdoSnr * primeNum)
613                + (mLteSignalStrength * primeNum) + (mLteRsrp * primeNum)
614                + (mLteRsrq * primeNum) + (mLteRssnr * primeNum) + (mLteCqi * primeNum)
615                + (isGsm ? 1 : 0));
616    }
617
618    /**
619     * @return true if the signal strengths are the same
620     */
621    @Override
622    public boolean equals (Object o) {
623        SignalStrength s;
624
625        try {
626            s = (SignalStrength) o;
627        } catch (ClassCastException ex) {
628            return false;
629        }
630
631        if (o == null) {
632            return false;
633        }
634
635        return (mGsmSignalStrength == s.mGsmSignalStrength
636                && mGsmBitErrorRate == s.mGsmBitErrorRate
637                && mCdmaDbm == s.mCdmaDbm
638                && mCdmaEcio == s.mCdmaEcio
639                && mEvdoDbm == s.mEvdoDbm
640                && mEvdoEcio == s.mEvdoEcio
641                && mEvdoSnr == s.mEvdoSnr
642                && mLteSignalStrength == s.mLteSignalStrength
643                && mLteRsrp == s.mLteRsrp
644                && mLteRsrq == s.mLteRsrq
645                && mLteRssnr == s.mLteRssnr
646                && mLteCqi == s.mLteCqi
647                && isGsm == s.isGsm);
648    }
649
650    /**
651     * @return string representation.
652     */
653    @Override
654    public String toString() {
655        return ("SignalStrength:"
656                + " " + mGsmSignalStrength
657                + " " + mGsmBitErrorRate
658                + " " + mCdmaDbm
659                + " " + mCdmaEcio
660                + " " + mEvdoDbm
661                + " " + mEvdoEcio
662                + " " + mEvdoSnr
663                + " " + mLteSignalStrength
664                + " " + mLteRsrp
665                + " " + mLteRsrq
666                + " " + mLteRssnr
667                + " " + mLteCqi
668                + " " + (isGsm ? "gsm|lte" : "cdma"));
669    }
670
671    /**
672     * Set SignalStrength based on intent notifier map
673     *
674     * @param m intent notifier map
675     * @hide
676     */
677    private void setFromNotifierBundle(Bundle m) {
678        mGsmSignalStrength = m.getInt("GsmSignalStrength");
679        mGsmBitErrorRate = m.getInt("GsmBitErrorRate");
680        mCdmaDbm = m.getInt("CdmaDbm");
681        mCdmaEcio = m.getInt("CdmaEcio");
682        mEvdoDbm = m.getInt("EvdoDbm");
683        mEvdoEcio = m.getInt("EvdoEcio");
684        mEvdoSnr = m.getInt("EvdoSnr");
685        mLteSignalStrength = m.getInt("LteSignalStrength");
686        mLteRsrp = m.getInt("LteRsrp");
687        mLteRsrq = m.getInt("LteRsrq");
688        mLteRssnr = m.getInt("LteRssnr");
689        mLteCqi = m.getInt("LteCqi");
690        isGsm = m.getBoolean("isGsm");
691    }
692
693    /**
694     * Set intent notifier Bundle based on SignalStrength
695     *
696     * @param m intent notifier Bundle
697     * @hide
698     */
699    public void fillInNotifierBundle(Bundle m) {
700        m.putInt("GsmSignalStrength", mGsmSignalStrength);
701        m.putInt("GsmBitErrorRate", mGsmBitErrorRate);
702        m.putInt("CdmaDbm", mCdmaDbm);
703        m.putInt("CdmaEcio", mCdmaEcio);
704        m.putInt("EvdoDbm", mEvdoDbm);
705        m.putInt("EvdoEcio", mEvdoEcio);
706        m.putInt("EvdoSnr", mEvdoSnr);
707        m.putInt("LteSignalStrength", mLteSignalStrength);
708        m.putInt("LteRsrp", mLteRsrp);
709        m.putInt("LteRsrq", mLteRsrq);
710        m.putInt("LteRssnr", mLteRssnr);
711        m.putInt("LteCqi", mLteCqi);
712        m.putBoolean("isGsm", Boolean.valueOf(isGsm));
713    }
714
715    /**
716     * log
717     */
718    private static void log(String s) {
719        Log.w(LOG_TAG, s);
720    }
721}
722