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

Commit 091568f2 authored by Adrian Muzyka's avatar Adrian Muzyka Committed by android-build-merger
Browse files

Merge "Displaying HD audio indicator for GSM/CDMA calls" am: baada385

am: 502c6c13

Change-Id: Id10eb745d90e1ca3b7c0ca0b9360aa64d27797d3
parents 068076d5 502c6c13
Loading
Loading
Loading
Loading
+27 −1
Original line number Original line Diff line number Diff line
@@ -37,6 +37,30 @@ public class DriverCall implements Comparable<DriverCall> {
        // statements that use this enum
        // statements that use this enum
    }
    }


    /**
     * Audio information
     */
    /** Unspecified audio codec */
    public static final int AUDIO_QUALITY_UNSPECIFIED = 0;
    /** AMR (Narrowband) audio codec */
    public static final int AUDIO_QUALITY_AMR = 1;
    /** AMR (Wideband) audio codec */
    public static final int AUDIO_QUALITY_AMR_WB = 2;
    /** GSM Enhanced Full-Rate audio codec */
    public static final int AUDIO_QUALITY_GSM_EFR = 3;
    /** GSM Full-Rate audio codec */
    public static final int AUDIO_QUALITY_GSM_FR = 4;
    /** GSM Half-Rate audio codec */
    public static final int AUDIO_QUALITY_GSM_HR = 5;
    /** Enhanced Variable rate codec */
    public static final int AUDIO_QUALITY_EVRC = 6;
    /** Enhanced Variable rate codec revision B */
    public static final int AUDIO_QUALITY_EVRC_B = 7;
    /** Enhanced Variable rate codec (Wideband) */
    public static final int AUDIO_QUALITY_EVRC_WB = 8;
    /** Enhanced Variable rate codec (Narrowband) */
    public static final int AUDIO_QUALITY_EVRC_NW = 9;

    public int index;
    public int index;
    public boolean isMT;
    public boolean isMT;
    public State state;     // May be null if unavail
    public State state;     // May be null if unavail
@@ -50,6 +74,7 @@ public class DriverCall implements Comparable<DriverCall> {
    public String name;
    public String name;
    public int namePresentation;
    public int namePresentation;
    public UUSInfo uusInfo;
    public UUSInfo uusInfo;
    public int audioQuality = AUDIO_QUALITY_UNSPECIFIED;


    /** returns null on error */
    /** returns null on error */
    static DriverCall
    static DriverCall
@@ -113,7 +138,8 @@ public class DriverCall implements Comparable<DriverCall> {
                + (isVoice ? "voc" : "nonvoc") + ","
                + (isVoice ? "voc" : "nonvoc") + ","
                + (isVoicePrivacy ? "evp" : "noevp") + ","
                + (isVoicePrivacy ? "evp" : "noevp") + ","
                /*+ "number=" + number */ + ",cli=" + numberPresentation + ","
                /*+ "number=" + number */ + ",cli=" + numberPresentation + ","
                /*+ "name="+ name */ + "," + namePresentation;
                /*+ "name="+ name */ + "," + namePresentation + ","
                + "audioQuality=" + audioQuality;
    }
    }


    public static State
    public static State
+23 −0
Original line number Original line Diff line number Diff line
@@ -141,6 +141,8 @@ public class GsmCdmaConnection extends Connection {
        mParent.attach(this, dc);
        mParent.attach(this, dc);


        fetchDtmfToneDelay(phone);
        fetchDtmfToneDelay(phone);

        setAudioQuality(getAudioQualityFromDC(dc.audioQuality));
    }
    }


    /** This is an MO call, created when dialing */
    /** This is an MO call, created when dialing */
