Anyone can give hints on magic "service call" command?

1,472 views
Skip to first unread message

Tim

unread,
Mar 2, 2009, 11:02:27 PM3/2/09
to android-platform
Platform provides an useful command:
~~~~~~~~~~~~~~~~~~~~~
# service
service
Usage: service [-h|-?]
service list
service check SERVICE
service call SERVICE CODE [i32 INT | s16 STR] ...
Options:
i32: Write the integer INT into the send parcel.
s16: Write the UTF-16 string STR into the send parcel.
~~~~~~~~~~~~~~~~~~~~~~

Two guys had given several interesting hints about it:
http://davanum.wordpress.com/2007/12/12/android-calldial-from-the-adb-shell-command-line/
http://discuz-android.blogspot.com/2008/01/change-android-screen-landscapeportrait.html

Till now, I have no idea to know how query the "SERVICE CODE" in
source codes to talk with the running services :(
Anyone can help to explain more about "service call" command? And
especially, what the codes to talk with the audio service.

Thanks. / tim




Tim

unread,
Mar 4, 2009, 9:45:54 AM3/4/09
to android-platform
No one know the "SERVICE CODE"?
Maybe I shall post it to framework group.

On Mar 3, 12:02 pm, Tim <tim.ka...@gmail.com> wrote:
> Platform provides an useful command:
> ~~~~~~~~~~~~~~~~~~~~~
> # service
> service
> Usage: service [-h|-?]
>        service list
>        service check SERVICE
>        service call SERVICE CODE [i32 INT | s16 STR] ...
> Options:
>    i32: Write the integer INT into the send parcel.
>    s16: Write the UTF-16 string STR into the send parcel.
> ~~~~~~~~~~~~~~~~~~~~~~
>
> Two guys had given several interesting hints about it:http://davanum.wordpress.com/2007/12/12/android-calldial-from-the-adb...http://discuz-android.blogspot.com/2008/01/change-android-screen-land...

Dianne Hackborn

unread,
Mar 4, 2009, 5:36:42 PM3/4/09
to android-...@googlegroups.com
It just does a Binder transaction to the given system service.  You can do the same thing in Java (though with a lot less effort) using the ServiceManager to find the named service and making calls on to it.
--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support.  All such questions should be posted on public forums, where I and others can see and answer them.

Tim

unread,
Mar 5, 2009, 5:07:26 AM3/5/09
to android-platform
Thank you Hackborn. I know little about the "Binder transaction" till
now. And just interesting in the tool's usage.
So would you like to directly show the relationship between "SERVICE
CODE" and "Binder transaction"?


On Mar 5, 6:36 am, Dianne Hackborn <hack...@android.com> wrote:
> It just does a Binder transaction to the given system service.  You can do
> the same thing in Java (though with a lot less effort) using the
> ServiceManager to find the named service and making calls on to it.
>
>
>
> On Wed, Mar 4, 2009 at 6:45 AM, Tim <tim.ka...@gmail.com> wrote:
>
> > No one know the "SERVICE CODE"?
> > Maybe I shall post it to framework group.
>
> > On Mar 3, 12:02 pm, Tim <tim.ka...@gmail.com> wrote:
> > > Platform provides an useful command:
> > > ~~~~~~~~~~~~~~~~~~~~~
> > > # service
> > > service
> > > Usage: service [-h|-?]
> > >        service list
> > >        service check SERVICE
> > >        service call SERVICE CODE [i32 INT | s16 STR] ...
> > > Options:
> > >    i32: Write the integer INT into the send parcel.
> > >    s16: Write the UTF-16 string STR into the send parcel.
> > > ~~~~~~~~~~~~~~~~~~~~~~
>
> > > Two guys had given several interesting hints about it:
> >http://davanum.wordpress.com/2007/12/12/android-calldial-from-the-adb....
> > ..
>
> > > Till now, I have no idea to know how query the "SERVICE CODE" in
> > > source codes to talk with the running services :(
> > > Anyone can help to explain more about "service call" command? And
> > > especially, what the codes to talk with the audio service.
>
> > > Thanks. / tim
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com

Dianne Hackborn

unread,
Mar 5, 2009, 3:02:38 PM3/5/09
to android-...@googlegroups.com
Look at Parcel and IBinder.  All it is doing is using the args to stuff data into a Parcel and send that to the given service with a transact() call.  (You can also look at the code of the command itself to see this.)
hac...@android.com
Reply all
Reply to author
Forward
0 new messages