Friday, December 28, 2007

Android VNC, Part Deux

I decided to create my own VNC implementation and have posted code and binaries over at Google Code. There, you'll find instructions for installing and using the VNC server with a Windows Mobile device using .NET VNC Viewer. Here's a low-quality photo I snapped to get you interested:

The application running is my Android RSS reader, also hosted by Google Code.

Sunday, December 23, 2007

Android RFB / VNC implementation

Looks like the Android team has created a functional VNC server implementation natively in their surfaceflinger library (/system/lib/ After some further exploration, it is possible to actually connect to and use this VNC server, although there are very strict requirements of the client.

First off, you will need to proxy the connection as it only permits connections on the local interface. For this, I have simply cross-compiled a simple TCP proxy and invoked it on the emulator:

arm-none-linux-gnueabi-gcc -static -o proxy simple-tcp-proxy.c
adb push proxy /data/proxy
adb shell /data/proxy 5901 5900

Then you must redirect port 5901 on the local machine using the Android telnet interface:

$ telnet localhost 5554
Connected to localhost.localdomain.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
redir add tcp:5900:5901

Now you can connect from your local workstation:

xvncviewer -noauto localhost

Note: the VNC connection will fail if the client suggests any unsupported pixel format (bit depth, endianness(?), etc). So make sure you use -noauto to disable the initial 8bpp performance test and also use a 16bpp native display on your workstation. If your client requests 24 or 32bpp, the server will reject and hang indefinitely. See adb logcat to determine if you have triggered this behaviour.

A few comments on this implementation:
  • You may only specify 16bpp pixel format, with the true colour flag on and a 565 bit pattern. This creates problems trying to use it from mobile devices with tools like .NET VNC Viewer which default specifies a 655 bit pattern when you force a 16bpp encoding. I wrote a very simple proxy that understands the RFB protocol and "fixes" some of this brokenness, but the experience is still less than desirable.
  • Only the raw encoding is supported, with no incremental updates. This causes atrocious performance problems on the client, making it impractical to use an existing mobile device to interact with the Android RFB server. I tried, it's bad. I think the only real option to proceed would be to extend my proxy to have a deeper understanding of the full RFB protocol, interpretting and re-encoding the data sent from the native Android RFB server. This seems like excessive work, and ultimately is work that should go into the native server. Perhaps I will still do it, though, just to prove it's possible.
For reference and further reading, see my android-developers post on the subject.

UPDATE: I have created my own VNC server implementation on Android to work around these problems.

Saturday, December 1, 2007

Open to the public

I've created a Google Code project at to host the new Subversion repository for my RSS reader. I will be "releasing" version 0.1 in the near future with a better build environment (ant supported with meaningful dist targets) and a few default feeds preconfigured for easier testing. In the mean time, head on over to the android-rss project to access the code through SVN. Again, for now you must use Eclipse w/ the Android plugin installed or you will not be able to build the source.

Tuesday, November 20, 2007

Android RSS Reader

I started an Android RSS reader project to help learn the new Google Android APIs in preparation for the Android Developer Challenge. The irony as I tested overwhelmed me: