This commit is contained in:
Valera1978 2017-07-12 12:46:27 +03:00
parent dbcd309d69
commit 81b16143de
6 changed files with 180 additions and 115 deletions

47
include/samsung_consumerir.h Executable file
View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2016 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.
*/
#ifndef SAMSUNG_CONSUMERIR_H
#define SAMSUNG_CONSUMERIR_H
/*
* Board specific nodes
*
* If your kernel exposes these controls in another place, you can either
* symlink to the locations given here, or override this header in your
* device tree.
*/
#define IR_PATH "/sys/class/sec/sec_ir/ir_send"
/*
* Board specific configs
*
* If your device needs a different configuration, you
* can override this header in your device tree
*/
// Some devices need MS_IR_SIGNAL to avoid ms to pulses conversionn
#define MS_IR_SIGNAL
static const consumerir_freq_range_t consumerir_freqs[] = {
{.min = 30000, .max = 30000},
{.min = 33000, .max = 33000},
{.min = 36000, .max = 36000},
{.min = 38000, .max = 38000},
{.min = 40000, .max = 40000},
{.min = 56000, .max = 56000},
};
#endif // SAMSUNG_CONSUMERIR_H

View File

@ -7,10 +7,6 @@
"repository": "android_device_samsung_msm8974-common",
"target_path": "device/samsung/msm8974-common"
},
{
"repository": "android_kernel_samsung_viennalte",
"target_path": "kernel/samsung/viennalte"
},
{
"repository": "android_external_stlport",
"target_path": "external/stlport"

View File

@ -1,8 +1,5 @@
/*
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2006 The Android Open Source Project
* Copyright (c) 2014, The CyanogenMod Project. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,55 +19,73 @@ 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 java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
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;
/**
* RIL customization for tabpro LTE devices
* RIL customization for Galaxy S5 (GSM) LTE devices
*
* {@hide}
*/
public class TabproLteRIL extends RIL {
public class NoteProRIL extends RIL {
private static final int RIL_REQUEST_DIAL_EMERGENCY = 10016;
private static final int RIL_UNSOL_ON_SS_LL = 11055;
public TabproLteRIL(Context context, int networkMode, int cdmaSubscription) {
private boolean mIsGsm = false;
public NoteProRIL(Context context, int networkMode, int cdmaSubscription) {
super(context, networkMode, cdmaSubscription, null);
mQANElements = 6;
}
public TabproLteRIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) {
super(context, networkMode, cdmaSubscription, instanceId);
public NoteProRIL(Context context, int preferredNetworkType,
int cdmaSubscription, Integer instanceId) {
super(context, preferredNetworkType, cdmaSubscription, instanceId);
mQANElements = 6;
}
private void
fixNitz(Parcel p) {
int dataPosition = p.dataPosition();
String nitz = p.readString();
long nitzReceiveTime = p.readLong();
String[] nitzParts = nitz.split(",");
if (nitzParts.length >= 4) {
// 0=date, 1=time+zone, 2=dst, 3(+)=garbage that confuses ServiceStateTracker
nitz = nitzParts[0] + "," + nitzParts[1] + "," + nitzParts[2];
p.setDataPosition(dataPosition);
p.writeString(nitz);
p.writeLong(nitzReceiveTime);
// The string is shorter now, drop the extra bytes
p.setDataSize(p.dataPosition());
}
}
@Override
public void
dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
if (PhoneNumberUtils.isEmergencyNumber(address)) {
dialEmergencyCall(address, clirMode, result);
return;
}
RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
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
@ -89,7 +104,7 @@ public class TabproLteRIL extends RIL {
@Override
protected Object
responseIccCardStatus(Parcel p) {
IccCardApplicationStatus appStatus = null;
IccCardApplicationStatus appStatus;
IccCardStatus cardStatus = new IccCardStatus();
cardStatus.setCardState(p.readInt());
@ -106,8 +121,11 @@ public class TabproLteRIL extends RIL {
}
cardStatus.mApplications = new IccCardApplicationStatus[numApplications];
appStatus = new IccCardApplicationStatus();
for (int i = 0 ; i < numApplications ; i++) {
appStatus = new IccCardApplicationStatus();
if (i!=0) {
appStatus = new IccCardApplicationStatus();
}
appStatus.app_type = appStatus.AppTypeFromRILInt(p.readInt());
appStatus.app_state = appStatus.AppStateFromRILInt(p.readInt());
appStatus.perso_substate = appStatus.PersoSubstateFromRILInt(p.readInt());
@ -116,15 +134,43 @@ 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
p.readInt(); // puk2_num_retries
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;
}
@ -148,7 +194,6 @@ 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());
@ -156,7 +201,6 @@ 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
@ -165,7 +209,6 @@ 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) {
@ -213,83 +256,73 @@ public class TabproLteRIL extends RIL {
}
@Override
protected Object
responseSignalStrength(Parcel p) {
int gsmSignalStrength = p.readInt() & 0xff;
int gsmBitErrorRate = p.readInt();
int cdmaDbm = p.readInt();
int cdmaEcio = p.readInt();
int evdoDbm = p.readInt();
int evdoEcio = p.readInt();
int evdoSnr = p.readInt();
int lteSignalStrength = p.readInt();
int lteRsrp = p.readInt();
int lteRsrq = p.readInt();
int lteRssnr = p.readInt();
int lteCqi = p.readInt();
int tdScdmaRscp = p.readInt();
// constructor sets default true, makeSignalStrengthFromRilParcel does not set it
boolean isGsm = true;
protected Object responseSignalStrength(Parcel p) {
int numInts = 12;
int response[];
if ((lteSignalStrength & 0xff) == 255 || lteSignalStrength == 99) {
lteSignalStrength = 99;
lteRsrp = SignalStrength.INVALID;
lteRsrq = SignalStrength.INVALID;
lteRssnr = SignalStrength.INVALID;
lteCqi = SignalStrength.INVALID;
} else {
lteSignalStrength &= 0xff;
// Get raw data
response = new int[numInts];
for (int i = 0; i < numInts; i++) {
response[i] = p.readInt();
}
//gsm
response[0] &= 0xff;
//cdma
response[2] %= 256;
response[4] %= 256;
response[7] &= 0xff;
if (RILJ_LOGD)
riljLog("gsmSignalStrength:" + gsmSignalStrength + " gsmBitErrorRate:" + gsmBitErrorRate +
" cdmaDbm:" + cdmaDbm + " cdmaEcio:" + cdmaEcio + " evdoDbm:" + evdoDbm +
" evdoEcio: " + evdoEcio + " evdoSnr:" + evdoSnr +
" lteSignalStrength:" + lteSignalStrength + " lteRsrp:" + lteRsrp +
" lteRsrq:" + lteRsrq + " lteRssnr:" + lteRssnr + " lteCqi:" + lteCqi +
" tdScdmaRscp:" + tdScdmaRscp + " isGsm:" + (isGsm ? "true" : "false"));
return new SignalStrength(response[0], response[1], response[2], response[3], response[4], response[5], response[6], response[7], response[8], response[9], response[10], response[11], true);
return new SignalStrength(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio, evdoDbm,
evdoEcio, evdoSnr, lteSignalStrength, lteRsrp, lteRsrq, lteRssnr, lteCqi,
tdScdmaRscp, isGsm);
}
@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);
}
@Override
protected void
processUnsolicited (Parcel p, int type) {
Object ret;
int dataPosition = p.dataPosition(); // save off position within the Parcel
int dataPosition = p.dataPosition();
int response = p.readInt();
int newResponse = response;
switch(response) {
// 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.");
}
case RIL_UNSOL_NITZ_TIME_RECEIVED:
fixNitz(p);
break;
case 11021: // RIL_UNSOL_RESPONSE_HANDOVER:
ret = responseVoid(p);
case RIL_UNSOL_ON_SS_LL:
newResponse = RIL_UNSOL_ON_SS;
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, type);
return;
}
if (newResponse != response) {
p.setDataPosition(dataPosition);
p.writeInt(newResponse);
}
p.setDataPosition(dataPosition);
super.processUnsolicited(p, type);
}
@Override
@ -364,27 +397,9 @@ 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); // all data from parcell get popped
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

View File

@ -35,6 +35,13 @@
/data/data/com.android.providers.telephony/databases(/.*)? u:object_r:radio_data_file:s0
/data/data/com.android.providers.telephony/shared_prefs(/.*)? u:object_r:radio_data_file:s0
# RIL - Variant Blobs
/system/blobs/(.*)/bin/ks u:object_r:mdm_helper_exec:s0
/system/blobs/(.*)/bin/qmuxd u:object_r:qmuxd_exec:s0
/system/blobs/(.*)/bin/rfs_access u:object_r:rfs_access_exec:s0
/system/blobs/(.*)/bin/rild u:object_r:rild_exec:s0
/system/blobs/(.*)/bin/rmt_storage u:object_r:rmt_storage_exec:s0
# SEC
/sys/devices/virtual/sec/sec_key/hall_irq_ctrl u:object_r:sysfs_sec:s0
/sys/devices/virtual/sec/tsp(/.*)? u:object_r:sysfs_sec:s0

View File

@ -1,2 +1,3 @@
allow init sysfs_sec:lnk_file r_file_perms;
allow init debugfs:file write;
allow init socket_device:sock_file { create write setattr };

View File

@ -1 +0,0 @@
allow rmt_storage self:capability dac_override;