aboutsummaryrefslogtreecommitdiffstats
path: root/ril/telephony/java/com/android/internal
diff options
context:
space:
mode:
authorRGIB <gibellini.roberto@gmail.com>2016-08-22 22:37:03 +0200
committerRGIB <gibellini.roberto@gmail.com>2016-08-22 22:37:03 +0200
commitf0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a (patch)
treed5066f20d110bb0e217f639da63e34984bf73134 /ril/telephony/java/com/android/internal
parente9a5736c3f0c3da83e4a5268bdd2e1268fd32348 (diff)
downloaddevice_samsung_n5100-f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a.zip
device_samsung_n5100-f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a.tar.gz
device_samsung_n5100-f0f42083d42d3b6aa3f37fdacdb9c0f46c94a60a.tar.bz2
n5100 : fix FC on hangup
Change-Id: I9719d78b640c691ba91b92af7083d805aa1d254b
Diffstat (limited to 'ril/telephony/java/com/android/internal')
-rw-r--r--ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java163
1 files changed, 128 insertions, 35 deletions
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);
+ }
+
}