OSDN Git Service

remove the AT command separator from the CPBR range parameters
authorzzy <zhenye@broadcom.com>
Thu, 4 Oct 2012 04:20:58 +0000 (21:20 -0700)
committerMatthew Xie <mattx@google.com>
Thu, 4 Oct 2012 05:53:21 +0000 (22:53 -0700)
Root cause: Integer.parseInt(indices[0]) throw exception if char ';' at the end.

Bug 7274805

src/com/android/bluetooth/hfp/AtPhonebook.java

index 3f499ba..d133706 100755 (executable)
@@ -316,7 +316,8 @@ public class AtPhonebook {
                 String atCommand = (atString.split("="))[1];
                 String[] indices = atCommand.split(",");
                 for(int i = 0; i < indices.length; i++)
-                    indices[i] = indices[i].trim();
+                    //replace AT command separator ';' from the index if any
+                    indices[i] = indices[i].replace(';', ' ').trim();
                 try {
                     index1 = Integer.parseInt(indices[0]);
                     if (indices.length == 1)
@@ -325,7 +326,7 @@ public class AtPhonebook {
                         index2 = Integer.parseInt(indices[1]);
                 }
                 catch (Exception e) {
-                    log("handleCpbrCommand - exception - invalid chars");
+                    log("handleCpbrCommand - exception - invalid chars: " + e.toString());
                     atCommandErrorCode = BluetoothCmeError.TEXT_HAS_INVALID_CHARS;
                     mStateMachine.atResponseCodeNative(atCommandResult, atCommandErrorCode);
                     break;