Update ril - fix switch network type.

This commit is contained in:
Valera1978 2016-01-23 13:32:48 +03:00
parent d328b17900
commit 2b3890b31e
2 changed files with 78 additions and 110 deletions

View File

@ -285,4 +285,11 @@
<!-- Base "touch slop" value used by ViewConfiguration as a
movement threshold where scrolling should begin. -->
<dimen name="config_viewConfigurationTouchSlop">19dip</dimen>
<!-- The RadioAccessFamilies supported by the device.
Empty is viewed as "all". Only used on devices which
don't support RIL_REQUEST_GET_RADIO_CAPABILITY
format is UMTS|LTE|... -->
<string translatable="false" name="config_radio_access_family">GSM|WCDMA|LTE</string>
</resources>

View File

@ -1,5 +1,8 @@
/*
* Copyright (c) 2014, The CyanogenMod Project. All rights reserved.
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,41 +22,36 @@ 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.Rlog;
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 java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import com.android.internal.telephony.uicc.IccCardApplicationStatus;
import com.android.internal.telephony.uicc.IccCardStatus;
/**
* RIL customization for Galaxy Note Pro 12.2 LTE
* RIL customization for tabpro LTE devices
*
* {@hide}
*/
public class TabproLteRIL extends RIL {
private static final int RIL_REQUEST_DIAL_EMERGENCY = 10001;
private static final int RIL_UNSOL_ON_SS_LL = 11055;
private boolean mIsGsm = false;
private static final int RIL_REQUEST_DIAL_EMERGENCY = 10016;
public TabproLteRIL(Context context, int networkMode, int cdmaSubscription) {
super(context, networkMode, cdmaSubscription, null);
mQANElements = 6;
}
public TabproLteRIL(Context context, int preferredNetworkType,
int cdmaSubscription, Integer instanceId) {
super(context, preferredNetworkType, cdmaSubscription, instanceId);
public TabproLteRIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) {
super(context, networkMode, cdmaSubscription, instanceId);
mQANElements = 6;
}
@ -69,9 +67,9 @@ public class TabproLteRIL extends RIL {
rr.mParcel.writeString(address);
rr.mParcel.writeInt(clirMode);
rr.mParcel.writeInt(0); // CallDetails.call_type
rr.mParcel.writeInt(1); // CallDetails.call_domain
rr.mParcel.writeString(""); // CallDetails.getCsvFromExtras
rr.mParcel.writeInt(0); // CallDetails.call_type
rr.mParcel.writeInt(1); // CallDetails.call_domain
rr.mParcel.writeString(""); // CallDetails.getCsvFromExtras
if (uusInfo == null) {
rr.mParcel.writeInt(0); // UUS information is absent
@ -117,6 +115,7 @@ public class TabproLteRIL extends RIL {
appStatus.pin1_replaced = p.readInt();
appStatus.pin1 = appStatus.PinStateFromRILInt(p.readInt());
appStatus.pin2 = appStatus.PinStateFromRILInt(p.readInt());
// All subsequent readInt()s added for our device
p.readInt(); // pin1_num_retries
p.readInt(); // puk1_num_retries
p.readInt(); // pin2_num_retries
@ -125,40 +124,6 @@ public class TabproLteRIL extends RIL {
cardStatus.mApplications[i] = appStatus;
}
// For Sprint LTE only SIM
if (appStatus != null
&& numApplications == 1
&& !mIsGsm
&& appStatus.app_type == appStatus.AppTypeFromRILInt(2)) {
cardStatus.mApplications = new IccCardApplicationStatus[3];
cardStatus.mApplications[0] = appStatus;
cardStatus.mGsmUmtsSubscriptionAppIndex = 0;
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;
}
@ -182,6 +147,7 @@ public class TabproLteRIL extends RIL {
dc = new DriverCall();
dc.state = DriverCall.stateFromCLCC(p.readInt());
// & 0xff to truncate to 1 byte added for us, not in RIL.java
dc.index = p.readInt() & 0xff;
dc.TOA = p.readInt();
dc.isMpty = (0 != p.readInt());
@ -189,6 +155,7 @@ public class TabproLteRIL extends RIL {
dc.als = p.readInt();
voiceSettings = p.readInt();
dc.isVoice = (0 != voiceSettings);
// boolean isVideo = (0 != p.readInt());
int call_type = p.readInt(); // Samsung CallDetails
int call_domain = p.readInt(); // Samsung CallDetails
String csv = p.readString(); // Samsung CallDetails
@ -197,6 +164,7 @@ public class TabproLteRIL extends RIL {
int np = p.readInt();
dc.numberPresentation = DriverCall.presentationFromCLIP(np);
dc.name = p.readString();
// dc.namePresentation = p.readInt();
dc.namePresentation = DriverCall.presentationFromCLIP(p.readInt());
int uusInfoPresent = p.readInt();
if (uusInfoPresent == 1) {
@ -260,6 +228,7 @@ public class TabproLteRIL extends RIL {
int lteCqi = p.readInt();
int tdScdmaRscp = p.readInt();
// constructor sets default true, makeSignalStrengthFromRilParcel does not set it
boolean isGsm = true;
if ((lteSignalStrength & 0xff) == 255 || lteSignalStrength == 99) {
lteSignalStrength = 99;
@ -277,57 +246,49 @@ public class TabproLteRIL extends RIL {
" evdoEcio: " + evdoEcio + " evdoSnr:" + evdoSnr +
" lteSignalStrength:" + lteSignalStrength + " lteRsrp:" + lteRsrp +
" lteRsrq:" + lteRsrq + " lteRssnr:" + lteRssnr + " lteCqi:" + lteCqi +
" tdScdmaRscp:" + tdScdmaRscp + " isGsm:" + (mIsGsm ? "true" : "false"));
" tdScdmaRscp:" + tdScdmaRscp + " isGsm:" + (isGsm ? "true" : "false"));
return new SignalStrength(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio, evdoDbm,
evdoEcio, evdoSnr, lteSignalStrength, lteRsrp, lteRsrq, lteRssnr, lteCqi,
tdScdmaRscp, mIsGsm);
}
@Override
protected void notifyRegistrantsCdmaInfoRec(CdmaInformationRecords infoRec) {
final int response = RIL_UNSOL_CDMA_INFO_REC;
if (infoRec.record instanceof CdmaSignalInfoRec) {
CdmaSignalInfoRec rec = (CdmaSignalInfoRec) infoRec.record;
if (rec != null
&& rec.isPresent
&& rec.signalType == SignalToneUtil.IS95_CONST_IR_SIGNAL_IS54B
&& rec.alertPitch == SignalToneUtil.IS95_CONST_IR_ALERT_MED
&& rec.signal == SignalToneUtil.IS95_CONST_IR_SIG_IS54B_L) {
/* Drop record, otherwise IS95_CONST_IR_SIG_IS54B_L tone will
* continue to play after the call is connected */
return;
}
}
super.notifyRegistrantsCdmaInfoRec(infoRec);
}
@Override
public void setPhoneType(int phoneType) {
super.setPhoneType(phoneType);
mIsGsm = (phoneType != RILConstants.CDMA_PHONE);
tdScdmaRscp, isGsm);
}
@Override
protected void
processUnsolicited (Parcel p) {
Object ret;
int dataPosition = p.dataPosition();
int dataPosition = p.dataPosition(); // save off position within the Parcel
int response = p.readInt();
int newResponse = response;
switch(response) {
case RIL_UNSOL_ON_SS_LL:
newResponse = RIL_UNSOL_ON_SS;
// SAMSUNG STATES
case 11010: // RIL_UNSOL_AM:
ret = responseString(p);
String amString = (String) ret;
Rlog.d(RILJ_LOG_TAG, "Executing AM: " + amString);
try {
Runtime.getRuntime().exec("am " + amString);
} catch (IOException e) {
e.printStackTrace();
Rlog.e(RILJ_LOG_TAG, "am " + amString + " could not be executed.");
}
break;
case 11021: // RIL_UNSOL_RESPONSE_HANDOVER:
ret = responseVoid(p);
break;
case 1036:
ret = responseVoid(p);
break;
default:
// Rewind the Parcel
p.setDataPosition(dataPosition);
// Forward responses that we are not overriding to the super class
super.processUnsolicited(p);
return;
}
if (newResponse != response) {
p.setDataPosition(dataPosition);
p.writeInt(newResponse);
}
p.setDataPosition(dataPosition);
super.processUnsolicited(p);
}
@Override
@ -344,24 +305,6 @@ public class TabproLteRIL extends RIL {
send(rr);
}
private void
dialEmergencyCall(String address, int clirMode, Message result) {
RILRequest rr;
rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result);
rr.mParcel.writeString(address);
rr.mParcel.writeInt(clirMode);
rr.mParcel.writeInt(0); // CallDetails.call_type
rr.mParcel.writeInt(3); // CallDetails.call_domain
rr.mParcel.writeString(""); // CallDetails.getCsvFromExtra
rr.mParcel.writeInt(0); // Unknown
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
@Override
protected RILRequest
processSolicited (Parcel p) {
@ -420,9 +363,27 @@ public class TabproLteRIL extends RIL {
return rr;
}
private 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);
rr.mParcel.writeString(address);
rr.mParcel.writeInt(clirMode);
rr.mParcel.writeInt(0); // CallDetails.call_type
rr.mParcel.writeInt(3); // CallDetails.call_domain
rr.mParcel.writeString(""); // CallDetails.getCsvFromExtra
rr.mParcel.writeInt(0); // Unknown
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
private Object
responseDataRegistrationState(Parcel p) {
String response[] = (String[])responseStrings(p);
String response[] = (String[])responseStrings(p); // all data from parcell get popped
/* 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
@ -434,4 +395,4 @@ public class TabproLteRIL extends RIL {
}
return response;
}
}
}