@@ -635,6 +637,17 @@ public class GsmCdmaConnection extends Connection {
            }
            }
        }
        }


        int newAudioQuality = getAudioQualityFromDC(dc.audioQuality);
        if (getAudioQuality() != newAudioQuality) {
            if (Phone.DEBUG_PHONE) {
                log("update: audioQuality # changed!:  "
                        + (newAudioQuality == Connection.AUDIO_QUALITY_HIGH_DEFINITION
                        ? "high" : "standard"));
            }
            setAudioQuality(newAudioQuality);
            changed = true;
        }

        // A null cnapName should be the same as ""
        // A null cnapName should be the same as ""
        if (TextUtils.isEmpty(dc.name)) {
        if (TextUtils.isEmpty(dc.name)) {
            if (!TextUtils.isEmpty(mCnapName)) {
            if (!TextUtils.isEmpty(mCnapName)) {
@@ -927,6 +940,16 @@ public class GsmCdmaConnection extends Connection {
        }
        }
    }
    }


    private int getAudioQualityFromDC(int audioQuality) {
        switch (audioQuality) {
            case DriverCall.AUDIO_QUALITY_AMR_WB:
            case DriverCall.AUDIO_QUALITY_EVRC_NW:
                return Connection.AUDIO_QUALITY_HIGH_DEFINITION;
            default:
                return Connection.AUDIO_QUALITY_STANDARD;
        }
    }

    /**
    /**
     * Set post dial state and acquire wake lock while switching to "started" or "pause"
     * Set post dial state and acquire wake lock while switching to "started" or "pause"
     * state, the wake lock will be released if state switches out of "started" or "pause"
     * state, the wake lock will be released if state switches out of "started" or "pause"
+91 −0
Original line number Original line Diff line number Diff line
@@ -178,6 +178,15 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseCurrentCalls(responseInfo, calls);
        responseCurrentCalls(responseInfo, calls);
    }
    }


    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param calls Current call list
     */
    public void getCurrentCallsResponse_1_2(RadioResponseInfo responseInfo,
                                        ArrayList<android.hardware.radio.V1_2.Call> calls) {
        responseCurrentCalls_1_2(responseInfo, calls);
    }

    /**
    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
     */
@@ -1489,6 +1498,88 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
        }
    }
    }


    private void responseCurrentCalls_1_2(RadioResponseInfo responseInfo,
                                      ArrayList<android.hardware.radio.V1_2.Call> calls) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            int num = calls.size();
            ArrayList<DriverCall> dcCalls = new ArrayList<DriverCall>(num);
            DriverCall dc;

            for (int i = 0; i < num; i++) {
                dc = new DriverCall();
                // TODO: change name of function stateFromCLCC() in DriverCall.java to name
                // clarifying what is CLCC
                dc.state = DriverCall.stateFromCLCC((int) (calls.get(i).base.state));
                dc.index = calls.get(i).base.index;
                dc.TOA = calls.get(i).base.toa;
                dc.isMpty = calls.get(i).base.isMpty;
                dc.isMT = calls.get(i).base.isMT;
                dc.als = calls.get(i).base.als;
                dc.isVoice = calls.get(i).base.isVoice;
                dc.isVoicePrivacy = calls.get(i).base.isVoicePrivacy;
                dc.number = calls.get(i).base.number;
                dc.numberPresentation =
                        DriverCall.presentationFromCLIP(
                                (int) (calls.get(i).base.numberPresentation));
                dc.name = calls.get(i).base.name;
                dc.namePresentation =
                        DriverCall.presentationFromCLIP((int) (calls.get(i).base.namePresentation));
                if (calls.get(i).base.uusInfo.size() == 1) {
                    dc.uusInfo = new UUSInfo();
                    dc.uusInfo.setType(calls.get(i).base.uusInfo.get(0).uusType);
                    dc.uusInfo.setDcs(calls.get(i).base.uusInfo.get(0).uusDcs);
                    if (!TextUtils.isEmpty(calls.get(i).base.uusInfo.get(0).uusData)) {
                        byte[] userData = calls.get(i).base.uusInfo.get(0).uusData.getBytes();
                        dc.uusInfo.setUserData(userData);
                    } else {
                        mRil.riljLog("responseCurrentCalls: uusInfo data is null or empty");
                    }

                    mRil.riljLogv(String.format("Incoming UUS : type=%d, dcs=%d, length=%d",
                            dc.uusInfo.getType(), dc.uusInfo.getDcs(),
                            dc.uusInfo.getUserData().length));
                    mRil.riljLogv("Incoming UUS : data (hex): "
                            + IccUtils.bytesToHexString(dc.uusInfo.getUserData()));
                } else {
                    mRil.riljLogv("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);

                dc.audioQuality = (int) (calls.get(i).audioQuality);

                dcCalls.add(dc);

                if (dc.isVoicePrivacy) {
                    mRil.mVoicePrivacyOnRegistrants.notifyRegistrants();
                    mRil.riljLog("InCall VoicePrivacy is enabled");
                } else {
                    mRil.mVoicePrivacyOffRegistrants.notifyRegistrants();
                    mRil.riljLog("InCall VoicePrivacy is disabled");
                }
            }

            Collections.sort(dcCalls);

            if ((num == 0) && mRil.mTestingEmergencyCall.getAndSet(false)) {
                if (mRil.mEmergencyCallbackModeRegistrant != null) {
                    mRil.riljLog("responseCurrentCalls: call ended, testing emergency call,"
                            + " notify ECM Registrants");
                    mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant();
                }
            }

            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, dcCalls);
            }
            mRil.processResponseDone(rr, responseInfo, dcCalls);
        }
    }


    private void responseVoid(RadioResponseInfo responseInfo) {
    private void responseVoid(RadioResponseInfo responseInfo) {
        RILRequest rr = mRil.processResponse(responseInfo);
        RILRequest rr = mRil.processResponse(responseInfo);