diff options
author | RGIB <gibellini.roberto@gmail.com> | 2016-08-22 22:37:03 +0200 |
---|---|---|
committer | RGIB <gibellini.roberto@gmail.com> | 2016-08-22 22:37:03 +0200 |
commit | f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a (patch) | |
tree | d5066f20d110bb0e217f639da63e34984bf73134 | |
parent | e9a5736c3f0c3da83e4a5268bdd2e1268fd32348 (diff) | |
download | device_samsung_n5100-f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a.zip device_samsung_n5100-f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a.tar.gz device_samsung_n5100-f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a.tar.bz2 |
n5100 : fix FC on hangup
Change-Id: I9719d78b640c691ba91b92af7083d805aa1d254b
-rw-r--r-- | include/telephony/ril.h | 124 | ||||
-rw-r--r-- | ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java | 163 |
2 files changed, 190 insertions, 97 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 5ca98a8..e13ad9f 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -113,8 +113,7 @@ typedef enum { RIL_E_SS_MODIFIED_TO_DIAL = 24, /* SS request modified to DIAL */ RIL_E_SS_MODIFIED_TO_USSD = 25, /* SS request modified to USSD */ RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */ - RIL_E_SS_MODIFIED_TO_SS = 27, /* SS request modified to different SS request */ - RIL_E_LCE_NOT_SUPPORTED = 36 /* LCE service not supported(36 in RILConstants.java) */ + RIL_E_SS_MODIFIED_TO_SS = 27 /* SS request modified to different SS request */ } RIL_Errno; @@ -4398,7 +4397,7 @@ typedef struct { */ #define RIL_REQUEST_SET_RADIO_CAPABILITY 131 -/** + /** * RIL_REQUEST_START_LCE * * Start Link Capacity Estimate (LCE) service if supported by the radio. @@ -4444,8 +4443,7 @@ typedef struct { * LCE_NOT_SUPPORTED */ #define RIL_REQUEST_PULL_LCEDATA 134 - -/** + /** * RIL_REQUEST_GET_ACTIVITY_INFO * * Get modem activity statisitics info. @@ -4465,6 +4463,63 @@ typedef struct { */ #define RIL_REQUEST_GET_ACTIVITY_INFO 135 + +/* SAMSUNG REQUESTS */ +#undef RIL_REQUEST_SIM_OPEN_CHANNEL +#undef RIL_REQUEST_SIM_CLOSE_CHANNEL + +#define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002 + +#define RIL_REQUEST_SEND_ENCODED_USSD 10005 +#define RIL_REQUEST_SET_PDA_MEMORY_STATUS 10006 +#define RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO 10007 +#define RIL_REQUEST_GET_PHONEBOOK_ENTRY 10008 +#define RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY 10009 +#define RIL_REQUEST_DIAL_VIDEO_CALL 10010 +#define RIL_REQUEST_CALL_DEFLECTION 10011 +#define RIL_REQUEST_READ_SMS_FROM_SIM 10012 +#define RIL_REQUEST_USIM_PB_CAPA 10013 +#define RIL_REQUEST_LOCK_INFO 10014 + +#define RIL_REQUEST_DIAL_EMERGENCY 10016 +#define RIL_REQUEST_GET_STOREAD_MSG_COUNT 10017 +#define RIL_REQUEST_STK_SIM_INIT_EVENT 10018 +#define RIL_REQUEST_GET_LINE_ID 10019 +#define RIL_REQUEST_SET_LINE_ID 10020 +#define RIL_REQUEST_GET_SERIAL_NUMBER 10021 +#define RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER 10022 +#define RIL_REQUEST_GET_BARCODE_NUMBER 10023 +#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP 10024 +#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF 10025 +#define RIL_REQUEST_SIM_TRANSMIT_BASIC 10026 +#define RIL_REQUEST_SIM_OPEN_CHANNEL 10027 +#define RIL_REQUEST_SIM_CLOSE_CHANNEL 10028 +#define RIL_REQUEST_SIM_TRANSMIT_CHANNEL 10029 +#define RIL_REQUEST_SIM_AUTH 10030 +#define RIL_REQUEST_PS_ATTACH 10031 +#define RIL_REQUEST_PS_DETACH 10032 +#define RIL_REQUEST_ACTIVATE_DATA_CALL 10033 +#define RIL_REQUEST_CHANGE_SIM_PERSO 10034 +#define RIL_REQUEST_ENTER_SIM_PERSO 10035 +#define RIL_REQUEST_GET_TIME_INFO 10036 +#define RIL_REQUEST_OMADM_SETUP_SESSION 10037 +#define RIL_REQUEST_OMADM_SERVER_START_SESSION 10038 +#define RIL_REQUEST_OMADM_CLIENT_START_SESSION 10039 +#define RIL_REQUEST_OMADM_SEND_DATA 10040 +#define RIL_REQUEST_CDMA_GET_DATAPROFILE 10041 +#define RIL_REQUEST_CDMA_SET_DATAPROFILE 10042 +#define RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES 10043 +#define RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES 10044 +#define RIL_REQUEST_SEND_SMS_COUNT 10045 +#define RIL_REQUEST_SEND_SMS_MSG 10046 +#define RIL_REQUEST_SEND_SMS_MSG_READ_STATUS 10047 +#define RIL_REQUEST_MODEM_HANGUP 10048 +#define RIL_REQUEST_SET_SIM_POWER 10049 +#define RIL_REQUEST_SET_PREFERRED_NETWORK_LIST 10050 +#define RIL_REQUEST_GET_PREFERRED_NETWORK_LIST 10051 +#define RIL_REQUEST_HANGUP_VT 10052 + + /***********************************************************************/ @@ -5054,7 +5109,7 @@ typedef struct { */ #define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044 -/** + /** * RIL_UNSOL_LCEDATA_RECV * * Called when there is an incoming Link Capacity Estimate (LCE) info report. @@ -5064,62 +5119,6 @@ typedef struct { */ #define RIL_UNSOL_LCEDATA_RECV 1045 -/***********************************************************************/ - -/* SAMSUNG REQUESTS */ -#define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002 - -#define RIL_REQUEST_SEND_ENCODED_USSD 10005 -#define RIL_REQUEST_SET_PDA_MEMORY_STATUS 10006 -#define RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO 10007 -#define RIL_REQUEST_GET_PHONEBOOK_ENTRY 10008 -#define RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY 10009 -#define RIL_REQUEST_DIAL_VIDEO_CALL 10010 -#define RIL_REQUEST_CALL_DEFLECTION 10011 -#define RIL_REQUEST_READ_SMS_FROM_SIM 10012 -#define RIL_REQUEST_USIM_PB_CAPA 10013 -#define RIL_REQUEST_LOCK_INFO 10014 - -#define RIL_REQUEST_DIAL_EMERGENCY 10016 -#define RIL_REQUEST_GET_STOREAD_MSG_COUNT 10017 -#define RIL_REQUEST_STK_SIM_INIT_EVENT 10018 -#define RIL_REQUEST_GET_LINE_ID 10019 -#define RIL_REQUEST_SET_LINE_ID 10020 -#define RIL_REQUEST_GET_SERIAL_NUMBER 10021 -#define RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER 10022 -#define RIL_REQUEST_GET_BARCODE_NUMBER 10023 -#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP 10024 -#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF 10025 -#define RIL_REQUEST_SIM_TRANSMIT_BASIC 10026 -#define RIL_REQUEST_SIM_OPEN_CHANNEL 10027 -#define RIL_REQUEST_SIM_CLOSE_CHANNEL 10028 -#define RIL_REQUEST_SIM_TRANSMIT_CHANNEL 10029 -#define RIL_REQUEST_SIM_AUTH 10030 -#define RIL_REQUEST_PS_ATTACH 10031 -#define RIL_REQUEST_PS_DETACH 10032 -#define RIL_REQUEST_ACTIVATE_DATA_CALL 10033 -#define RIL_REQUEST_CHANGE_SIM_PERSO 10034 -#define RIL_REQUEST_ENTER_SIM_PERSO 10035 -#define RIL_REQUEST_GET_TIME_INFO 10036 -#define RIL_REQUEST_OMADM_SETUP_SESSION 10037 -#define RIL_REQUEST_OMADM_SERVER_START_SESSION 10038 -#define RIL_REQUEST_OMADM_CLIENT_START_SESSION 10039 -#define RIL_REQUEST_OMADM_SEND_DATA 10040 -#define RIL_REQUEST_CDMA_GET_DATAPROFILE 10041 -#define RIL_REQUEST_CDMA_SET_DATAPROFILE 10042 -#define RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES 10043 -#define RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES 10044 -#define RIL_REQUEST_SEND_SMS_COUNT 10045 -#define RIL_REQUEST_SEND_SMS_MSG 10046 -#define RIL_REQUEST_SEND_SMS_MSG_READ_STATUS 10047 -#define RIL_REQUEST_MODEM_HANGUP 10048 -#define RIL_REQUEST_SET_SIM_POWER 10049 -#define RIL_REQUEST_SET_PREFERRED_NETWORK_LIST 10050 -#define RIL_REQUEST_GET_PREFERRED_NETWORK_LIST 10051 -#define RIL_REQUEST_HANGUP_VT 10052 - -/***********************************************************************/ - /* SAMSUNG RESPONSE */ #define SAMSUNG_UNSOL_RESPONSE_BASE 11000 @@ -5157,6 +5156,7 @@ typedef struct { /***********************************************************************/ + #if defined(ANDROID_MULTI_SIM) /** * RIL_Request Function pointer diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java index ab170a4..8aaca62 100644 --- a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java +++ b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The CyanogenMod Project <http://www.cyanogenmod.org> + * Copyright (C) 2014 The OmniROM Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,18 +22,14 @@ import static com.android.internal.telephony.RILConstants.*; import android.content.Context; import android.os.AsyncResult; import android.os.Handler; -import android.os.HandlerThread; -import android.os.Looper; import android.os.Message; import android.os.Parcel; import android.os.Registrant; -import android.text.TextUtils; +import android.telephony.ModemActivityInfo; import android.telephony.Rlog; import android.telephony.PhoneNumberUtils; -import java.util.ArrayList; - public class SamsungExynos4RIL extends RIL implements CommandsInterface { //SAMSUNG STATES @@ -120,13 +117,10 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032; private Object mCatProCmdBuffer; + /* private Message mPendingGetSimStatus; */ - public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription) { - super(context, networkMode, cdmaSubscription); - } - - public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceID) { - super(context, networkMode, cdmaSubscription, instanceID); + public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) { + super(context, networkMode, cdmaSubscription, instanceId); } static String @@ -137,6 +131,15 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { } } + static String + responseToString(int response) { + switch (response) { + case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT"; + default: return RIL.responseToString(response); + } + } + + @Override protected RILRequest processSolicited (Parcel p) { int serial, error; @@ -192,7 +195,7 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break; case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; case RIL_REQUEST_UDUB: ret = responseVoid(p); break; - case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; + case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseFailCause(p); break; case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break; case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break; @@ -283,6 +286,32 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break; case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break; case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break; + case RIL_REQUEST_GET_CELL_INFO_LIST: ret = responseCellInfoList(p); break; + case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE: ret = responseVoid(p); break; + case RIL_REQUEST_SET_INITIAL_ATTACH_APN: ret = responseVoid(p); break; + case RIL_REQUEST_SET_DATA_PROFILE: ret = responseVoid(p); break; + case RIL_REQUEST_IMS_REGISTRATION_STATE: ret = responseInts(p); break; + case RIL_REQUEST_IMS_SEND_SMS: ret = responseSMS(p); break; + case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: ret = responseICC_IO(p); break; + case RIL_REQUEST_SIM_OPEN_CHANNEL: ret = responseInts(p); break; + case RIL_REQUEST_SIM_CLOSE_CHANNEL: ret = responseVoid(p); break; + case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: ret = responseICC_IO(p); break; + case RIL_REQUEST_SIM_GET_ATR: ret = responseString(p); break; + case RIL_REQUEST_NV_READ_ITEM: ret = responseString(p); break; + case RIL_REQUEST_NV_WRITE_ITEM: ret = responseVoid(p); break; + case RIL_REQUEST_NV_WRITE_CDMA_PRL: ret = responseVoid(p); break; + case RIL_REQUEST_NV_RESET_CONFIG: ret = responseVoid(p); break; + case RIL_REQUEST_SET_UICC_SUBSCRIPTION: ret = responseVoid(p); break; + case RIL_REQUEST_ALLOW_DATA: ret = responseVoid(p); break; + case RIL_REQUEST_GET_HARDWARE_CONFIG: ret = responseHardwareConfig(p); break; + case RIL_REQUEST_SIM_AUTHENTICATION: ret = responseICC_IOBase64(p); break; + case RIL_REQUEST_SHUTDOWN: ret = responseVoid(p); break; + case RIL_REQUEST_GET_RADIO_CAPABILITY: ret = responseRadioCapability(p); break; + case RIL_REQUEST_SET_RADIO_CAPABILITY: ret = responseRadioCapability(p); break; + case RIL_REQUEST_START_LCE: ret = responseLceStatus(p); break; + case RIL_REQUEST_STOP_LCE: ret = responseLceStatus(p); break; + case RIL_REQUEST_PULL_LCEDATA: ret = responseLceData(p); break; + case RIL_REQUEST_GET_ACTIVITY_INFO: ret = responseActivityData(p); break; default: throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); //break; @@ -301,6 +330,14 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { } } + if (rr.mRequest == RIL_REQUEST_SHUTDOWN) { + // Set RADIO_STATE to RADIO_UNAVAILABLE to continue shutdown process + // regardless of error code to continue shutdown procedure. + riljLog("Response to RIL_REQUEST_SHUTDOWN received. Error is " + + error + " Setting Radio State to Unavailable regardless of error."); + setRadioState(RadioState.RADIO_UNAVAILABLE); + } + // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789. // This is needed otherwise we don't automatically transition to the main lock // screen when the pin or puk is entered incorrectly. @@ -332,18 +369,36 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { mIccStatusChangedRegistrants.notifyRegistrants(); } break; + case RIL_REQUEST_GET_RADIO_CAPABILITY: { + // Ideally RIL's would support this or at least give NOT_SUPPORTED + // but the hammerhead RIL reports GENERIC :( + // TODO - remove GENERIC_FAILURE catching: b/21079604 + if (REQUEST_NOT_SUPPORTED == error || + GENERIC_FAILURE == error) { + // we should construct the RAF bitmask the radio + // supports based on preferred network bitmasks + ret = makeStaticRadioCapability(); + error = 0; + } + break; + } + case RIL_REQUEST_GET_ACTIVITY_INFO: + ret = new ModemActivityInfo(0, 0, 0, + new int [ModemActivityInfo.TX_POWER_LEVELS], 0, 0); + error = 0; + break; } - rr.onError(error, ret); - return rr; - } - - if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) - + " " + retToString(rr.mRequest, ret)); + if (error != 0) rr.onError(error, ret); + } + if (error == 0) { + if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) + + " " + retToString(rr.mRequest, ret)); - if (rr.mResult != null) { - AsyncResult.forMessage(rr.mResult, ret, null); - rr.mResult.sendToTarget(); + if (rr.mResult != null) { + AsyncResult.forMessage(rr.mResult, ret, null); + rr.mResult.sendToTarget(); + } } return rr; @@ -352,13 +407,12 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { @Override public void dial(String address, int clirMode, UUSInfo uusInfo, Message result) { - RILRequest rr; if (PhoneNumberUtils.isEmergencyNumber(address)) { dialEmergencyCall(address, clirMode, result); return; } - rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); + RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); rr.mParcel.writeString(address); rr.mParcel.writeInt(clirMode); @@ -378,10 +432,9 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { public void dialEmergencyCall(String address, int clirMode, Message result) { - RILRequest rr; Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address); - rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result); + RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result); rr.mParcel.writeString(address + "/"); rr.mParcel.writeInt(clirMode); rr.mParcel.writeInt(0); // UUS information is absent @@ -396,10 +449,26 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { processUnsolicited (Parcel p) { int dataPosition = p.dataPosition(); int response = p.readInt(); + Object ret; + + try{switch(response) { + case RIL_UNSOL_STK_PROACTIVE_COMMAND: ret = responseString(p); break; + case RIL_UNSOL_STK_SEND_SMS_RESULT: ret = responseInts(p); break; // Samsung STK + default: + // Rewind the Parcel + p.setDataPosition(dataPosition); + + // Forward responses that we are not overriding to the super class + super.processUnsolicited(p); + return; + }} catch (Throwable tr) { + Rlog.e(RILJ_LOG_TAG, "Exception processing unsol response: " + response + + " Exception: " + tr.toString()); + return; + } switch(response) { - case RIL_UNSOL_STK_PROACTIVE_COMMAND: - Object ret = responseString(p); + case RIL_UNSOL_STK_PROACTIVE_COMMAND: if (RILJ_LOGD) unsljLogRet(response, ret); if (mCatProCmdRegistrant != null) { @@ -411,15 +480,15 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { // does not get ignored (and breaks CatService). mCatProCmdBuffer = ret; } - break; - - default: - // Rewind the Parcel - p.setDataPosition(dataPosition); + break; + case RIL_UNSOL_STK_SEND_SMS_RESULT: + if (RILJ_LOGD) unsljLogRet(response, ret); - // Forward responses that we are not overriding to the super class - super.processUnsolicited(p); - return; + if (mCatSendSmsResultRegistrant != null) { + mCatSendSmsResultRegistrant.notifyRegistrant( + new AsyncResult (null, ret, null)); + } + break; } } @@ -434,4 +503,28 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface { } } + private void + constructGsmSendSmsRilRequest (RILRequest rr, String smscPDU, String pdu) { + rr.mParcel.writeInt(2); + rr.mParcel.writeString(smscPDU); + rr.mParcel.writeString(pdu); + } + + /** + * The RIL can't handle the RIL_REQUEST_SEND_SMS_EXPECT_MORE + * request properly, so we use RIL_REQUEST_SEND_SMS instead. + */ + @Override + public void + sendSMSExpectMore (String smscPDU, String pdu, Message result) { + RILRequest rr + = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result); + + constructGsmSendSmsRilRequest(rr, smscPDU, pdu); + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + } |