The Binder mechanism has been at the heart of Android since its early days. All key functionalities in the system are accessed through the Binder driver, whether they're requested by regular apps or system components. Binder, in essence, enables Android to build an object-oriented operating system (i.e. Android's system services) on top of a general-purpose operating system (i.e. the Linux kernel.)

The Problem

Despite serving as one of the core Android building blocks, there's no common way to readily understand nor observe Binder relationships. At best, we can use commands such as 'service list' to list the set of system services registered with the Service Manager, 'dumpsys' to query system services for their internal state or use 'logcat' to try to look for messages logged by system services to Android's logging system. Yet, none of these help get the full picture of what's happening over Binder.

At Opersys we've been struggling with this problem for several years as part of our work helping our customers port and use Android in a wide range of systems and applications; embedded, mobile or otherwise. And, apart from putting together architecture diagrams to help walk our customers through Binder's complex web of interactions, we've had few tools at our disposal to help. Until now.

Introducing Binder Explorer

We're pleased to announce the beta release of our open source Binder Explorer tool for Android. Binder Explorer follows our earlier work on our node.js-based Process Explorer and enables users to get an at-a-glance view of all Binder interactions in Android.



As you can see in the screenshot above, the system is presented as a set of nodes with system services displayed in circle form at the edge of the display and apps displayed at the center of the circle. Whenever a Binder connection exists between an app and a system service, an arc is drawn between the two. By hovering over a node, whether it be an app or a system service, the user can highlight that node's existing Binder relationships. This allows for rapidly exploring all Binder relationships in the system without having to manually parse complex debugging information provided by the Binder driver through debugfs.

Limitations

Despite helping app developers and system integrators get quick access to information not previously available, the Binder Explorer's functionality is currently fairly limited. It doesn't, for instance, automatically refresh its display when new relationships are established or old ones destroyed. It also doesn't provide any in-depth information about the relationships nor the apps or services involved. Nor does it allow the user to see interactions between apps and services provided by other apps.

Nevertheless we believe that Binder Explorer can already save developers and system integrators a lot of time in its current form by allowing them to quickly understand Binder relationships. This is why we're making Binder Explorer available today under the Apache Software License on github.

How does it work?

Like Process Explorer, Binder Explorer relies on a combination or node.js and native platform code to provide a web service for remote viewing of system information. It parses information provided in raw form by the Binder driver through debugfs and uses d3.js to display the information in a user-friendly fashion. In order to operate properly, Binder Explorer must have the proper access rights to read the Binder driver's debugfs files. In practice this means it must run it as root.

The road ahead

We hope that you'll find Binder Explorer as useful as we've found it to be and look forward to hearing your feedback on its existing capabilities and, most importantly, its limitations. We'd also love to hear about features you'd like to see. Better yet, send us your patches or fork the code on github.

We'll obviously continue to develop Binder Explorer and will keep you informed as we make future releases. In the mean time, you can grab pre-built Binder Explorer files from the project's github page and follow instructions there on how to use them.

Stay tuned!