/*
* Copyright (C) 2012 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.telephony;
import static com.android.internal.telephony.RILConstants.*;
import android.content.Context;
import android.os.Message;
import android.os.Parcel;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import java.util.ArrayList;
/**
* Custom Qualcomm No SimReady RIL for LGE using the latest Uicc stack
*
* {@hide}
*/
public class LGEQualcommUiccRIL extends QualcommSharedRIL implements CommandsInterface {
boolean RILJ_LOGV = true;
boolean RILJ_LOGD = true;
public LGEQualcommUiccRIL(Context context, int networkMode, int cdmaSubscription) {
super(context, networkMode, cdmaSubscription);
}
/*
@Override
public void
setupDataCall(String radioTechnology, String profile, String apn,
String user, String password, String authType, String protocol,
Message result) {
RILRequest rrSPT = RILRequest.obtain(
121, null); //121 - RIL_REQUEST_VSS_SET_PDN_TABLE
rrSPT.mp.writeInt(1); // pdnId
rrSPT.mp.writeInt(apn.length()); // apnLength
rrSPT.mp.writeString(apn); // apn
rrSPT.mp.writeInt(0); // ipType
rrSPT.mp.writeInt(0); // inactivityTime
rrSPT.mp.writeInt(1); // enable
send(rrSPT);
RILRequest rr
= RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result);
rr.mp.writeInt(7);
rr.mp.writeString(radioTechnology);
rr.mp.writeString(profile);
rr.mp.writeString(apn);
rr.mp.writeString(user);
rr.mp.writeString(password);
rr.mp.writeString(authType);
rr.mp.writeString(protocol);
if (RILJ_LOGD) riljLog(rr.serialString() + "> "
+ requestToString(rr.mRequest) + " " + radioTechnology + " "
+ profile + " " + apn + " " + user + " "
+ password + " " + authType + " " + protocol);
send(rr);
}
*/
@Override
protected Object
responseSetupDataCall(Parcel p) {
DataCallState dataCall;
boolean oldRil = needsOldRilFeature("datacall");
if (!oldRil)
return super.responseSetupDataCall(p);
p.readString();
return super.responseSetupDataCall(p);
}
@Override
protected Object
responseIccCardStatus(Parcel p) {
IccCardApplication ca;
IccCardStatus status = new IccCardStatus();
status.setCardState(p.readInt());
status.setUniversalPinState(p.readInt());
status.setGsmUmtsSubscriptionAppIndex(p.readInt());
status.setCdmaSubscriptionAppIndex(p.readInt());
status.setImsSubscriptionAppIndex(p.readInt());
int numApplications = p.readInt();
// limit to maximum allowed applications
if (numApplications > IccCardStatus.CARD_MAX_APPS) {
numApplications = IccCardStatus.CARD_MAX_APPS;
}
status.setNumApplications(numApplications);
for (int i = 0; i < numApplications; i++) {
ca = new IccCardApplication();
ca.app_type = ca.AppTypeFromRILInt(p.readInt());
ca.app_state = ca.AppStateFromRILInt(p.readInt());
ca.perso_substate = ca.PersoSubstateFromRILInt(p.readInt());
ca.aid = p.readString();
ca.app_label = p.readString();
ca.pin1_replaced = p.readInt();
ca.pin1 = ca.PinStateFromRILInt(p.readInt());
ca.pin2 = ca.PinStateFromRILInt(p.readInt());
p.readInt(); //remaining_count_pin1
p.readInt(); //remaining_count_puk1
p.readInt(); //remaining_count_pin2
p.readInt(); //remaining_count_puk2
status.addApplication(ca);
}
int appIndex = -1;
if (mPhoneType == RILConstants.CDMA_PHONE) {
appIndex = status.getCdmaSubscriptionAppIndex();
Log.d(LOG_TAG, "This is a CDMA PHONE " + appIndex);
} else {
appIndex = status.getGsmUmtsSubscriptionAppIndex();
Log.d(LOG_TAG, "This is a GSM PHONE " + appIndex);
}
if (numApplications > 0) {
IccCardApplication application = status.getApplication(appIndex);
mAid = application.aid;
mUSIM = application.app_type
== IccCardApplication.AppType.APPTYPE_USIM;
mSetPreferredNetworkType = mPreferredNetworkType;
if (TextUtils.isEmpty(mAid))
mAid = "";
Log.d(LOG_TAG, "mAid " + mAid);
}
return status;
}
@Override
protected Object
responseSignalStrength(Parcel p) {
int numInts = 12;
int response[];
boolean oldRil = needsOldRilFeature("signalstrength");
boolean noLte = false;
/* TODO: Add SignalStrength class to match RIL_SignalStrength */
response = new int[numInts];
for (int i = 0 ; i < numInts ; i++) {
if ((oldRil || noLte) && i > 6 && i < 12) {
response[i] = -1;
} else {
response[i] = p.readInt();
}
if (i == 7 && response[i] == 99) {
response[i] = -1;
noLte = true;
}
if (i == 8 && !(noLte || oldRil)) {
response[i] *= -1;
}
}
return response;
}
}