Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ecf3e88 authored by jt1134's avatar jt1134
Browse files

fascinatemtd: misc RIL fixes

configurable with system property ro.ril.samsung_cdma=true
also applicable to Epic 4G, Mesmerize, and Showcase
parent b29e308d
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.storage.StorageManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
@@ -1142,6 +1143,17 @@ public class StatusBarPolicy {
            // If 3G(EV) and 1x network are available than 3G should be
            // displayed, displayed RSSI should be from the EV side.
            // If a voice call is made then RSSI should switch to 1x.

            // Samsung CDMA devices handle signal strength display differently
            // relying only on cdmaDbm - thanks Adr0it for the assistance here
            if (SystemProperties.get("ro.ril.samsung_cdma").equals("true")) {
                final int cdmaDbm = mSignalStrength.getCdmaDbm();
                if (cdmaDbm >= -75) iconLevel = 4;
                else if (cdmaDbm >= -85)  iconLevel = 3;
                else if (cdmaDbm >= -95)  iconLevel = 2;
                else if (cdmaDbm >= -100) iconLevel = 1;
                else iconLevel = 0;
            } else {
                if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
                    iconLevel = getEvdoLevel();
                    if (false) {
@@ -1151,6 +1163,7 @@ public class StatusBarPolicy {
                    iconLevel = getCdmaLevel();
                }
            }
        }
        mPhoneSignalIconId = iconList[iconLevel];
        mService.setIcon("phone_signal", mPhoneSignalIconId, 0);
    }
+4 −0
Original line number Diff line number Diff line
@@ -443,6 +443,10 @@ public abstract class DataConnection extends HierarchicalStateMachine {
                result = SetupResult.ERR_Other;
            }
        }
        // Samsung CDMA devices require this property to be set
        // so that pppd will be called to start 3G data
        if (SystemProperties.get("ro.ril.samsung_cdma").equals("true"))
            SystemProperties.set("ril.cdma.data_ready", "true");

        if (DBG) log("DataConnection setup result='" + result + "' on cid=" + cid);
        return result;
+6 −1
Original line number Diff line number Diff line
@@ -1029,6 +1029,11 @@ public class CDMAPhone extends PhoneBase {
                }
                String[] respId = (String[])ar.result;
                mEsn  =  respId[2];
                // Samsung CDMA devices' MEID is not found in this parcel
                // instead, extract it from system properties
                if (SystemProperties.get("ro.ril.samsung_cdma").equals("true"))
                    mMeid = SystemProperties.get("ro.ril.MEID");
                else
                    mMeid =  respId[3];
            }
            break;
+4 −0
Original line number Diff line number Diff line
@@ -382,6 +382,10 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
        }

        setState(State.DISCONNECTING);
        // Samsung CDMA devices require this property to be set
        // so that pppd will be killed to stop 3G data
        if (SystemProperties.get("ro.ril.samsung_cdma").equals("true"))
            SystemProperties.set("ril.cdma.data_ready", "false");

        boolean notificationDeferred = false;
        for (DataConnection conn : dataConnectionList) {
+52 −9
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
    private ContentResolver cr;
    private String currentCarrier = null;

    private boolean mIsSamsungCdma = SystemProperties.getBoolean("ro.ril.samsung_cdma", false);

    private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
        @Override
        public void onChange(boolean selfChange) {
@@ -364,13 +366,24 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {

                if (states.length > 9) {
                    try {
                        // Samsung CDMA devices provide following states
                        // in hex format as opposed to dec
                        if (states[4] != null) {
                            if (mIsSamsungCdma)
                                baseStationId = Integer.parseInt(states[4], 16);
                            else
                                baseStationId = Integer.parseInt(states[4]);
                        }
                        if (states[5] != null) {
                            if (mIsSamsungCdma)
                                baseStationLatitude = Integer.parseInt(states[5], 16);
                            else
                                baseStationLatitude = Integer.parseInt(states[5]);
                        }
                        if (states[6] != null) {
                            if (mIsSamsungCdma)
                                baseStationLongitude = Integer.parseInt(states[6], 16);
                            else
                                baseStationLongitude = Integer.parseInt(states[6]);
                        }
                        // Some carriers only return lat-lngs of 0,0
@@ -410,7 +423,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {

            if (ar.exception == null) {
                String cdmaSubscription[] = (String[])ar.result;
                if (cdmaSubscription != null && cdmaSubscription.length >= 5) {

                // Samsung CDMA devices have shorter cdmaSubscription parcel
                int SUB_LENGTH = (mIsSamsungCdma) ? 4 : 5;
                if (cdmaSubscription != null && cdmaSubscription.length >= SUB_LENGTH) {
                    mMdn = cdmaSubscription[0];
                    if (cdmaSubscription[1] != null) {
                        String[] sid = cdmaSubscription[1].split(",");
@@ -438,7 +454,14 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                    }
                    Log.d(LOG_TAG,"GET_CDMA_SUBSCRIPTION NID=" + cdmaSubscription[2] );
                    mMin = cdmaSubscription[3];
                    // Samsung CDMA devices' prl is not found in this parcel
                    // instead, extract it from system properties
                    if (mIsSamsungCdma) {
                        String[] prl = (SystemProperties.get("ril.prl_ver_1").split(":"));
                        mPrlVersion = prl[1];
                    } else {
                        mPrlVersion = cdmaSubscription[4];
                    }
                    Log.d(LOG_TAG,"GET_CDMA_SUBSCRIPTION MDN=" + mMdn);
                    //Notify apps subscription info is ready
                    if (cdmaForSubscriptionInfoReadyRegistrants != null) {
@@ -708,13 +731,24 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                        if (states[3] != null) {
                            radioTechnology = Integer.parseInt(states[3]);
                        }
                        // Samsung CDMA devices provide following states
                        // in hex format as opposed to dec
                        if (states[4] != null) {
                            if (mIsSamsungCdma)
                                baseStationId = Integer.parseInt(states[4], 16);
                            else
                                baseStationId = Integer.parseInt(states[4]);
                        }
                        if (states[5] != null) {
                            if (mIsSamsungCdma)
                                baseStationLatitude = Integer.parseInt(states[5], 16);
                            else
                                baseStationLatitude = Integer.parseInt(states[5]);
                        }
                        if (states[6] != null) {
                            if (mIsSamsungCdma)
                                baseStationLongitude = Integer.parseInt(states[6], 16);
                            else
                                baseStationLongitude = Integer.parseInt(states[6]);
                        }
                        // Some carriers only return lat-lngs of 0,0
@@ -1226,7 +1260,16 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
        } else {
            int[] ints = (int[])ar.result;
            int offset = 2;
            int cdmaDbm = (ints[offset] > 0) ? -ints[offset] : -120;

            // Samsung CDMA devices only use cdmaDbm for signal strength
            // parcel is different as well, pull cdmaDbm response correctly
            // all other values are ignored
            int cdmaDbm;
            if (mIsSamsungCdma)
                cdmaDbm = (ints[0] > 0 ) ? -ints[0] : -120;
            else
                cdmaDbm = (ints[offset] > 0) ? -ints[offset] : -120;

            int cdmaEcio = (ints[offset+1] > 0) ? -ints[offset+1] : -160;
            int evdoRssi = (ints[offset+2] > 0) ? -ints[offset+2] : -120;
            int evdoEcio = (ints[offset+3] > 0) ? -ints[offset+3] : -1;