Represent SID/NID in decimal format.

Interpret SID/NID ad decimal and add try/catch block to prevent crashing in wrong format. Update SID/NID comments.

	modified:   java/com/android/internal/telephony/CommandsInterface.java
	modified:   java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
This commit is contained in:
johnwang
2009-07-29 23:30:20 -07:00
parent dcfc5c2318
commit d2fb980060
2 changed files with 14 additions and 4 deletions

View File

@@ -1225,8 +1225,10 @@ public interface CommandsInterface {
* Request the device MDN / H_SID / H_NID / MIN.
* "response" is const char **
* [0] is MDN if CDMA subscription is available
* [1] is H_SID (Home SID) in hexadecimal if CDMA subscription is available
* [2] is H_NID (Home NID) in hexadecimal if CDMA subscription is available
* [1] is a comma separated list of H_SID (Home SID) in decimal format
* if CDMA subscription is available
* [2] is a comma separated list of H_NID (Home NID) in decimal format
* if CDMA subscription is available
* [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
*/
public void getCDMASubscription(Message response);

View File

@@ -401,11 +401,19 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
// TODO: Only grabbing the first SID/NID for now.
if (cdmaSubscription[1] != null) {
String[] sid = cdmaSubscription[1].split(",");
mHomeSystemId = sid.length > 0 ? Integer.parseInt(sid[0], 16) : 0;
try {
mHomeSystemId = sid.length > 0 ? Integer.parseInt(sid[0]) : 0;
} catch (NumberFormatException e) {
mHomeSystemId = 0;
}
}
if (cdmaSubscription[2] != null) {
String[] nid = cdmaSubscription[2].split(",");
mHomeNetworkId = nid.length > 0 ? Integer.parseInt(nid[0], 16) : 0;
try {
mHomeNetworkId = nid.length > 0 ? Integer.parseInt(nid[0]) : 0;
} catch (NumberFormatException e) {
mHomeNetworkId = 0;
}
}
mMin = cdmaSubscription[3];
mPrlVersion = cdmaSubscription[4];