<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Gotcha!</title>
	<atom:link href="http://www.macrobug.com/blog/2007/12/28/gotcha/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.macrobug.com/blog/2007/12/28/gotcha/</link>
	<description>Macrobug Blog</description>
	<lastBuildDate>Tue, 20 Jul 2010 21:22:49 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Adrian Taylor</title>
		<link>http://www.macrobug.com/blog/2007/12/28/gotcha/comment-page-1/#comment-79367</link>
		<dc:creator>Adrian Taylor</dc:creator>
		<pubDate>Tue, 07 Apr 2009 10:36:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.macrobug.com/blog/2007/12/28/gotcha/#comment-79367</guid>
		<description>Hi there, I haven&#039;t looked at it for ages, sorry! Except to see what Android does on top of it.

If you haven&#039;t already, I&#039;d recommend you have a look at some of the ways Binder is used in the Android code. Have a look at http://source.android.com/download. Good example C++ code using Binder can be found in the Surface Flinger (and of course many other places). The Surface Flinger is the compositing process which uses OpenGL surfaces to display what applications present. The applications therefore have to make various requests to the Surface Flinger to ensure their stuff is displayed - that happens across Binder. The class names are pretty weird, but as a guide...

IThingy = the abstract interface
BnBinder&lt;IThingy&gt; = a concrete object implementing IThingy
BpBinder&lt;IThingy&gt; = a facade to the BnBinder existing in another process. This is a concrete class which marshalls the data to send over /dev/binder to the BnBinder, which then acts upon it.

(Those might be slightly wrong, but the &#039;n&#039; and &#039;p&#039; are the important bits).

Specifically with the Surface Flinger there are several different B?Binder classes. For example SurfaceFlingerClient is actually, I think, a Bn object (i.e. on the server-side.) The name just means it handles everything related to a given surface flinger client, rather than actually being that client.

You should be aware that the &#039;services&#039; available using the &#039;service&#039; tool are a separate, higher-level thing built on top of Binder. Most things (e.g. surface flinger, intents/activities/etc.) still use Binder, but don&#039;t use that nice high-level &#039;services&#039; interface.

My modifications to strace can be found here: http://www.macrobug.com/opensource/ They&#039;re definitely worth a look, if you can get them to compile... and I&#039;d be fascinated to see what traces you come up with!

Good luck!

Ade</description>
		<content:encoded><![CDATA[<p>Hi there, I haven&#8217;t looked at it for ages, sorry! Except to see what Android does on top of it.</p>
<p>If you haven&#8217;t already, I&#8217;d recommend you have a look at some of the ways Binder is used in the Android code. Have a look at <a href="http://source.android.com/download" rel="nofollow">http://source.android.com/download</a>. Good example C++ code using Binder can be found in the Surface Flinger (and of course many other places). The Surface Flinger is the compositing process which uses OpenGL surfaces to display what applications present. The applications therefore have to make various requests to the Surface Flinger to ensure their stuff is displayed &#8211; that happens across Binder. The class names are pretty weird, but as a guide&#8230;</p>
<p>IThingy = the abstract interface<br />
BnBinder<ithingy> = a concrete object implementing IThingy<br />
BpBinder</ithingy><ithingy> = a facade to the BnBinder existing in another process. This is a concrete class which marshalls the data to send over /dev/binder to the BnBinder, which then acts upon it.</p>
<p>(Those might be slightly wrong, but the &#8216;n&#8217; and &#8216;p&#8217; are the important bits).</p>
<p>Specifically with the Surface Flinger there are several different B?Binder classes. For example SurfaceFlingerClient is actually, I think, a Bn object (i.e. on the server-side.) The name just means it handles everything related to a given surface flinger client, rather than actually being that client.</p>
<p>You should be aware that the &#8217;services&#8217; available using the &#8217;service&#8217; tool are a separate, higher-level thing built on top of Binder. Most things (e.g. surface flinger, intents/activities/etc.) still use Binder, but don&#8217;t use that nice high-level &#8217;services&#8217; interface.</p>
<p>My modifications to strace can be found here: <a href="http://www.macrobug.com/opensource/" rel="nofollow">http://www.macrobug.com/opensource/</a> They&#8217;re definitely worth a look, if you can get them to compile&#8230; and I&#8217;d be fascinated to see what traces you come up with!</p>
<p>Good luck!</p>
<p>Ade</ithingy></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: atomicdryad</title>
		<link>http://www.macrobug.com/blog/2007/12/28/gotcha/comment-page-1/#comment-79364</link>
		<dc:creator>atomicdryad</dc:creator>
		<pubDate>Tue, 07 Apr 2009 10:17:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.macrobug.com/blog/2007/12/28/gotcha/#comment-79364</guid>
		<description>It&#039;s been a couple of years since you posted this, and I&#039;m wondering if you&#039;ve made any progress in deciphering this stuff? I&#039;d like to create a perl module to interface with the services on a live phone, and have been bouncing between (unmodified) strace, service, dumpsys, and the source code in an attempt to create usable functions...however, I&#039;ve not had much progress in using /dev/binder. 

My knowledge in java and C is limited (though growing as I do this), however if you still have those notes that would help alot. I&#039;d rather not write a module that calls /system/bin/service and parses the output with regexp :P I suppose I could rewrite the utility as a dynaloader module, but that&#039;s not as interesting as raw ioctls and syscalls :P</description>
		<content:encoded><![CDATA[<p>It&#8217;s been a couple of years since you posted this, and I&#8217;m wondering if you&#8217;ve made any progress in deciphering this stuff? I&#8217;d like to create a perl module to interface with the services on a live phone, and have been bouncing between (unmodified) strace, service, dumpsys, and the source code in an attempt to create usable functions&#8230;however, I&#8217;ve not had much progress in using /dev/binder. </p>
<p>My knowledge in java and C is limited (though growing as I do this), however if you still have those notes that would help alot. I&#8217;d rather not write a module that calls /system/bin/service and parses the output with regexp :P I suppose I could rewrite the utility as a dynaloader module, but that&#8217;s not as interesting as raw ioctls and syscalls :P</p>
]]></content:encoded>
	</item>
</channel>
</rss>

