Background & Motivation

Here at Tendigi, we’re no strangers to putting strange operating systems on Apple hardware. After observing the overwhelming reaction to my last hack, it seemed only fitting to raise the stakes.

Testing the Concept

Despite some obvious drawbacks, Android has a killer feature that made this project possible: (virtually) the entire operating system is open-source. The Open Handset Alliance (a consortium of carriers, phone manufacturers, and software developers led by Google) maintains the Android Open Source Project. The AOSP is the foundation of all device-specific flavors of Android shipped on phones from manufacturers like Motorola, HTC, LG, etc. For a platform of its scale, it’s surprisingly easy to clone it out and build it on your local machine. From scratch, I was able to develop an efficient AOSP workflow in about two days.

Since we had an unused one laying around the office, I decided to target the LG Nexus 5 for my initial proof-of-concept. I ended up having to port (or outright build) the following components for Android:

libimobiledevice: An open-source suite of tools that enable native communication with iOS devices.

usbmuxd: An clone of Apple’s daemon of the same name, this service multiplexes TCP connections to sockets listening locally on the iPhone. In simpler terms, it allows you to use a USB cable to an iPhone as a high-speed network connection. Without this, I’d have probably resorted to Wi-Fi which would have resulted in lower frame rates and unpredictable latency.

Without this, I’d have probably resorted to Wi-Fi which would have resulted in lower frame rates and unpredictable latency. screenstreamer: A daemon I wrote that connects to the usbmuxd service, transmitting the screen’s contents to the iPhone and emulating touch events on the Android side. This is where the magic happens. While there are many ways to capture the screen on Android, I achieved the best performance by connecting to the SurfaceFlinger service and reading screenshots from it. For more information, see this header file and this presentation. The droidVncServer repository on GitHub also contains some helpful pointers.

Once these components were individually tested and confirmed to work, I modified my AOSP build’s init script to launch the screenstreamer daemon on startup. After writing a simple iOS application that handles the incoming connection from Android, I was off to the races: