From 2b3890b31e0568f638591acc3dcbf114ca71189d Mon Sep 17 00:00:00 2001 From: Valera1978 Date: Sat, 23 Jan 2016 13:32:48 +0300 Subject: [PATCH] Update ril - fix switch network type. --- .../base/core/res/res/values/config.xml | 7 + .../internal/telephony/TabproLteRIL.java | 181 +++++++----------- 2 files changed, 78 insertions(+), 110 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 22e866c..dc8fae6 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -285,4 +285,11 @@ 19dip + + + GSM|WCDMA|LTE + diff --git a/ril/telephony/java/com/android/internal/telephony/TabproLteRIL.java b/ril/telephony/java/com/android/internal/telephony/TabproLteRIL.java index 3559ab9..3f279eb 100755 --- a/ril/telephony/java/com/android/internal/telephony/TabproLteRIL.java +++ b/ril/telephony/java/com/android/internal/telephony/TabproLteRIL.java @@ -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; } -} +} \ No newline at end of file