3
0

galaxys2-common: Bring SamsungExynos4RIL inline with framework

Change-Id: I667527ec7868f07421f6c48ed8a8b004ed48e8b8
This commit is contained in:
Caio Schnepper 2016-02-04 08:00:58 -02:00
parent d9436af729
commit ebb9e69395

View File

@ -21,18 +21,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
@ -122,10 +118,6 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface {
private Object mCatProCmdBuffer;
/* private Message mPendingGetSimStatus; */
public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription) {
super(context, networkMode, cdmaSubscription, null);
}
public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) {
super(context, networkMode, cdmaSubscription, instanceId);
}
@ -284,6 +276,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;
@ -302,6 +320,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.
@ -333,18 +359,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 (error != 0) rr.onError(error, ret);
}
if (error == 0) {
if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
+ " " + retToString(rr.mRequest, ret));
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;
@ -353,13 +397,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);
@ -377,32 +420,11 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface {
send(rr);
}
/* @Override
public void
getIccCardStatus(Message result) {
if (mState != RadioState.RADIO_ON) {
mPendingGetSimStatus = result;
} else {
super.getIccCardStatus(result);
}
}
@Override
protected void
switchToRadioState(RadioState newState) {
super.switchToRadioState(newState);
if (newState == RadioState.RADIO_ON && mPendingGetSimStatus != null) {
super.getIccCardStatus(mPendingGetSimStatus);
mPendingGetSimStatus = null;
}
}*/
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