[Bugfix][T106BUG-106][call] lynq_query_radio_state error
Affected branch: unknown
Affected module: unknown
Is it affected on both ZXIC and MTK: ZXIC
Self-test: Yes
Doc Update: N
Change-Id: Id36833a27208170d0738e291080413d9c5068072
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
index 8400938..04ce391 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
@@ -62,9 +62,6 @@
static int sCSQ[2] = { 99, 99 };
static int sys_mode = 0;/*LTE*/
-static int airPlaneMode = 0;
-
-
static uint64_t ref_ril_nano_time(void)
{
struct timespec now;
@@ -257,6 +254,10 @@
setRadioState(RADIO_STATE_OFF);
}
+void resetRadioStateOff(void)
+{
+ setRadioStateOff();
+}
static void reportRadioTech(RIL_Token t)
{
@@ -1016,7 +1017,6 @@
if ((err < 0 || response->success == 0) && (isRadioOn() != 1)) {
goto error;
}
- airPlaneMode = 0;
updateRadioState();
ril_request_open_zsqr_notify();
@@ -1856,33 +1856,27 @@
RIL_RadioState currentState = getRadioState();
RLOGD("ril_request_radio_power(): onOff=%d, currentState=%d", onOff, currentState);
- if ((onOff == 4) && (currentState != RADIO_STATE_OFF)) {
+ if ( onOff == 4 ) {
RLOGD("onOff=%d, currentState=%d --> AT+CFUN=4", onOff, currentState);
err = at_send_command_timeout("AT+CFUN=4", &response, TIMEOUT_CFUN);
DO_MM_RESPONSE_ERROR_JDUGE;
setRadioStateOff();
- airPlaneMode = 1;
- } else if ((onOff == 0) && (currentState != RADIO_STATE_OFF)) {
+ } else if ( onOff == 0 ) {
RLOGD("onOff=%d, currentState=%d --> AT+CFUN=4", onOff, currentState);
err = at_send_command_timeout("AT+CFUN=4", &response, TIMEOUT_CFUN);
DO_MM_RESPONSE_ERROR_JDUGE;
//err = at_send_command("AT^ZPOWEROFF", NULL); //poweroff
- airPlaneMode = 1;
setRadioStateOff();
- } else if (((onOff == 1) && (currentState == RADIO_STATE_OFF)) || (currentState == RADIO_STATE_UNAVAILABLE) || (currentState == RADIO_STATE_SIM_READY)) {
+ } else if (onOff == 1) {
RLOGD("onOff=%d, currentState=%d --> AT+CFUN=1", onOff, currentState);
err = at_send_command_timeout("AT+CFUN=1", &response, TIMEOUT_CFUN);
if ((err < 0 || response->success == 0) && (isRadioOn() != 1)) {
goto error;
}
- airPlaneMode = 0;
updateRadioState();
ril_request_open_zsqr_notify();
- } else if ((onOff == 4) && (airPlaneMode == 1)) {
- RLOGD("onOff=%d, airPlaneMode=%d --> AT^ZPOWEROFF", onOff, airPlaneMode);
- at_send_command("AT^ZPOWEROFF", NULL);
- setRadioStateOff();
- }
+ }
+
RIL_onRequestComplete(token, RIL_E_SUCCESS, NULL, 0);
goto exit;
error:
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
index 64eecd2..43b4347 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
@@ -248,7 +248,17 @@
RIL_RadioState getRadioState(void)
{
- return sState;
+ int radioState = -1;
+
+ radioState = isRadioOn();
+
+ if(1 == radioState) {
+ updateRadioState();
+ }
+ else if((0 == radioState) || (4 == radioState)) {
+ resetRadioStateOff();
+ }
+ return sState;
}
/** returns 1 if on, 0 if off, and -1 on error */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
index 0b985a2..8b12387 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
@@ -177,6 +177,7 @@
void requestSendUSSD(void *data, size_t datalen, RIL_Token t);
void requestCancelUSSD(void *data, size_t datalen, RIL_Token t);
void requestDeviceIdentity(void *data, size_t datalen, RIL_Token t);
+void resetRadioStateOff(void);
/*ril_sim.c*/
void ril_handle_sim_pin_puk(int request, void *data, size_t datalen, RIL_Token token);