[LG Optimus 2x] wfd:
Yeah man, according to diff it looks not like "fixed", it more looks like "complete rewrited"

33a34,36
> /* Headset detect stuffs */
> import android.media.AudioManager;
>
50a54,55
>
>	audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
81c86,91
< static final int RIL_UNSOL_LGE_SIM_STATE_CHANGED_NEW = 1061;
---
> static final int RIL_UNSOL_LGE_1X_REG_DONE = 1061;
> static final int RIL_UNSOL_LGE_XCALLSTAT = 1052;
> static final int RIL_UNSOL_LGE_COLP = 1036;
> static final int RIL_UNSOL_LGE_FACTORY_READY = 1080;
>
> static final int RIL_REQUEST_LGE_SET_CPATH=252;
92c102,104
< case 1080: ret = responseVoid(p); break; // RIL_UNSOL_LGE_FACTORY_READY
---
> case RIL_UNSOL_LGE_COLP: ret = responseVoid(p); break;
> case RIL_UNSOL_LGE_XCALLSTAT: ret = responseInts(p); break;
> case RIL_UNSOL_LGE_FACTORY_READY: ret = responseVoid(p); break;
94c106
< case RIL_UNSOL_LGE_SIM_STATE_CHANGED_NEW: ret = responseVoid(p); break;
---
> case RIL_UNSOL_LGE_1X_REG_DONE: ret = responseVoid(p); break;
128c140,155
< case 1080: // RIL_UNSOL_LGE_FACTORY_READY (NG)
---
> case RIL_UNSOL_LGE_XCALLSTAT:
> if (RILJ_LOGD) unsljLogRet(response, ret);
>
> // +XCALLSTAT: 1,2 => LGE_SET_CPATH 3, then send LGE_SET_CPATH 1
> SetupCallCPATH(ret);
> // GET_CURRENT_CALLS [id=1,DIALING,toa=129,norm,mo,0,voc,noevp,,cli=1,,0] => LGE_SET_CPATH 8
> // GET_CURRENT_CALLS [id=1,ALERTING,toa=129,norm,mo,0,voc,noevp,,cli=1,,0] => LGE_SET_CPATH 8
> // GET_CURRENT_CALLS [id=1,ACTIVE,toa=129,norm,mo,0,voc,noevp,,cli=1,,0] => LGE_SET_CPATH 8
> // GET_CURRENT_CALLS } => LGE_SET_CPATH 0
> // +XCALLSTAT: 1,2 => LGE_SET_CPATH 3, then send LGE_SET_CPATH 1
>
> mCallStateRegistrants
> .notifyRegistrants(new AsyncResult(null, null, null));
> break;
>
> case RIL_UNSOL_LGE_FACTORY_READY: // RIL_UNSOL_LGE_FACTORY_READY (NG)
130c157
< RIL_REQUEST_HANG_UP_CALL = 206;
---
> // RIL_REQUEST_HANG_UP_CALL = 206;
133c160
< case RIL_UNSOL_LGE_SIM_STATE_CHANGED_NEW:
---
> case RIL_UNSOL_LGE_1X_REG_DONE:
171a199,255
> @Override
> protected void
> processSolicited (Parcel p) {
> int serial, error;
> int dataPosition = p.dataPosition(); // save off position within the Parcel
>
> serial = p.readInt();
> error = p.readInt();
>
> RILRequest rr;
>
> rr = findAndRemoveRequestFromList(serial);
>
> if (rr == null) {
> riljLog("Unexpected solicited response! sn: " + serial + " error: " + error);
> return;
> }
>
> Object ret = null;
>
> if (error == 0 || p.dataAvail() > 0) {
> // either command succeeds or command fails but with data payload
> switch (rr.mRequest) {
> case RIL_REQUEST_LGE_SET_CPATH: ret = responseVoid(p); break;
> default:
>
>	// recovery the removed request
> synchronized (super.mRequestsList) {
> super.mRequestsList.add(rr);
> super.mRequestMessagesWaiting++;
> }
> // Rewind the Parcel
> p.setDataPosition(dataPosition);
>
> // Forward responses that we are not overriding to the super class
> super.processSolicited(p);
> return;
> }
> }
>
> if (error != 0) {
> rr.onError(error, ret);
> rr.release();
> return;
> }
>
> if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
> + " " + retToString(rr.mRequest, ret));
>
> if (rr.mResult != null) {
> AsyncResult.forMessage(rr.mResult, ret, null);
> rr.mResult.sendToTarget();
> }
>
> rr.release();
> }
>
219a304,395
>	private AudioManager audioManager;
>
> private void
> SetupCallCPATH(Object ret) {
> int CPATH=0;
> int CallState = ((int[])ret)[1];
>
> if (RILJ_LOGD) riljLog(" CALLSTATE=[ " + CallState + "]");
> if(CallState == 2) {
>	// +XCALLSTAT: 1,2 => LGE_SET_CPATH 3, then send LGE_SET_CPATH 1
>	CPATH=3;
>	RILRequest rr = RILRequest.obtain(RIL_REQUEST_LGE_SET_CPATH,null);
>
>	if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + CPATH);
>
>	rr.mp.writeInt(1);
>	rr.mp.writeInt(CPATH);
>	send(rr);
>
>	// normal call: CPATH=1
>	// Headset call: CPATH=2
>	// BT call: isBluetoothA2dpOn()??
>	if (audioManager.isWiredHeadsetOn()==false && audioManager.isBluetoothA2dpOn()==false)
>	CPATH=1;
>	else
>	CPATH=2;
>	RILRequest rr2 = RILRequest.obtain(RIL_REQUEST_LGE_SET_CPATH,null);
>
>	if (RILJ_LOGD) riljLog(rr2.serialString() + "> " + requestToString(rr2.mRequest) + " " + CPATH);
>
>	rr2.mp.writeInt(1);
>	rr2.mp.writeInt(CPATH);
>	send(rr2);
>	}
> }
>
> @Override
> protected Object
> responseCallList(Parcel p) {
> int num;
> int CPATH=0;
> int dataPosition = p.dataPosition(); // save off position within the Parcel
>
> num = p.readInt();
>
> if (num==0)
> {
>	// LGE_SET_CPATH 0
>	CPATH=0;
> }
> else
> if (num>0)
> {
>	// LGE_SET_CPATH 8
>	CPATH=8;
> }
> RILRequest rr = RILRequest.obtain(RIL_REQUEST_LGE_SET_CPATH,null);
>
> if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + CPATH);
>
> rr.mp.writeInt(1);
> rr.mp.writeInt(CPATH);
> send(rr);
>
> // Rewind the Parcel
> p.setDataPosition(dataPosition);
>
> // Forward responses that we are not overriding to the super class
> return super.responseCallList(p);
> }
>
> static String
> requestToString(int request) {
> switch(request) {
> case RIL_REQUEST_LGE_SET_CPATH: return "LGE_SET_CPATH";
> default: return RIL.requestToString(request);
> }
> }
>
> static String
> responseToString(int request)
> {
> switch(request) {
> case RIL_UNSOL_LGE_COLP: return "LGE_COLP";
> case RIL_UNSOL_LGE_XCALLSTAT: return "LGE_XCALLSTAT";
> case RIL_UNSOL_LGE_FACTORY_READY: return "LGE_FACTORY_READY";
> case RIL_UNSOL_LGE_SIM_STATE_CHANGED: return "LGE_SIM_STATE_CHANGED";
> case RIL_UNSOL_LGE_1X_REG_DONE: return "LGE_1X_REG_DONE";
> default: return RIL.responseToString(request);
> }
> }
>