From a37857119fb5880acecb5e4c65a7ed7bc9bc3228 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Thu, 19 Mar 2015 10:19:02 -0400 Subject: smdk4412-qcom: update RIL -for use with KK blobs Change-Id: I5b3620153db7704650244d950b3d2ed48cdfdef3 --- .../internal/telephony/smdk4x12QComRIL.java | 179 +++++---------------- 1 file changed, 36 insertions(+), 143 deletions(-) diff --git a/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java b/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java index 79e8c45..0e8d798 100644 --- a/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java +++ b/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java @@ -65,13 +65,10 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { private boolean mIsSendingSMS = false; protected boolean isGSM = false; public static final long SEND_SMS_TIMEOUT_IN_MS = 30000; - private boolean oldRilState = needsOldRilFeature("exynos4RadioState"); - private boolean googleEditionSS = needsOldRilFeature("googleEditionSS"); - private boolean driverCall = needsOldRilFeature("newDriverCall"); - private boolean driverCallU = needsOldRilFeature("newDriverCallU"); - private boolean dialCode = needsOldRilFeature("newDialCode"); private boolean samsungEmergency = needsOldRilFeature("samsungEMSReq"); + private Message mPendingGetSimStatus; + public smdk4x12QComRIL(Context context, int preferredNetworkType, int cdmaSubscription, Integer instanceId) { this(context, preferredNetworkType, cdmaSubscription); @@ -81,7 +78,7 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { int cdmaSubscription) { super(context, networkMode, cdmaSubscription); mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE); - mQANElements = SystemProperties.getInt("ro.ril.telephony.mqanelements", 4); + mQANElements = SystemProperties.getInt("ro.ril.telephony.mqanelements", 6); } @Override @@ -124,7 +121,7 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { p.readInt(); // - perso_unblock_retries cardStatus.mApplications[i] = appStatus; } - if (numApplications==1 && !isGSM && appStatus.app_type == appStatus.AppTypeFromRILInt(2)) { // usim + if (numApplications==1 && !isGSM && appStatus.app_type == appStatus.AppTypeFromRILInt(2)) { cardStatus.mApplications = new IccCardApplicationStatus[numApplications+2]; cardStatus.mGsmUmtsSubscriptionAppIndex = 0; cardStatus.mApplications[cardStatus.mGsmUmtsSubscriptionAppIndex]=appStatus; @@ -194,78 +191,23 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { @Override protected Object responseSignalStrength(Parcel p) { - int numInts = 12; + int numInts = 13; int response[]; - // This is a mashup of algorithms used in - // SamsungQualcommUiccRIL.java - // Get raw data response = new int[numInts]; for (int i = 0; i < numInts; i++) { response[i] = p.readInt(); } //gsm - response[0] &= 0xff; //gsmDbm - + response[0] &= 0xff; //cdma - // Take just the least significant byte as the signal strength response[2] %= 256; response[4] %= 256; + response[7] &= 0xff; - // RIL_LTE_SignalStrength - if (googleEditionSS && !isGSM){ - response[8] = response[2]; - }else if ((response[7] & 0xff) == 255 || response[7] == 99) { - // If LTE is not enabled, clear LTE results - // 7-11 must be -1 for GSM signal strength to be used (see - // frameworks/base/telephony/java/android/telephony/SignalStrength.java) - // make sure lte is disabled - response[7] = 99; - response[8] = SignalStrength.INVALID; - response[9] = SignalStrength.INVALID; - response[10] = SignalStrength.INVALID; - response[11] = SignalStrength.INVALID; - }else{ // lte is gsm on samsung/qualcomm cdma stack - response[7] &= 0xff; - } - - return new SignalStrength(response[0], response[1], response[2], response[3], response[4], response[5], response[6], response[7], response[8], response[9], response[10], response[11], (p.readInt() != 0)); - - } - - @Override - protected RadioState getRadioStateFromInt(int stateInt) { - if(!oldRilState) - return super.getRadioStateFromInt(stateInt); - RadioState state; - - /* RIL_RadioState ril.h */ - switch(stateInt) { - case 0: state = RadioState.RADIO_OFF; break; - case 1: - case 2: state = RadioState.RADIO_UNAVAILABLE; break; - case 4: - // When SIM is PIN-unlocked, RIL doesn't respond with RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED. - // We notify the system here. - Rlog.d(RILJ_LOG_TAG, "SIM is PIN-unlocked now"); - if (mIccStatusChangedRegistrants != null) { - mIccStatusChangedRegistrants.notifyRegistrants(); - } - case 3: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 13: state = RadioState.RADIO_ON; break; + return new SignalStrength(response[0], response[1], response[2], response[3], response[4], response[5], response[6], response[7], response[8], response[9], response[10], response[11], (response[12] != 0)); - default: - throw new RuntimeException( - "Unrecognized RIL_RadioState: " + stateInt); - } - return state; } @Override @@ -299,10 +241,16 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { dc.isMT = (0 != p.readInt()); dc.als = p.readInt(); voiceSettings = p.readInt(); + if (isGSM){ + p.readInt(); + } dc.isVoice = (0 == voiceSettings) ? false : true; - if(driverCallU || (driverCall && !isGSM) || mRilVersion < 7 ? false : true) - p.readInt(); dc.isVoicePrivacy = (0 != p.readInt()); + if (isGSM) { + p.readInt(); + p.readInt(); + p.readString(); + } dc.number = p.readString(); int np = p.readInt(); dc.numberPresentation = DriverCall.presentationFromCLIP(np); @@ -351,7 +299,6 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { } return response; - } @Override @@ -362,8 +309,7 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { int response = p.readInt(); switch(response) { - case RIL_UNSOL_RIL_CONNECTED: // Fix for NV/RUIM setting on CDMA SIM devices - // skip getcdmascriptionsource as if qualcomm handles it in the ril binary + case RIL_UNSOL_RIL_CONNECTED: ret = responseInts(p); setRadioPower(false, null); setPreferredNetworkType(mPreferredNetworkType, null); @@ -372,9 +318,6 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { setCellInfoListRate(Integer.MAX_VALUE, null); notifyRegistrantsRilConnectionChanged(((int[])ret)[0]); break; - case RIL_UNSOL_NITZ_TIME_RECEIVED: - handleNitzTimeReceived(p); - break; // SAMSUNG STATES case 11010: // RIL_UNSOL_AM: ret = responseString(p); @@ -466,18 +409,9 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { case RIL_REQUEST_UDUB: ret = responseVoid(p); break; case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; - //modification start - // prevent exceptions from happenimg because the null value is null or a hexadecimel. so convert if it is not null - case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p); break; - case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p); break; - // this fixes bogus values the modem creates - // sometimes the ril may print out - // (always on sprint) - // sprint: (empty,empty,31000) - // this problemaic on sprint, lte won't start, response is slow - //speeds up response time on eherpderpd/lte networks + case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p); break; + case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p); break; case RIL_REQUEST_OPERATOR: ret = operatorCheck(p); break; - //end modification case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break; case RIL_REQUEST_DTMF: ret = responseVoid(p); break; case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break; @@ -564,7 +498,7 @@ public class smdk4x12QComRIL 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_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_IMS_REGISTRATION_STATE: ret = responseInts(p); break; @@ -634,7 +568,6 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { return rr; } - // CDMA FIXES, this fixes bogus values in nv/sim on d2/jf/t0 cdma family or bogus information from sim card private Object operatorCheck(Parcel p) { String response[] = (String[])responseStrings(p); @@ -645,14 +578,14 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { } return response; } - // handle exceptions + private Object responseVoiceDataRegistrationState(Parcel p) { String response[] = (String[])responseStrings(p); if (isGSM){ return response; } - if ( response.length>=10){ + if (response.length>=10){ for(int i=6; i<=9; i++){ if (response[i]== null){ response[i]=Integer.toString(Integer.MAX_VALUE); @@ -668,26 +601,11 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { return response; } - // has no effect - // for debugging purposes , just generate out anything from response - public static String s(String a[]){ - StringBuffer result = new StringBuffer(); - - for (int i = 0; i < a.length; i++) { - result.append( a[i] ); - result.append(","); - } - return result.toString(); - } - // end of cdma fix /** * Set audio parameter "wb_amr" for HD-Voice (Wideband AMR). * * @param state: 0 = unsupported, 1 = supported. - * REQUIRED FOR JF FAMILY THIS SETS THE INFORMATION - * CRASHES WITHOUT THIS FUNCTION - * part of the new csd binary */ private void setWbAmr(int state) { if (state == 1) { @@ -756,42 +674,7 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { super.notifyRegistrantsCdmaInfoRec(infoRec); } - private void - handleNitzTimeReceived(Parcel p) { - String nitz = (String)responseString(p); - //if (RILJ_LOGD) unsljLogRet(RIL_UNSOL_NITZ_TIME_RECEIVED, nitz); - - // has bonus long containing milliseconds since boot that the NITZ - // time was received - long nitzReceiveTime = p.readLong(); - - Object[] result = new Object[2]; - - String fixedNitz = nitz; - String[] nitzParts = nitz.split(","); - if (nitzParts.length == 4) { - // 0=date, 1=time+zone, 2=dst, 3=garbage that confuses GsmServiceStateTracker (so remove it) - fixedNitz = nitzParts[0]+","+nitzParts[1]+","+nitzParts[2]+","; - } - - result[0] = fixedNitz; - result[1] = Long.valueOf(nitzReceiveTime); - boolean ignoreNitz = SystemProperties.getBoolean( - TelephonyProperties.PROPERTY_IGNORE_NITZ, false); - - if (ignoreNitz) { - if (RILJ_LOGD) riljLog("ignoring UNSOL_NITZ_TIME_RECEIVED"); - } else { - if (mNITZTimeRegistrant != null) { - mNITZTimeRegistrant - .notifyRegistrant(new AsyncResult (null, result, null)); - } else { - // in case NITZ time registrant isnt registered yet - mLastNITZTimeInfo = result; - } - } - } @Override protected Object @@ -812,10 +695,6 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { dialEmergencyCall(address, clirMode, result); return; } - if(!dialCode){ - super.dial(address, clirMode, uusInfo, result); - return; - } RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); rr.mParcel.writeString(address); @@ -852,6 +731,7 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { + strings.length + " strings, expected multiple of " + mQANElements); } + Rlog.v(RILJ_LOG_TAG, "responseOperatorInfos"); ret = new ArrayList(strings.length / mQANElements); Operators init = null; if (strings.length != 0) { @@ -899,4 +779,17 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface { send(rr); } + + // This call causes ril to crash the socket, stopping further communication + @Override + public void + getHardwareConfig (Message result) { + riljLog("Ignoring call to 'getHardwareConfig'"); + if (result != null) { + CommandException ex = new CommandException( + CommandException.Error.REQUEST_NOT_SUPPORTED); + AsyncResult.forMessage(result, null, ex); + result.sendToTarget(); + } + } } -- cgit v1.2.3