Merge "Fix Sap Service" am: 35629b94bd am: 169d02b508 am: 9e60b87b17  -s ours
am: 826bd64c33  -s ours

Change-Id: Ic211e8584525596e4eed68dcbe205dda8f74a404
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
index 1c29fd3..efc3f72 100644
--- a/include/telephony/ril.h
+++ b/include/telephony/ril.h
@@ -2400,8 +2400,8 @@
  *  SUCCESS
  *  RADIO_NOT_AVAILABLE (radio resetting)
  *  PASSWORD_INCORRECT
- *     (code is invalid)
  *  SIM_ABSENT
+ *     (code is invalid)
  *  INTERNAL_ERR
  *  NO_MEMORY
  *  NO_RESOURCES
@@ -3054,7 +3054,7 @@
  *    RADIO_NOT_AVAILABLE, OP_NOT_ALLOWED_BEFORE_REG_TO_NW,
  *    OP_NOT_ALLOWED_DURING_VOICE_CALL, REQUEST_NOT_SUPPORTED,
  *    INVALID_ARGUMENTS, INTERNAL_ERR, NO_MEMORY, NO_RESOURCES,
- *    SIM_ABSENT and CANCELLED
+ *    CANCELLED and SIM_ABSENT
  *
  * See also: RIL_REQUEST_DEACTIVATE_DATA_CALL
  */
diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c
index ed399b7..e7b882c 100644
--- a/reference-ril/reference-ril.c
+++ b/reference-ril/reference-ril.c
@@ -2717,11 +2717,6 @@
     char *cpinResult;
 
     RLOGD("getSIMStatus(). sState: %d",sState);
-    if (sState == RADIO_STATE_OFF || sState == RADIO_STATE_UNAVAILABLE) {
-        ret = SIM_NOT_READY;
-        goto done;
-    }
-
     err = at_send_command_singleline("AT+CPIN?", "+CPIN:", &p_response);
 
     if (err != 0) {
@@ -2777,7 +2772,7 @@
     p_response = NULL;
     cpinResult = NULL;
 
-    ret = SIM_READY;
+    ret = (sState == RADIO_STATE_ON) ? SIM_READY : SIM_NOT_READY;
 
 done:
     at_response_free(p_response);