update call state to match hf hal header, memory dial fix null pointer

Change-Id: I62f26d0259a910ac80d7a18c6bef49abb6eab820
diff --git a/src/com/android/bluetooth/hfp/HeadsetHalConstants.java b/src/com/android/bluetooth/hfp/HeadsetHalConstants.java
index dbeba2d..8ca0abd 100644
--- a/src/com/android/bluetooth/hfp/HeadsetHalConstants.java
+++ b/src/com/android/bluetooth/hfp/HeadsetHalConstants.java
@@ -44,11 +44,11 @@
     final static int AT_RESPONSE_OK = 1;
 
     // match up with bthf_call_state_t of bt_hf.h
-    final static int CALL_STATE_IDLE = 0;
-    final static int CALL_STATE_INCOMING = 1;
+    final static int CALL_STATE_ACTIVE = 0;
+    final static int CALL_STATE_HELD = 1;
     final static int CALL_STATE_DIALING = 2;
     final static int CALL_STATE_ALERTING = 3;
-    final static int CALL_STATE_WAITING = 4;
-    final static int CALL_STATE_ACTIVE = 5;
-    final static int CALL_STATE_ONHOLD = 6;
+    final static int CALL_STATE_INCOMING = 4;
+    final static int CALL_STATE_WAITING = 5;
+    final static int CALL_STATE_IDLE = 6;
 }
\ No newline at end of file
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 7032707..e6417b9 100755
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -992,7 +992,13 @@
                 atResponseCodeNative(HeadsetHalConstants.AT_RESPONSE_ERROR);
                 return;
             }
+            if (DBG) log("processDialCall, memory dial do last dial for now");
             dialNumber = mPhonebook.getLastDialledNumber();
+            if (dialNumber == null) {
+                if (DBG) log("processDialCall, last dial number null");
+                atResponseCodeNative(HeadsetHalConstants.AT_RESPONSE_ERROR);
+                return;
+            }
         } else {
             dialNumber = PhoneNumberUtils.convertPreDial(number);
         }