KlteRIL: Cleanup RIL class
* Remove some old hacks * Remove an unused ril prop * Move to using a prop for mQANElements * Reorganize structure based on AOSP RIL.java Change-Id: Id837ea9b9fc82ebb74212d51974da385b40180a5
This commit is contained in:
parent
a5bfcfc37b
commit
0ce39c7328
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2014, The CyanogenMod Project. All rights reserved.
|
||||
* Copyright (C) 2014-2016 The CyanogenMod Project
|
||||
* Copyright (C) 2017 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,25 +17,24 @@
|
|||
|
||||
package com.android.internal.telephony;
|
||||
|
||||
import static com.android.internal.telephony.RILConstants.*;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telephony.Rlog;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Message;
|
||||
import android.os.Parcel;
|
||||
import android.os.SystemProperties;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.telephony.SignalStrength;
|
||||
|
||||
import com.android.internal.telephony.cdma.CdmaInformationRecords;
|
||||
import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaSignalInfoRec;
|
||||
import com.android.internal.telephony.cdma.SignalToneUtil;
|
||||
import com.android.internal.telephony.uicc.IccCardApplicationStatus;
|
||||
import com.android.internal.telephony.uicc.IccCardStatus;
|
||||
import com.android.internal.telephony.uicc.IccUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import static com.android.internal.telephony.RILConstants.*;
|
||||
|
||||
/**
|
||||
* RIL customization for Galaxy S5 (GSM) LTE devices
|
||||
*
|
||||
|
@ -42,19 +42,13 @@ import java.util.Collections;
|
|||
*/
|
||||
public class KlteRIL extends RIL {
|
||||
|
||||
private static final int RIL_UNSOL_ON_SS_LL = 11055;
|
||||
|
||||
private boolean mIsGsm = false;
|
||||
|
||||
public KlteRIL(Context context, int networkMode, int cdmaSubscription) {
|
||||
super(context, networkMode, cdmaSubscription, null);
|
||||
mQANElements = 6;
|
||||
}
|
||||
|
||||
public KlteRIL(Context context, int preferredNetworkType,
|
||||
int cdmaSubscription, Integer instanceId) {
|
||||
super(context, preferredNetworkType, cdmaSubscription, instanceId);
|
||||
mQANElements = 6;
|
||||
}
|
||||
|
||||
private void
|
||||
|
@ -78,7 +72,6 @@ public class KlteRIL extends RIL {
|
|||
@Override
|
||||
public void
|
||||
dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
|
||||
|
||||
RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
|
||||
|
||||
rr.mParcel.writeString(address);
|
||||
|
@ -101,6 +94,37 @@ public class KlteRIL extends RIL {
|
|||
send(rr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
acceptCall(Message result) {
|
||||
RILRequest rr
|
||||
= RILRequest.obtain(RIL_REQUEST_ANSWER, result);
|
||||
|
||||
rr.mParcel.writeInt(1);
|
||||
rr.mParcel.writeInt(0);
|
||||
|
||||
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
|
||||
|
||||
send(rr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void
|
||||
processUnsolicited(Parcel p, int type) {
|
||||
Object ret;
|
||||
int dataPosition = p.dataPosition();
|
||||
int response = p.readInt();
|
||||
|
||||
switch(response) {
|
||||
case RIL_UNSOL_NITZ_TIME_RECEIVED:
|
||||
fixNitz(p);
|
||||
break;
|
||||
}
|
||||
|
||||
p.setDataPosition(dataPosition);
|
||||
super.processUnsolicited(p, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object
|
||||
responseIccCardStatus(Parcel p) {
|
||||
|
@ -112,7 +136,6 @@ public class KlteRIL extends RIL {
|
|||
cardStatus.mGsmUmtsSubscriptionAppIndex = p.readInt();
|
||||
cardStatus.mCdmaSubscriptionAppIndex = p.readInt();
|
||||
cardStatus.mImsSubscriptionAppIndex = p.readInt();
|
||||
|
||||
int numApplications = p.readInt();
|
||||
|
||||
// limit to maximum allowed applications
|
||||
|
@ -120,12 +143,8 @@ public class KlteRIL extends RIL {
|
|||
numApplications = IccCardStatus.CARD_MAX_APPS;
|
||||
}
|
||||
cardStatus.mApplications = new IccCardApplicationStatus[numApplications];
|
||||
|
||||
appStatus = new IccCardApplicationStatus();
|
||||
for (int i = 0 ; i < numApplications ; i++) {
|
||||
if (i!=0) {
|
||||
appStatus = new IccCardApplicationStatus();
|
||||
}
|
||||
for (int i = 0; i < numApplications; i++) {
|
||||
appStatus = new IccCardApplicationStatus();
|
||||
appStatus.app_type = appStatus.AppTypeFromRILInt(p.readInt());
|
||||
appStatus.app_state = appStatus.AppStateFromRILInt(p.readInt());
|
||||
appStatus.perso_substate = appStatus.PersoSubstateFromRILInt(p.readInt());
|
||||
|
@ -141,36 +160,6 @@ public class KlteRIL extends RIL {
|
|||
p.readInt(); // perso_unblock_retries
|
||||
cardStatus.mApplications[i] = appStatus;
|
||||
}
|
||||
// For Sprint LTE only SIM
|
||||
if (numApplications==1 && !mIsGsm && appStatus.app_type == appStatus.AppTypeFromRILInt(2)) {
|
||||
cardStatus.mApplications = new IccCardApplicationStatus[numApplications+2];
|
||||
cardStatus.mGsmUmtsSubscriptionAppIndex = 0;
|
||||
cardStatus.mApplications[cardStatus.mGsmUmtsSubscriptionAppIndex]=appStatus;
|
||||
cardStatus.mCdmaSubscriptionAppIndex = 1;
|
||||
cardStatus.mImsSubscriptionAppIndex = 2;
|
||||
|
||||
IccCardApplicationStatus appStatus2 = new IccCardApplicationStatus();
|
||||
appStatus2.app_type = appStatus2.AppTypeFromRILInt(4); // csim state
|
||||
appStatus2.app_state = appStatus.app_state;
|
||||
appStatus2.perso_substate = appStatus.perso_substate;
|
||||
appStatus2.aid = appStatus.aid;
|
||||
appStatus2.app_label = appStatus.app_label;
|
||||
appStatus2.pin1_replaced = appStatus.pin1_replaced;
|
||||
appStatus2.pin1 = appStatus.pin1;
|
||||
appStatus2.pin2 = appStatus.pin2;
|
||||
cardStatus.mApplications[cardStatus.mCdmaSubscriptionAppIndex] = appStatus2;
|
||||
|
||||
IccCardApplicationStatus appStatus3 = new IccCardApplicationStatus();
|
||||
appStatus3.app_type = appStatus3.AppTypeFromRILInt(5); // ims state
|
||||
appStatus3.app_state = appStatus.app_state;
|
||||
appStatus3.perso_substate = appStatus.perso_substate;
|
||||
appStatus3.aid = appStatus.aid;
|
||||
appStatus3.app_label = appStatus.app_label;
|
||||
appStatus3.pin1_replaced = appStatus.pin1_replaced;
|
||||
appStatus3.pin1 = appStatus.pin1;
|
||||
appStatus3.pin2 = appStatus.pin2;
|
||||
cardStatus.mApplications[cardStatus.mImsSubscriptionAppIndex] = appStatus3;
|
||||
}
|
||||
return cardStatus;
|
||||
}
|
||||
|
||||
|
@ -190,7 +179,7 @@ public class KlteRIL extends RIL {
|
|||
" mEmergencyCallbackModeRegistrant=" + mEmergencyCallbackModeRegistrant +
|
||||
" mTestingEmergencyCall=" + mTestingEmergencyCall.get());
|
||||
}
|
||||
for (int i = 0 ; i < num ; i++) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
dc = new DriverCall();
|
||||
|
||||
dc.state = DriverCall.stateFromCLCC(p.readInt());
|
||||
|
@ -199,8 +188,7 @@ public class KlteRIL extends RIL {
|
|||
dc.isMpty = (0 != p.readInt());
|
||||
dc.isMT = (0 != p.readInt());
|
||||
dc.als = p.readInt();
|
||||
voiceSettings = p.readInt();
|
||||
dc.isVoice = (0 != voiceSettings);
|
||||
dc.isVoice = (0 != p.readInt());
|
||||
int call_type = p.readInt(); // Samsung CallDetails
|
||||
int call_domain = p.readInt(); // Samsung CallDetails
|
||||
String csv = p.readString(); // Samsung CallDetails
|
||||
|
@ -294,121 +282,4 @@ public class KlteRIL extends RIL {
|
|||
}
|
||||
super.notifyRegistrantsCdmaInfoRec(infoRec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPhoneType(int phoneType) {
|
||||
super.setPhoneType(phoneType);
|
||||
mIsGsm = (phoneType != RILConstants.CDMA_PHONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void
|
||||
processUnsolicited (Parcel p, int type) {
|
||||
Object ret;
|
||||
int dataPosition = p.dataPosition();
|
||||
int response = p.readInt();
|
||||
int newResponse = response;
|
||||
|
||||
switch(response) {
|
||||
case RIL_UNSOL_NITZ_TIME_RECEIVED:
|
||||
fixNitz(p);
|
||||
break;
|
||||
case RIL_UNSOL_ON_SS_LL:
|
||||
newResponse = RIL_UNSOL_ON_SS;
|
||||
break;
|
||||
}
|
||||
if (newResponse != response) {
|
||||
p.setDataPosition(dataPosition);
|
||||
p.writeInt(newResponse);
|
||||
}
|
||||
p.setDataPosition(dataPosition);
|
||||
super.processUnsolicited(p, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
acceptCall (Message result) {
|
||||
RILRequest rr
|
||||
= RILRequest.obtain(RIL_REQUEST_ANSWER, result);
|
||||
|
||||
rr.mParcel.writeInt(1);
|
||||
rr.mParcel.writeInt(0);
|
||||
|
||||
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
|
||||
|
||||
send(rr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RILRequest
|
||||
processSolicited (Parcel p, int type) {
|
||||
int serial, error;
|
||||
boolean found = false;
|
||||
int dataPosition = p.dataPosition(); // save off position within the Parcel
|
||||
serial = p.readInt();
|
||||
error = p.readInt();
|
||||
RILRequest rr = null;
|
||||
/* Pre-process the reply before popping it */
|
||||
synchronized (mRequestList) {
|
||||
RILRequest tr = mRequestList.get(serial);
|
||||
if (tr != null && tr.mSerial == serial) {
|
||||
if (error == 0 || p.dataAvail() > 0) {
|
||||
try {switch (tr.mRequest) {
|
||||
/* Get those we're interested in */
|
||||
case RIL_REQUEST_DATA_REGISTRATION_STATE:
|
||||
rr = tr;
|
||||
break;
|
||||
}} catch (Throwable thr) {
|
||||
// Exceptions here usually mean invalid RIL responses
|
||||
if (tr.mResult != null) {
|
||||
AsyncResult.forMessage(tr.mResult, null, thr);
|
||||
tr.mResult.sendToTarget();
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rr == null) {
|
||||
/* Nothing we care about, go up */
|
||||
p.setDataPosition(dataPosition);
|
||||
// Forward responses that we are not overriding to the super class
|
||||
return super.processSolicited(p, type);
|
||||
}
|
||||
rr = findAndRemoveRequestFromList(serial);
|
||||
if (rr == null) {
|
||||
return rr;
|
||||
}
|
||||
Object ret = null;
|
||||
if (error == 0 || p.dataAvail() > 0) {
|
||||
switch (rr.mRequest) {
|
||||
case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseDataRegistrationState(p); break;
|
||||
default:
|
||||
throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
|
||||
}
|
||||
//break;
|
||||
}
|
||||
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();
|
||||
}
|
||||
return rr;
|
||||
}
|
||||
|
||||
private Object
|
||||
responseDataRegistrationState(Parcel p) {
|
||||
String response[] = (String[])responseStrings(p);
|
||||
/* DANGER WILL ROBINSON
|
||||
* In some cases from Vodaphone we are receiving a RAT of 102
|
||||
* while in tunnels of the metro. Lets Assume that if we
|
||||
* receive 102 we actually want a RAT of 2 for EDGE service */
|
||||
if (response.length > 4 &&
|
||||
response[0].equals("1") &&
|
||||
response[3].equals("102")) {
|
||||
response[3] = "2";
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
|||
persist.data.netmgrd.qos.enable=true \
|
||||
persist.data.qmi.adb_logmask=0 \
|
||||
persist.radio.add_power_save=1 \
|
||||
persist.radio.lte_vrat_report=1 \
|
||||
ro.telephony.mms_data_profile=5 \
|
||||
ro.ril.telephony.mqanelements=6 \
|
||||
ro.telephony.ril_class=KlteRIL
|
||||
|
||||
# Ril sends only one RIL_UNSOL_CALL_RING, so set call_ring.multiple to false
|
||||
|
|
Loading…
Reference in New Issue