简体   繁体   中英

Android Invoke RIL methods

I am able to expose hidden RIL functions in android. I am able instantiate the RIL class as follows.

RIL objRil = new RIL(getApplicationContext()); //successful
RadioState c = objRil.getRadioState() //is giving radio not available. 

There are many functions which take Message object. for example

Message response= Message.obtain();
objRil.getOperator(response);

but i am getting an error saying message target must not be null. I'm not sure how to pass the parameter.

here is the sample function from source of android which iam trying to invoke.

// C:\Users\SK\AppData\Local\Android\android-sdk\sources\android-22\com\android\internal\telephony\RIL.java


public void  getOperator(Message result) {
    RILRequest rr = RILRequest.obtain(RIL_REQUEST_OPERATOR, result);
    if (RILJ_LOGD) 
         riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
    send(rr);
}

I guess this message object acts like an output parameter. What is right way to invoke this function?

You are getting RADIO_NOT_AVAILABLE response because your RIL object is not "connected" to any RILD process (RIL Deamon)

OPERATOR is a GET message that RIL sends to Baseband processor (MODEM) to detect which which operator the device is registered.

Response should be something like:

RILJ: [1234]> OPERATOR
//PLMN Number, PLMN Long Name, PLMN Short Name
RILJ: [1234]< OPERATOR {31000, Verizon Wireless, Verizon}

However, since your RIL instance is not connected to any RILD process, you will always get RADIO_NOT_AVAILABLE response. I meant, you are sending a GET message but there's no RADIO to answer your GET message.

There's a RILD process running and it is probably connected to RIL.java object created by the system. You can check RIL logs via:

adb logcat -b radio

Dual sim models sometimes has two RILD process (one for each simcard) and two RIL.java instances (one for each simcard).

I'm not sure if create a RIL java instance and connect it to a RILD process is that easy.

Not sure how you can achieve that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM