[G2 and Desire Z Q&A, Help & Troubleshooting] guhl99:
Update of the day

I am still working on a procedure to make the Phone application start the unlock procedure again.

First I created a modified version of the PhoneApp that listens to an external trigger to do this but after I created it and it worked on my dev phone I found out, that I can not use this on the G2 because I can not replace the PhoneApp there (signed, ...). I also can not install a parallel PhoneApp because the phone is in exclusive possession of the original PhoneApp and so I would not be able to communicate with the actual phone.

So I turned my focus to the interface between Android and the phone and this is a library that is called libril that is in the sources and communicates with a binary library called libhtc_ril.so that really communicates with the phone.

I can modify and install this library in /system/lib because we got temporary root (but after the next reboot it is gone of course). And i can also load it by killing the service rild and reinitialize the phone startup by killing com.android.phone.

The code below is a snipplet of the logcat after I did all this:

D/RILJ ( 5391): [0015]> GET_SIM_STATUS
D/HTC_RIL ( 5378): (t=1287959188)<< +CREG: 2,3\r\n0\r
D/HTC_RIL ( 5378): (t=1287959188)>> AT+COPS=3,2;+COPS?\r
D/HTC_RIL ( 5378): (t=1287959188)<< +CME ERROR: 30\r
D/HTC_RIL ( 5378): get_nwsel_mode_rsp_handler():fail to get network select mode!
D/RILJ ( 5391): [0013]< REGISTRATION_STATE {3, null, null, 0, null, null, null, null, null, null, null, null, null, 0, 512}
D/RILJ ( 5391): [0014]< QUERY_NETWORK_SELECTION_MODE error: com.android.internal.telephony.CommandException: OP_NOT_ALLOWED_BEFORE_REG_NW
D/RILJ ( 5391): [0016]> QUERY_FACILITY_LOCK
D/RILJ ( 5391): [0017]> GET_CURRENT_CALLS
D/GSM ( 5391): Baseband version: 12.22.60.09bU_26.02.01.15_M2
E/GSM ( 5391): Wrong network type: 0
E/GSM ( 5391): Wrong network type: 0
D/GSM ( 5391): Poll ServiceState done: oldSS=[3 home null null null unknown CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false] newSS=[1 home null null null Unknown CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false] oldGprs=1 newGprs=1 oldType=unknown newType=unknown
D/HTC_RIL ( 5378): ril_func_get_sim_status():called
D/HTC_RIL ( 5378): (t=1287959188)>> AT+CPIN?\r
D/HTC_RIL ( 5378): ril_func_get_facility_lock_setting():called
D/HTC_RIL ( 5378): ril_func_get_call_list():called
D/HTC_RIL ( 5378): (t=1287959188)<< +CPIN: SIM PIN\r\n0\r
D/HTC_RIL ( 5378): get_sim_status_rsp_handler():if_subsidy_lock=0
D/HTC_RIL ( 5378): (t=1287959188)>> AT+CLCK="SC",2\r
I/RILC ( 5378): [COLOR="Red"][B]GUHL[/B][/COLOR]: responseSimStatus called
D/HTC_RIL ( 5378): (t=1287959188)<< +CLCK: 1\r\n0\r
D/RILJ ( 5391): [0015]< GET_SIM_STATUS com.android.internal.telephony.IccCardStatus@44d615b0
D/HTC_RIL ( 5378): ril_func_get_sim_status():called
D/GSM ( 5391): [IccCard] Notify SIM pin or puk locked.
D/HTC_RIL ( 5378): (t=1287959188)>> AT+CPIN?\r
D/RILJ ( 5391): [0016]< QUERY_FACILITY_LOCK {7}
D/HTC_RIL ( 5378): (t=1287959188)<< +CPIN: SIM PIN\r\n0\r
D/GSM ( 5391): [IccCard] Broadcasting intent ACTION_SIM_STATE_CHANGED LOCKED reason PIN

What you can see is that I identified the code where the library reports the SIM status back to the Android OS.

(I inserted a LOGI message with GUHL in it.)

What I intend to do here is not to report the original SIM status back to Android but the Status NETWORK_LOCK and this will then lead to the Sim layer informing the original PhoneApp to start the Unlock procedure.

But this will have to wait till tomorrow because I have to go to bed now as I did not sleep more then 3.5 hours in the last 4 nights.

have fun!