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

Commit 9b4b0df3 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "SamsungExynos3RIL: fix sim PIN handling" into cm-11.0

parents 4036e712 81c66d13
Loading
Loading
Loading
Loading
+48 −8
Original line number Diff line number Diff line
@@ -286,6 +286,22 @@ public class SamsungExynos3RIL extends RIL implements CommandsInterface {
        }

        if (error != 0) {
            switch (rr.mRequest) {
                case RIL_REQUEST_ENTER_SIM_PIN:
                case RIL_REQUEST_ENTER_SIM_PIN2:
                case RIL_REQUEST_CHANGE_SIM_PIN:
                case RIL_REQUEST_CHANGE_SIM_PIN2:
                case RIL_REQUEST_SET_FACILITY_LOCK:
                    if (mIccStatusChangedRegistrants != null) {
                        if (RILJ_LOGD) {
                            riljLog("ON some errors fakeSimStatusChanged: reg count="
                                    + mIccStatusChangedRegistrants.size());
                        }
                        mIccStatusChangedRegistrants.notifyRegistrants();
                    }
                    break;
            }

            // Ugly fix for Samsung messing up SMS_SEND request fail in binary RIL
            if (error == -1 && rr.mRequest == RIL_REQUEST_SEND_SMS)
            {
@@ -619,14 +635,6 @@ public class SamsungExynos3RIL extends RIL implements CommandsInterface {
    @Override
    protected Object
    responseSignalStrength(Parcel p) {
        // When SIM is PIN-unlocked, the RIL responds with APPSTATE_UNKNOWN and
        // does not follow up with RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED. We
        // notify the system here.
        String state = SystemProperties.get(TelephonyProperties.PROPERTY_SIM_STATE);
        if (!"READY".equals(state) && mIccStatusChangedRegistrants != null && !mIsSamsungCdma) {
            mIccStatusChangedRegistrants.notifyRegistrants();
        }

        int[] response = new int[7];
        for (int i = 0 ; i < 7 ; i++) {
            response[i] = p.readInt();
@@ -664,6 +672,38 @@ public class SamsungExynos3RIL extends RIL implements CommandsInterface {
        return signalStrength;
    }

    @Override
    protected RadioState getRadioStateFromInt(int stateInt) {
        RadioState state;

        /* RIL_RadioState ril.h */
        switch(stateInt) {
            case 0: state = RadioState.RADIO_OFF; break;
            case 1:
            case 2: state = RadioState.RADIO_UNAVAILABLE; break;
            case 4:
                // When SIM is PIN-unlocked, RIL doesn't respond with RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED.
                // We notify the system here.
                Rlog.d(RILJ_LOG_TAG, "SIM is PIN-unlocked now");
                if (mIccStatusChangedRegistrants != null) {
                    mIccStatusChangedRegistrants.notifyRegistrants();
                }
            case 3:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 13: state = RadioState.RADIO_ON; break;

            default:
                throw new RuntimeException(
                                           "Unrecognized RIL_RadioState: " + stateInt);
        }
        return state;
    }

    protected Object
    responseVoiceRegistrationState(Parcel p) {
        String response[] = (String[])responseStrings(p);