Telephony: Fix call forward info logging.
Gao Rong [Wed, 19 Jun 2013 02:01:05 +0000 (10:01 +0800)]
Currently, QUERY_CALL_FORWARD_STATUS would use array to store call info
response, from BP side. So RILJ would just show the array hash code
instead of each field in the array, it would like this:
< QUERY_CALL_FORWARD_STATUS [Lcom.android.internal.telephony.CallForwardInfo;@41573f30]

This code change would parse the array field one-by-one, and show
each field in RILJ, like this:
< QUERY_CALL_FORWARD_STATUS { [not active reason:0 serviceClass:255 'null' 0seconds] }

This is very helpful for developer tracking call forward related issues.

Change-Id: I5485578c70f5344c75294d56583896a2d87d5d29

src/java/com/android/internal/telephony/RIL.java

index 9fe9d7c..e610079 100644 (file)
@@ -2676,18 +2676,28 @@ public final class RIL extends BaseCommands implements CommandsInterface {
             s = sb.toString();
         }else if (req == RIL_REQUEST_GET_CURRENT_CALLS) {
             ArrayList<DriverCall> calls = (ArrayList<DriverCall>) ret;
-            sb = new StringBuilder(" ");
+            sb = new StringBuilder("{");
             for (DriverCall dc : calls) {
                 sb.append("[").append(dc).append("] ");
             }
+            sb.append("}");
             s = sb.toString();
         } else if (req == RIL_REQUEST_GET_NEIGHBORING_CELL_IDS) {
-            ArrayList<NeighboringCellInfo> cells;
-            cells = (ArrayList<NeighboringCellInfo>) ret;
-            sb = new StringBuilder(" ");
+            ArrayList<NeighboringCellInfo> cells = (ArrayList<NeighboringCellInfo>) ret;
+            sb = new StringBuilder("{");
             for (NeighboringCellInfo cell : cells) {
-                sb.append(cell).append(" ");
+                sb.append("[").append(cell).append("] ");
             }
+            sb.append("}");
+            s = sb.toString();
+        } else if (req == RIL_REQUEST_QUERY_CALL_FORWARD_STATUS) {
+            CallForwardInfo[] cinfo = (CallForwardInfo[]) ret;
+            length = cinfo.length;
+            sb = new StringBuilder("{");
+            for(int i = 0; i < length; i++) {
+                sb.append("[").append(cinfo[i]).append("] ");
+            }
+            sb.append("}");
             s = sb.toString();
         } else if (req == RIL_REQUEST_GET_HARDWARE_CONFIG) {
             ArrayList<HardwareConfig> hwcfgs = (ArrayList<HardwareConfig>) ret;