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

Commit c901f3c0 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

LGEQualcommRIL: Fix PIN status for e73x

The QUERY_FACILITY_LOCK call is completely broken on the e730/739
when the SIM card status (SC) is requested.
Instead of letting it go through (and fail), use the pin1 status
from the IccCard application to figure out what the lock state is,
and return it as a message to the calling handler.

Change-Id: Iaed16bcb1a3ee71d9e833e4a4ccee423de0593a4
parent f81291fb
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import static com.android.internal.telephony.RILConstants.*;
import android.content.Context;
import android.os.Message;
import android.os.Parcel;
import android.os.AsyncResult;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;

@@ -33,6 +35,7 @@ import java.util.ArrayList;
 */
public class LGEQualcommRIL extends QualcommNoSimReadyRIL implements CommandsInterface {
    protected String mAid;
    protected int mPinState;
    boolean RILJ_LOGV = true;
    boolean RILJ_LOGD = true;

@@ -246,6 +249,13 @@ public class LGEQualcommRIL extends QualcommNoSimReadyRIL implements CommandsInt
        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                    + " aid: " + mAid + " facility: " + facility);

        if (facility.equals("SC") &&
               SystemProperties.get("ro.cm.device").indexOf("e73") == 0) {
            int [] iccstatus = new int[1];
            iccstatus[0] = mPinState;
            AsyncResult.forMessage(response, iccstatus, null);
            response.sendToTarget();
        } else {
            // count strings
            rr.mp.writeInt(4);

@@ -257,6 +267,7 @@ public class LGEQualcommRIL extends QualcommNoSimReadyRIL implements CommandsInt

            send(rr);
        }
    }

    @Override
    public void
@@ -342,6 +353,8 @@ public class LGEQualcommRIL extends QualcommNoSimReadyRIL implements CommandsInt

        IccCardApplication application = status.getApplication(appIndex);
        mAid = application.aid;
        mPinState = (application.pin1 == IccCardStatus.PinState.PINSTATE_DISABLED || 
                     application.pin1 == IccCardStatus.PinState.PINSTATE_UNKNOWN) ? 0 : 1;

        return status;
    }