The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.telephony; |
| 18 | |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 19 | import static android.telephony.TelephonyManager.NETWORK_TYPE_EDGE; |
| 20 | import static android.telephony.TelephonyManager.NETWORK_TYPE_GPRS; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 21 | import static android.telephony.TelephonyManager.NETWORK_TYPE_HSDPA; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 22 | import static android.telephony.TelephonyManager.NETWORK_TYPE_HSPA; |
Nathan Harold | 45fb105 | 2017-12-04 09:55:56 -0800 | [diff] [blame] | 23 | import static android.telephony.TelephonyManager.NETWORK_TYPE_HSUPA; |
| 24 | import static android.telephony.TelephonyManager.NETWORK_TYPE_UMTS; |
| 25 | import static android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 26 | |
Artur Satayev | 74cb719 | 2019-12-10 17:47:56 +0000 | [diff] [blame] | 27 | import android.compat.annotation.UnsupportedAppUsage; |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 28 | import android.os.Build; |
Nathan Harold | 45fb105 | 2017-12-04 09:55:56 -0800 | [diff] [blame] | 29 | import android.os.Parcel; |
| 30 | import android.os.Parcelable; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 31 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | |
| 33 | /** |
Wink Saville | 2563a3a | 2009-06-09 10:30:03 -0700 | [diff] [blame] | 34 | * Represents the neighboring cell information, including |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | * Received Signal Strength and Cell ID location. |
Nathan Harold | 493223b | 2018-08-09 17:10:42 -0700 | [diff] [blame] | 36 | * |
Nathan Harold | 3d850a7 | 2018-10-02 15:55:36 -0700 | [diff] [blame] | 37 | * @deprecated This class should not be used by any app targeting |
Tor Norbye | f8dc2d2 | 2018-10-03 09:28:21 +0200 | [diff] [blame] | 38 | * {@link android.os.Build.VERSION_CODES#Q Android Q} or higher. Instead callers should use |
| 39 | * {@link android.telephony.CellInfo CellInfo}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | */ |
Nathan Harold | 493223b | 2018-08-09 17:10:42 -0700 | [diff] [blame] | 41 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | public class NeighboringCellInfo implements Parcelable |
| 43 | { |
| 44 | /** |
| 45 | * Signal strength is not available |
| 46 | */ |
| 47 | static final public int UNKNOWN_RSSI = 99; |
| 48 | /** |
| 49 | * Cell location is not available |
| 50 | */ |
| 51 | static final public int UNKNOWN_CID = -1; |
| 52 | |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 53 | /** |
| 54 | * In GSM, mRssi is the Received RSSI; |
| 55 | * In UMTS, mRssi is the Level index of CPICH Received Signal Code Power |
| 56 | */ |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 57 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | private int mRssi; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 59 | /** |
| 60 | * CID in 16 bits format in GSM. Return UNKNOWN_CID in UMTS and CMDA. |
| 61 | */ |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 62 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | private int mCid; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 64 | /** |
| 65 | * LAC in 16 bits format in GSM. Return UNKNOWN_CID in UMTS and CMDA. |
| 66 | */ |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 67 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 68 | private int mLac; |
| 69 | /** |
| 70 | * Primary Scrambling Code in 9 bits format in UMTS |
| 71 | * Return UNKNOWN_CID in GSM and CMDA. |
| 72 | */ |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 73 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 74 | private int mPsc; |
| 75 | /** |
| 76 | * Radio network type, value is one of following |
| 77 | * TelephonyManager.NETWORK_TYPE_XXXXXX. |
| 78 | */ |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 79 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 80 | private int mNetworkType; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * Empty constructor. Initializes the RSSI and CID. |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 84 | * |
| 85 | * NeighboringCellInfo is one time shot for the neighboring cells based on |
| 86 | * the radio network type at that moment. Its constructor needs radio network |
| 87 | * type. |
Wink Saville | cc6ff2b | 2009-12-02 09:46:38 -0800 | [diff] [blame] | 88 | * |
| 89 | * @deprecated by {@link #NeighboringCellInfo(int, String, int)} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | */ |
Dianne Hackborn | 29e4a3c | 2009-09-30 22:35:40 -0700 | [diff] [blame] | 91 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 92 | public NeighboringCellInfo() { |
| 93 | mRssi = UNKNOWN_RSSI; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 94 | mLac = UNKNOWN_CID; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | mCid = UNKNOWN_CID; |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 96 | mPsc = UNKNOWN_CID; |
| 97 | mNetworkType = NETWORK_TYPE_UNKNOWN; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Initialize the object from rssi and cid. |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 102 | * |
| 103 | * NeighboringCellInfo is one time shot for the neighboring cells based on |
| 104 | * the radio network type at that moment. Its constructor needs radio network |
| 105 | * type. |
Wink Saville | cc6ff2b | 2009-12-02 09:46:38 -0800 | [diff] [blame] | 106 | * |
| 107 | * @deprecated by {@link #NeighboringCellInfo(int, String, int)} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 108 | */ |
Dianne Hackborn | 29e4a3c | 2009-09-30 22:35:40 -0700 | [diff] [blame] | 109 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | public NeighboringCellInfo(int rssi, int cid) { |
| 111 | mRssi = rssi; |
| 112 | mCid = cid; |
| 113 | } |
Wink Saville | 2563a3a | 2009-06-09 10:30:03 -0700 | [diff] [blame] | 114 | |
Nathan Harold | 45fb105 | 2017-12-04 09:55:56 -0800 | [diff] [blame] | 115 | /** @hide */ |
| 116 | public NeighboringCellInfo(final CellInfoGsm info) { |
| 117 | mNetworkType = TelephonyManager.NETWORK_TYPE_GPRS; |
| 118 | |
| 119 | mRssi = info.getCellSignalStrength().getAsuLevel(); |
| 120 | if (mRssi == Integer.MAX_VALUE) mRssi = UNKNOWN_RSSI; |
| 121 | |
| 122 | mLac = info.getCellIdentity().getLac(); |
| 123 | if (mLac == Integer.MAX_VALUE) mLac = UNKNOWN_CID; |
| 124 | |
| 125 | mCid = info.getCellIdentity().getCid(); |
| 126 | if (mCid == Integer.MAX_VALUE) mCid = UNKNOWN_CID; |
| 127 | |
| 128 | mPsc = UNKNOWN_CID; |
| 129 | } |
| 130 | |
| 131 | /** @hide */ |
| 132 | public NeighboringCellInfo(final CellInfoWcdma info) { |
| 133 | mNetworkType = TelephonyManager.NETWORK_TYPE_UMTS; |
| 134 | |
| 135 | mRssi = info.getCellSignalStrength().getAsuLevel(); |
| 136 | if (mRssi == Integer.MAX_VALUE) mRssi = UNKNOWN_RSSI; |
| 137 | |
| 138 | mLac = info.getCellIdentity().getLac(); |
| 139 | if (mLac == Integer.MAX_VALUE) mLac = UNKNOWN_CID; |
| 140 | |
| 141 | mCid = info.getCellIdentity().getCid(); |
| 142 | if (mCid == Integer.MAX_VALUE) mCid = UNKNOWN_CID; |
| 143 | |
| 144 | mPsc = info.getCellIdentity().getPsc(); |
| 145 | if (mPsc == Integer.MAX_VALUE) mPsc = UNKNOWN_CID; |
| 146 | } |
| 147 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 148 | /** |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 149 | * Initialize the object from rssi, location string, and radioType |
| 150 | * radioType is one of following |
| 151 | * {@link TelephonyManager#NETWORK_TYPE_GPRS TelephonyManager.NETWORK_TYPE_GPRS}, |
| 152 | * {@link TelephonyManager#NETWORK_TYPE_EDGE TelephonyManager.NETWORK_TYPE_EDGE}, |
| 153 | * {@link TelephonyManager#NETWORK_TYPE_UMTS TelephonyManager.NETWORK_TYPE_UMTS}, |
| 154 | * {@link TelephonyManager#NETWORK_TYPE_HSDPA TelephonyManager.NETWORK_TYPE_HSDPA}, |
| 155 | * {@link TelephonyManager#NETWORK_TYPE_HSUPA TelephonyManager.NETWORK_TYPE_HSUPA}, |
| 156 | * and {@link TelephonyManager#NETWORK_TYPE_HSPA TelephonyManager.NETWORK_TYPE_HSPA}. |
| 157 | */ |
| 158 | public NeighboringCellInfo(int rssi, String location, int radioType) { |
| 159 | // set default value |
| 160 | mRssi = rssi; |
| 161 | mNetworkType = NETWORK_TYPE_UNKNOWN; |
| 162 | mPsc = UNKNOWN_CID; |
| 163 | mLac = UNKNOWN_CID; |
| 164 | mCid = UNKNOWN_CID; |
| 165 | |
| 166 | |
| 167 | // pad location string with leading "0" |
| 168 | int l = location.length(); |
| 169 | if (l > 8) return; |
| 170 | if (l < 8) { |
| 171 | for (int i = 0; i < (8-l); i++) { |
| 172 | location = "0" + location; |
| 173 | } |
| 174 | } |
Robert Greenwalt | 962a990 | 2010-11-02 11:10:25 -0700 | [diff] [blame] | 175 | // TODO - handle LTE and eHRPD (or find they can't be supported) |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 176 | try {// set LAC/CID or PSC based on radioType |
| 177 | switch (radioType) { |
| 178 | case NETWORK_TYPE_GPRS: |
| 179 | case NETWORK_TYPE_EDGE: |
| 180 | mNetworkType = radioType; |
Naveen Kalla | c6dd77d | 2010-04-07 17:54:33 -0700 | [diff] [blame] | 181 | // check if 0xFFFFFFFF for UNKNOWN_CID |
| 182 | if (!location.equalsIgnoreCase("FFFFFFFF")) { |
Narayan Kamath | a09b4d2 | 2016-04-15 18:32:45 +0100 | [diff] [blame] | 183 | mCid = Integer.parseInt(location.substring(4), 16); |
| 184 | mLac = Integer.parseInt(location.substring(0, 4), 16); |
Naveen Kalla | c6dd77d | 2010-04-07 17:54:33 -0700 | [diff] [blame] | 185 | } |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 186 | break; |
| 187 | case NETWORK_TYPE_UMTS: |
| 188 | case NETWORK_TYPE_HSDPA: |
| 189 | case NETWORK_TYPE_HSUPA: |
| 190 | case NETWORK_TYPE_HSPA: |
| 191 | mNetworkType = radioType; |
Narayan Kamath | a09b4d2 | 2016-04-15 18:32:45 +0100 | [diff] [blame] | 192 | mPsc = Integer.parseInt(location, 16); |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 193 | break; |
| 194 | } |
| 195 | } catch (NumberFormatException e) { |
| 196 | // parsing location error |
| 197 | mPsc = UNKNOWN_CID; |
| 198 | mLac = UNKNOWN_CID; |
| 199 | mCid = UNKNOWN_CID; |
| 200 | mNetworkType = NETWORK_TYPE_UNKNOWN; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 205 | * Initialize the object from a parcel. |
| 206 | */ |
| 207 | public NeighboringCellInfo(Parcel in) { |
| 208 | mRssi = in.readInt(); |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 209 | mLac = in.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 210 | mCid = in.readInt(); |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 211 | mPsc = in.readInt(); |
| 212 | mNetworkType = in.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 213 | } |
Wink Saville | 2563a3a | 2009-06-09 10:30:03 -0700 | [diff] [blame] | 214 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 215 | /** |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 216 | * @return received signal strength or UNKNOWN_RSSI if unknown |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 217 | * |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 218 | * For GSM, it is in "asu" ranging from 0 to 31 (dBm = -113 + 2*asu) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 219 | * 0 means "-113 dBm or less" and 31 means "-51 dBm or greater" |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 220 | * For UMTS, it is the Level index of CPICH RSCP defined in TS 25.125 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | */ |
| 222 | public int getRssi() { |
| 223 | return mRssi; |
| 224 | } |
| 225 | |
| 226 | /** |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 227 | * @return LAC in GSM, 0xffff max legal value |
| 228 | * UNKNOWN_CID if in UMTS or CMDA or unknown |
| 229 | */ |
| 230 | public int getLac() { |
| 231 | return mLac; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * @return cell id in GSM, 0xffff max legal value |
| 236 | * UNKNOWN_CID if in UMTS or CDMA or unknown |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 237 | */ |
| 238 | public int getCid() { |
| 239 | return mCid; |
| 240 | } |
| 241 | |
| 242 | /** |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 243 | * @return Primary Scrambling Code in 9 bits format in UMTS, 0x1ff max value |
| 244 | * UNKNOWN_CID if in GSM or CMDA or unknown |
| 245 | */ |
| 246 | public int getPsc() { |
| 247 | return mPsc; |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * @return Radio network type while neighboring cell location is stored. |
| 252 | * |
| 253 | * Return {@link TelephonyManager#NETWORK_TYPE_UNKNOWN TelephonyManager.NETWORK_TYPE_UNKNOWN} |
| 254 | * means that the location information is unavailable. |
| 255 | * |
| 256 | * Return {@link TelephonyManager#NETWORK_TYPE_GPRS TelephonyManager.NETWORK_TYPE_GPRS} or |
| 257 | * {@link TelephonyManager#NETWORK_TYPE_EDGE TelephonyManager.NETWORK_TYPE_EDGE} |
| 258 | * means that Neighboring Cell information is stored for GSM network, in |
| 259 | * which {@link NeighboringCellInfo#getLac NeighboringCellInfo.getLac} and |
| 260 | * {@link NeighboringCellInfo#getCid NeighboringCellInfo.getCid} should be |
| 261 | * called to access location. |
| 262 | * |
| 263 | * Return {@link TelephonyManager#NETWORK_TYPE_UMTS TelephonyManager.NETWORK_TYPE_UMTS}, |
| 264 | * {@link TelephonyManager#NETWORK_TYPE_HSDPA TelephonyManager.NETWORK_TYPE_HSDPA}, |
| 265 | * {@link TelephonyManager#NETWORK_TYPE_HSUPA TelephonyManager.NETWORK_TYPE_HSUPA}, |
| 266 | * or {@link TelephonyManager#NETWORK_TYPE_HSPA TelephonyManager.NETWORK_TYPE_HSPA} |
| 267 | * means that Neighboring Cell information is stored for UMTS network, in |
| 268 | * which {@link NeighboringCellInfo#getPsc NeighboringCellInfo.getPsc} |
| 269 | * should be called to access location. |
| 270 | */ |
| 271 | public int getNetworkType() { |
| 272 | return mNetworkType; |
| 273 | } |
| 274 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 275 | * Set the cell id. |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 276 | * |
| 277 | * NeighboringCellInfo is a one time shot for the neighboring cells based on |
| 278 | * the radio network type at that moment. It shouldn't be changed after |
| 279 | * creation. |
Wink Saville | cc6ff2b | 2009-12-02 09:46:38 -0800 | [diff] [blame] | 280 | * |
| 281 | * @deprecated cid value passed as in location parameter passed to constructor |
| 282 | * {@link #NeighboringCellInfo(int, String, int)} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 283 | */ |
Dianne Hackborn | 29e4a3c | 2009-09-30 22:35:40 -0700 | [diff] [blame] | 284 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 285 | public void setCid(int cid) { |
| 286 | mCid = cid; |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Set the signal strength of the cell. |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 291 | * |
| 292 | * NeighboringCellInfo is a one time shot for the neighboring cells based on |
| 293 | * the radio network type at that moment. It shouldn't be changed after |
| 294 | * creation. |
Wink Saville | cc6ff2b | 2009-12-02 09:46:38 -0800 | [diff] [blame] | 295 | * |
| 296 | * @deprecated initial rssi value passed as parameter to constructor |
| 297 | * {@link #NeighboringCellInfo(int, String, int)} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 298 | */ |
Dianne Hackborn | 29e4a3c | 2009-09-30 22:35:40 -0700 | [diff] [blame] | 299 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 300 | public void setRssi(int rssi) { |
| 301 | mRssi = rssi; |
| 302 | } |
| 303 | |
| 304 | @Override |
| 305 | public String toString() { |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 306 | StringBuilder sb = new StringBuilder(); |
| 307 | |
| 308 | sb.append("["); |
| 309 | if (mPsc != UNKNOWN_CID) { |
| 310 | sb.append(Integer.toHexString(mPsc)) |
| 311 | .append("@").append(((mRssi == UNKNOWN_RSSI)? "-" : mRssi)); |
| 312 | } else if(mLac != UNKNOWN_CID && mCid != UNKNOWN_CID) { |
| 313 | sb.append(Integer.toHexString(mLac)) |
| 314 | .append(Integer.toHexString(mCid)) |
| 315 | .append("@").append(((mRssi == UNKNOWN_RSSI)? "-" : mRssi)); |
| 316 | } |
| 317 | sb.append("]"); |
| 318 | |
| 319 | return sb.toString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | public int describeContents() { |
| 323 | return 0; |
| 324 | } |
| 325 | |
| 326 | public void writeToParcel(Parcel dest, int flags) { |
| 327 | dest.writeInt(mRssi); |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 328 | dest.writeInt(mLac); |
Wink Saville | 2563a3a | 2009-06-09 10:30:03 -0700 | [diff] [blame] | 329 | dest.writeInt(mCid); |
johnwang | 9c118c8 | 2009-09-11 19:17:29 -0700 | [diff] [blame] | 330 | dest.writeInt(mPsc); |
| 331 | dest.writeInt(mNetworkType); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 332 | } |
| 333 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 334 | public static final @android.annotation.NonNull Parcelable.Creator<NeighboringCellInfo> CREATOR |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 335 | = new Parcelable.Creator<NeighboringCellInfo>() { |
| 336 | public NeighboringCellInfo createFromParcel(Parcel in) { |
| 337 | return new NeighboringCellInfo(in); |
| 338 | } |
| 339 | |
| 340 | public NeighboringCellInfo[] newArray(int size) { |
| 341 | return new NeighboringCellInfo[size]; |
| 342 | } |
| 343 | }; |
Naveen Kalla | c6dd77d | 2010-04-07 17:54:33 -0700 | [diff] [blame] | 344 | } |