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

Commit b1db5392 authored by Banavathu, Srinivas Naik's avatar Banavathu, Srinivas Naik Committed by Linux Build Service Account
Browse files

Telephony: Update CF number in EF_CFIS.

When call forwarding is enabled, only status is updated in EF_CFIS.
CF number is not updated. Added support to update CF number as well.

Change-Id: I413a3b4000ee174461ba0df3dd65cbb4d7af5fbf
parent 923e86d4
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -124,7 +124,13 @@ public class GSMPhone extends PhoneBase {
    protected String mImeiSv;
    private String mVmNumber;


    // Create Cfu (Call forward unconditional) so that dialling number &
    // mOnComplete (Message object passed by client) can be packed &
    // given as a single Cfu object as user data to RIL.
    private class Cfu {
        String mSetCfNumber;
        Message mOnComplete;
    }
    // Constructors

    public
@@ -1019,8 +1025,11 @@ public class GSMPhone extends PhoneBase {

            Message resp;
            if (commandInterfaceCFReason == CF_REASON_UNCONDITIONAL) {
                Cfu cfu = new Cfu();
                cfu.mSetCfNumber = dialingNumber;
                cfu.mOnComplete = onComplete;
                resp = obtainMessage(EVENT_SET_CALL_FORWARD_DONE,
                        isCfEnable(commandInterfaceCFAction) ? 1 : 0, 0, onComplete);
                        isCfEnable(commandInterfaceCFAction) ? 1 : 0, 0, cfu);
            } else {
                resp = onComplete;
            }
@@ -1356,13 +1365,13 @@ public class GSMPhone extends PhoneBase {
            case EVENT_SET_CALL_FORWARD_DONE:
                ar = (AsyncResult)msg.obj;
                IccRecords r = mIccRecords.get();
                Cfu cfu = (Cfu) ar.userObj;
                if (ar.exception == null && r != null) {
                    r.setVoiceCallForwardingFlag(1, msg.arg1 == 1);
                    r.setVoiceCallForwardingFlag(1, msg.arg1 == 1, cfu.mSetCfNumber);
                }
                onComplete = (Message) ar.userObj;
                if (onComplete != null) {
                    AsyncResult.forMessage(onComplete, ar.result, ar.exception);
                    onComplete.sendToTarget();
                if (cfu.mOnComplete != null) {
                    AsyncResult.forMessage(cfu.mOnComplete, ar.result, ar.exception);
                    cfu.mOnComplete.sendToTarget();
                }
                break;

@@ -1568,7 +1577,8 @@ public class GSMPhone extends PhoneBase {
            } else {
                for (int i = 0, s = infos.length; i < s; i++) {
                    if ((infos[i].serviceClass & SERVICE_CLASS_VOICE) != 0) {
                        r.setVoiceCallForwardingFlag(1, (infos[i].status == 1));
                        r.setVoiceCallForwardingFlag(1, (infos[i].status == 1),
                            infos[i].number);
                        // should only have the one
                        break;
                    }
+2 −2
Original line number Diff line number Diff line
@@ -1059,7 +1059,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                if ((ar.exception == null) && (msg.arg1 == 1)) {
                    boolean cffEnabled = (msg.arg2 == 1);
                    if (mIccRecords != null) {
                        mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled);
                        mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled, mDialingNumber);
                    }
                }

@@ -1416,7 +1416,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                        == CommandsInterface.SERVICE_CLASS_VOICE) {
            boolean cffEnabled = (info.status == 1);
            if (mIccRecords != null) {
                mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled);
                mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled, info.number);
            }
        }

+10 −0
Original line number Diff line number Diff line
@@ -475,6 +475,16 @@ public abstract class IccRecords extends Handler implements IccConstants {
    public void setVoiceCallForwardingFlag(int line, boolean enable) {
    }

    /**
     * Set the voice call forwarding flag for GSM/UMTS and the like SIMs
     *
     * @param line to enable/disable
     * @param enable
     * @param number to which CFU is enabled
     */
    public void setVoiceCallForwardingFlag(int line, boolean enable, String number) {
    }

    /**
     * Indicates wether SIM is in provisioned state or not.
     * Overridden only if SIM can be dynamically provisioned via OTA.
+29 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.AsyncResult;
import android.os.Message;
import android.os.SystemProperties;
import android.telephony.MSimTelephonyManager;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.telephony.Rlog;
import android.util.Log;
@@ -131,6 +132,13 @@ public class SIMRecords extends IccRecords {
    private static final int CPHS_SST_MBN_MASK = 0x30;
    private static final int CPHS_SST_MBN_ENABLED = 0x30;

    // EF_CFIS related constants
    // Spec reference TS 51.011 section 10.3.46.
    private static final int CFIS_BCD_NUMBER_LENGTH_OFFSET = 2;
    private static final int CFIS_TON_NPI_OFFSET = 3;
    private static final int CFIS_ADN_CAPABILITY_ID_OFFSET = 14;
    private static final int CFIS_ADN_EXTENSION_ID_OFFSET = 15;

    // ***** Event Constants
    private static final int EVENT_GET_IMSI_DONE = 3;
    private static final int EVENT_GET_ICCID_DONE = 4;
@@ -502,6 +510,15 @@ public class SIMRecords extends IccRecords {
     */
    @Override
    public void setVoiceCallForwardingFlag(int line, boolean enable) {
        setVoiceCallForwardingFlag(line, enable, null);
    }

    /**
     * {@inheritDoc}
     * {@hide}
     */
    @Override
    public void setVoiceCallForwardingFlag(int line, boolean enable, String dialNumber) {

        if (line != 1) return; // only line 1 is supported

@@ -521,8 +538,18 @@ public class SIMRecords extends IccRecords {
                log("setVoiceCallForwardingFlag: enable=" + enable
                        + " mEfCfis=" + IccUtils.bytesToHexString(mEfCfis));

                // TODO: Should really update other fields in EF_CFIS, eg,
                // dialing number.  We don't read or use it right now.
                // Update dialNumber if not empty and CFU is enabled.
                // Spec reference for EF_CFIS contents, TS 51.011 section 10.3.46.
                if (enable && !TextUtils.isEmpty(dialNumber)) {
                    Log.i(LOG_TAG, "EF_CFIS: updating cf number, " + dialNumber);
                    byte[] bcdNumber = PhoneNumberUtils.numberToCalledPartyBCD(dialNumber);

                    System.arraycopy(bcdNumber, 0, mEfCfis, CFIS_TON_NPI_OFFSET, bcdNumber.length);

                    mEfCfis[CFIS_BCD_NUMBER_LENGTH_OFFSET] = (byte) (bcdNumber.length);
                    mEfCfis[CFIS_ADN_CAPABILITY_ID_OFFSET] = (byte) 0xFF;
                    mEfCfis[CFIS_ADN_EXTENSION_ID_OFFSET] = (byte) 0xFF;
                }

                mFh.updateEFLinearFixed(
                        EF_CFIS, 1, mEfCfis, null,