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

Commit 873f5a86 authored by Shareef Ali's avatar Shareef Ali
Browse files

SamsungQcomRIL: New class and get rid of old and outdated codes

Consolidate the RIL and base on the CDMA RIL
Now inherit class related to the Samsung Qualcomm family

Special thanks to Dan Pasanen for coninuing the patcheset
while my macbook was in repair.

* Rebase on standard ril
* samsungDriverCall now handled in the superclass

* Supports:
  * Quad-core Exynos4 with Qualcomm modem and later
  * Snapdragon S3 and later

Change-Id: Ie593e32087a9bfeb5d16802a10c2739cf1061676
parent 8f5a3806
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -178,17 +178,4 @@ public class HTCQualcommRIL extends RIL implements CommandsInterface {
            }
        }
    }

    /**
     * Notify all registrants that the ril has connected or disconnected.
     *
     * @param rilVer is the version of the ril or -1 if disconnected.
     */
    private void notifyRegistrantsRilConnectionChanged(int rilVer) {
        mRilVersion = rilVer;
        if (mRilConnectedRegistrants != null) {
            mRilConnectedRegistrants.notifyRegistrants(
                                new AsyncResult (null, new Integer(rilVer), null));
        }
    }
}
+0 −13
Original line number Diff line number Diff line
@@ -616,19 +616,6 @@ public class QualcommSharedRIL extends RIL implements CommandsInterface {
        }
    }

    /**
     * Notify all registrants that the ril has connected or disconnected.
     *
     * @param rilVer is the version of the ril or -1 if disconnected.
     */
    private void notifyRegistrantsRilConnectionChanged(int rilVer) {
        mRilVersion = rilVer;
        if (mRilConnectedRegistrants != null) {
            mRilConnectedRegistrants.notifyRegistrants(
                                new AsyncResult (null, new Integer(rilVer), null));
        }
    }

    private void setRadioStateFromRILInt (int stateCode) {
        CommandsInterface.RadioState radioState;
        HandlerThread handlerThread;
+4 −1
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    static final String LOG_TAG = "RILJ";
    static final boolean RILJ_LOGD = true;
    static final boolean RILJ_LOGV = false; // STOP SHIP if true
    protected boolean samsungDriverCall = false;

    /**
     * Wake lock timeout should be longer than the longest timeout in
@@ -2968,7 +2969,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
     *
     * @param rilVer is the version of the ril or -1 if disconnected.
     */
    private void notifyRegistrantsRilConnectionChanged(int rilVer) {
    protected void notifyRegistrantsRilConnectionChanged(int rilVer) {
        mRilVersion = rilVer;
        if (mRilConnectedRegistrants != null) {
            mRilConnectedRegistrants.notifyRegistrants(
@@ -3198,6 +3199,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
            dc.als = p.readInt();
            voiceSettings = p.readInt();
            dc.isVoice = (0 == voiceSettings) ? false : true;
            if(samsungDriverCall)
                 p.readInt();
            dc.isVoicePrivacy = (0 != p.readInt());
            dc.number = p.readString();
            int np = p.readInt();
+0 −13
Original line number Diff line number Diff line
@@ -740,19 +740,6 @@ public class SamsungExynos4RIL extends RIL implements CommandsInterface {
        riljLogv("[UNSL]< " + samsungResponseToString(response) + " " + retToString(response, ret));
    }

    /**
     * Notifiy all registrants that the ril has connected or disconnected.
     *
     * @param rilVer is the version of the ril or -1 if disconnected.
     */
    private void notifyRegistrantsRilConnectionChanged(int rilVer) {
        mRilVersion = rilVer;
        if (mRilConnectedRegistrants != null) {
            mRilConnectedRegistrants.notifyRegistrants(
                                new AsyncResult (null, new Integer(rilVer), null));
        }
    }

    /**
     * Set audio parameter "wb_amr" for HD-Voice (Wideband AMR).
     *
+1 −91
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import java.util.ArrayList;
 *
 * {@hide}
 */
public class SamsungQualcommM3RIL extends SamsungQualcommUiccRIL implements CommandsInterface {
public class SamsungQualcommM3RIL extends SamsungQualcommRIL implements CommandsInterface {

    public SamsungQualcommM3RIL(Context context, int networkMode, int cdmaSubscription) {
        super(context, networkMode, cdmaSubscription);
@@ -91,94 +91,4 @@ public class SamsungQualcommM3RIL extends SamsungQualcommUiccRIL implements Comm
        }
    }

    @Override
    protected Object
    responseCallList(Parcel p) {
        int num;
        boolean isVideo;
        ArrayList<DriverCall> response;
        DriverCall dc;
        int dataAvail = p.dataAvail();
        int pos = p.dataPosition();
        int size = p.dataSize();

        Log.d(LOG_TAG, "Parcel size = " + size);
        Log.d(LOG_TAG, "Parcel pos = " + pos);
        Log.d(LOG_TAG, "Parcel dataAvail = " + dataAvail);

        //Samsung changes
        num = p.readInt();

        Log.d(LOG_TAG, "num = " + num);
        response = new ArrayList<DriverCall>(num);

        for (int i = 0 ; i < num ; i++) {

            dc                      = new DriverCall();
            dc.state                = DriverCall.stateFromCLCC(p.readInt());
            dc.index                = p.readInt();
            dc.TOA                  = p.readInt();
            dc.isMpty               = (0 != p.readInt());
            dc.isMT                 = (0 != p.readInt());
            dc.als                  = p.readInt();
            dc.isVoice              = (0 != p.readInt());
            isVideo                 = (0 != p.readInt());
            dc.isVoicePrivacy       = (0 != p.readInt());
            dc.number               = p.readString();
            int np                  = p.readInt();
            dc.numberPresentation   = DriverCall.presentationFromCLIP(np);
            dc.name                 = p.readString();
            dc.namePresentation     = p.readInt();
            int uusInfoPresent      = p.readInt();

            Log.d(LOG_TAG, "state = " + dc.state);
            Log.d(LOG_TAG, "index = " + dc.index);
            Log.d(LOG_TAG, "state = " + dc.TOA);
            Log.d(LOG_TAG, "isMpty = " + dc.isMpty);
            Log.d(LOG_TAG, "isMT = " + dc.isMT);
            Log.d(LOG_TAG, "als = " + dc.als);
            Log.d(LOG_TAG, "isVoice = " + dc.isVoice);
            Log.d(LOG_TAG, "isVideo = " + isVideo);
            Log.d(LOG_TAG, "number = " + dc.number);
            Log.d(LOG_TAG, "np = " + np);
            Log.d(LOG_TAG, "name = " + dc.name);
            Log.d(LOG_TAG, "namePresentation = " + dc.namePresentation);
            Log.d(LOG_TAG, "uusInfoPresent = " + uusInfoPresent);

            if (uusInfoPresent == 1) {
                dc.uusInfo = new UUSInfo();
                dc.uusInfo.setType(p.readInt());
                dc.uusInfo.setDcs(p.readInt());
                byte[] userData = p.createByteArray();
                dc.uusInfo.setUserData(userData);
                Log
                .v(LOG_TAG, String.format("Incoming UUS : type=%d, dcs=%d, length=%d",
                        dc.uusInfo.getType(), dc.uusInfo.getDcs(),
                        dc.uusInfo.getUserData().length));
                Log.v(LOG_TAG, "Incoming UUS : data (string)="
                        + new String(dc.uusInfo.getUserData()));
                Log.v(LOG_TAG, "Incoming UUS : data (hex): "
                        + IccUtils.bytesToHexString(dc.uusInfo.getUserData()));
            } else {
                Log.v(LOG_TAG, "Incoming UUS : NOT present!");
            }

            // Make sure there's a leading + on addresses with a TOA of 145
            dc.number = PhoneNumberUtils.stringFromStringAndTOA(dc.number, dc.TOA);

            response.add(dc);

            if (dc.isVoicePrivacy) {
                mVoicePrivacyOnRegistrants.notifyRegistrants();
                Log.d(LOG_TAG, "InCall VoicePrivacy is enabled");
            } else {
                mVoicePrivacyOffRegistrants.notifyRegistrants();
                Log.d(LOG_TAG, "InCall VoicePrivacy is disabled");
            }
        }

        Collections.sort(response);

        return response;
    }
}
Loading