import com.android.internal.telephony.Phone

1,337 views
Skip to first unread message

praveen

unread,
Aug 11, 2010, 6:06:18 AM8/11/10
to android-platform

Hi,
Is there any way by which we can import
com.android.internal.telephony.Phone?
I want to use the invokeOemRilRequestRaw method of Phone
package.
But it is unable to to resolve The
"com.android.internal.telephony cannot be resolved".

Is there any work around available for this?


Thanks,
Praveen

Christopher Tate

unread,
Aug 11, 2010, 2:17:18 PM8/11/10
to android-...@googlegroups.com

No, there is no workaround. Third party applications cannot use
internal or hidden interfaces or packages. Only code built as part of
the OS itself can use things like the com.android.internal.*
implementation.

--
chris tate
android framework engineer

msg555

unread,
Aug 11, 2010, 8:06:08 PM8/11/10
to android-platform


On Aug 11, 2:17 pm, Christopher Tate <ct...@google.com> wrote:
> On Wed, Aug 11, 2010 at 3:06 AM, praveen <kushwaha.prav...@gmail.com> wrote:
>
> > Hi,
> >         Is there any way by which we can import
> > com.android.internal.telephony.Phone?
> >         I want to use the invokeOemRilRequestRaw method of Phone
> > package.
> >         But it is unable to to resolve The
> > "com.android.internal.telephony cannot be resolved".
>
> >         Is there any work around available for this?
>
> No, there is no workaround.  Third party applications cannot use
> internal or hidden interfaces or packages.  Only code built as part of
> the OS itself can use things like the com.android.internal.*
> implementation.
>
Certainly this is not true as i have done it. Obviously if you are
not using the public api there is no guarantee or documentation on
what versions/platforms the functions you want to use will exist in.
To use the functions you are either going to need to use reflection or
add the framework.jar library to your classpath. Note that you will
need the jar to contain .class files to work with javac, not a .dex
file. You can pick up a framework.jar with .class files from the
intermediates folder if you compile the android codebase.

Christopher Tate

unread,
Aug 11, 2010, 8:26:41 PM8/11/10
to android-...@googlegroups.com

This is explicitly not supported. Your code will fail to even load on
some (or many) devices, and worse may fail in obscure ways on others
because the semantics of the methods you're calling will have changed.

Do not attempt to use unpublished functionality; it is not a viable
long-term strategy.

msg555

unread,
Aug 11, 2010, 9:11:19 PM8/11/10
to android-platform
Yes you're right. The semantic changes are perhaps the most concerning
as it's not obvious something is wrong. I understand that it's in
google's interest to not have apps using these hidden libraries but as
a researcher a lot of the interesting functionality can most easily be
implemented using these functions.

In particular I've found many of the @hide functions in Process.java
to be quite useful. I definitely wouldn't suggest using theses
functions if you plan to put your app on the android market.

arun gupta

unread,
Aug 12, 2010, 1:48:00 AM8/12/10
to android-...@googlegroups.com
When u are sending the request for Call or sending the sms or mms the required function is called in RIL.java.
Hope you can see the code and understand.
 
regards
Arun Gupta


 
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Praveen Kushwaha

unread,
Aug 12, 2010, 2:29:06 AM8/12/10
to android-...@googlegroups.com
Hi msg555,
 
         Thanks for your answers.
         Basically I want to sent AT command to modem by using the invokeOemRilRequestRaw method.
            
       So if I add framework.jar library to class path then I will be able to import com.android.internal.telephony.Phone , right?
       Means I will be able to call the  invokeOemRilRequestRaw.
       
I have some questions:
        1. how do I get  framework.jar? Is it possible for emulator?
        2. As I understand framework.jar will be specific to a device. So for every device there will be different provision 
          for accessing framework.jar. So the soltuion will be specific to a device, right?
        
Thanks,
Praveen
                 
 

msg555

unread,
Aug 12, 2010, 11:17:48 PM8/12/10
to android-platform


On Aug 12, 2:29 am, Praveen Kushwaha <kushwaha.prav...@gmail.com>
wrote:
> Hi msg555,
>
>          Thanks for your answers.
>          Basically I want to sent AT command to modem by using the
> invokeOemRilRequestRaw method.
>
>        So if I add framework.jar library to class path then I will be able
> to import com.android.internal.telephony.Phone , right?
>        Means I will be able to call the  invokeOemRilRequestRaw.
>
> I have some questions:
>         1. how do I get  framework.jar? Is it possible for emulator?

You need to download the android code base and compile it. In the the
intermediates folder there will be a framework.jar that contains class
files. That's what you need. If that is too complicated you can just
use reflection and achieve the same result.

>         2. As I understand framework.jar will be specific to a device. So
> for every device there will be different provision
>           for accessing framework.jar. So the soltuion will be specific to a
> device, right?

The answer is sort of. As long as the method exists with the same
name and prototype as what you are trying to access in the target
framework.jar then this solution will work (at least it will not
crash, there may be semantic changes to the function as Christopher
says) assuming it has not become private or something.
> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib e...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages