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

Commit f860a3f4 authored by Wink Saville's avatar Wink Saville
Browse files

Fake sim status changed appropriately

On a VZW GN if we always do ENTER_SIM_PIN the GET_SIM_STATUS comes so
quickly that it causes the SIMRecords to return an operator.numeric of
666666 instead of 311480. To fix this we only fake sim status changed
when an error occurs on the CHANGE/ENTER SIM_PIN/PIN2. Also, faking on
RIL_REQUEST_SET_FACILITY_LOCK on errors so on a VZW GN we automatically
go to the main lock screen when the PUK is needed,

Finally, on VZN GN RIL_REQUEST_ENTER_SIM_PUK we need to always fake
RIL_RESPONSE_UNSOL_SIM_STATUS_CHANGED, otherwise we won't automatically
leave the main lock screen when we enter the correct PUK. I also do this
for RIL_REQUEST_ENTER_SIM_PUK2 for consistency.

Bug: 7255789
Change-Id: I712cc5020970317922f0c3d686c621a6abcd552c
parent be3dc4b0
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -2347,26 +2347,39 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            }
        }

        // Some devices do not send RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED so fake it.
        // See b/7255789
        // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789.
        // This is needed otherwise we don't automatically transition to the main lock
        // screen when the pin or puk is entered incorrectly.
        switch (rr.mRequest) {
            case RIL_REQUEST_ENTER_SIM_PIN:
            case RIL_REQUEST_ENTER_SIM_PUK:
            case RIL_REQUEST_ENTER_SIM_PIN2:
            case RIL_REQUEST_ENTER_SIM_PUK2:
                if (mIccStatusChangedRegistrants != null) {
                    if (RILJ_LOGD) {
                        riljLog("ON enter sim puk fakeSimStatusChanged: reg count="
                                + mIccStatusChangedRegistrants.size());
                    }
                    mIccStatusChangedRegistrants.notifyRegistrants();
                }
                break;
        }

        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("fakeSimStatusChanged: reg count="
                            riljLog("ON some errors fakeSimStatusChanged: reg count="
                                    + mIccStatusChangedRegistrants.size());
                        }
                if (mIccStatusChangedRegistrants != null) {
                        mIccStatusChangedRegistrants.notifyRegistrants();
                    }
                    break;
            }

        if (error != 0) {
            rr.onError(error, ret);
            rr.release();
            return;