Tuesday, January 27, 2009

The Android Developer Phone

I started with Android programming couple of weeks ago and was itching to get hold of the actual phone and this week my wish was granted.

Being an iPhone owner, I was very excited with the possibilities and opportunities an open platform brings. While the iPhone provides a great user experience, the lack of support for third-party background services puts a limit to the kind of applications one can write. Anyway, back to Android.

The developer phone, also called ADP1, is a SIM-unlocked and hardware-unlocked. So, a SIM card from any network. I used it with Airtel SIM and it worked without any problems (well not really but more on this later). The other great advantage with ADP1 is that since the bootloader is unlocked, advanced users can build Android from the source and flash the phone with custom or bleeding edge builds. Exciting!!

After I got the Android, I booted it up only to find that there was no way to get past the initial setup wizard. The setup wizard ties your Google account to the phone. This essentially allows for download (and sending) of emails on Gmail and syncing of the calendar app on the phone with Google Calendar and the contacts app on the phone with Google Contacts with the registered account. The only problem is that it requires a data connection (aka. EDGE) to be enabled on the SIM. There is no 'skip' button (atleast not with the stock ADP1 firmware) to skip this step, enable WiFi and register.

But I had the SDK installed on my system. So, I used Android Debug Bridge or 'adb' to skip this screen. I connected the phone to my computer and opened a terminal window and typed:

adb shell

This connected my computer to the shell on the phone. The following commands disabled the app wizard:


$ su
# echo "app.setupwizard.disable=1" > /data/local.prop
# reboot

The 'adb shell' opens a shell on the remote device from the computer. The 'su' was required since the default user on the device did not have the necessary permissions to create the file in '/data'.

This connected my computer to the shell on the phone. The following commands disabled the app wizard:

That did the trick. The home screen appeared after reboot. I played around with the phone for some time before I started itching for 'cupcake'.

'cupcake' had a couple of features I wanted to try out including a soft keyboard and the A2DP bluetooth profile.

So, I downloaded and built the Android source code. What was amazing was that the entire source code built without any issues the first time. Well, almost. The default Makefile target was not set for the device. I read through the documentation and found that there were some additional steps for building Android for the device.

I followed the instructions as is and after about 45 minutes or so, I had the 'cupcake' version built and ready for flashing.

Here are the instructions for flashing the device. Please try it at your own risk :-)
  1. Go to the Android source code root folder on your machine.
  2. Ensure that 'out/target/product/dream' exists. We are interested in 'system.img', 'boot.img' and 'userdata.img'. Make sure all the three files exist. If they don't then follow these instructions exactly and try again.
  3. Locate 'fastboot'. On my system I found it under 'out/host/darwin-x86/bin/fastboot'.
  4. Execute the following commands (I included the outputs I got):
$ ln -s out/host/darwin-x86/bin/fastboot out/target/product/dream/fastboot
$ cd out/target/product/dream/fastboot
$ ./fastboot -w
erasing 'userdata'... OKAY
erasing 'cache'... OKAY
$ ./fastboot flash system system.img
sending 'system' (53946 KB)... OKAY
writing 'system'... OKAY
$ ./fastboot flash boot boot.img
sending 'boot' (1418 KB)... OKAY
writing 'boot'... OKAY
$ ./fastboot flash userdata userdata.img
sending 'userdata' (2 KB)... OKAY
writing 'userdata'... OKAY
$ ./fastboot flash reboot
rebooting...
After reboot I had the latest (and not necessarily the greatest) version of Android :-).

My experience with Android (and the device) has been positive so far. I have been updating the Android source code on my machine daily and am seeing quite a few changes being committed every day which is great.

My next goal is to try out the custom firmware by JesusFreke, an xda developer, which appear to be much better than the stock firmware. I will keep everyone posted on how that experience turns out.

1 comment:

Abhishek said...

Dude where did you get an Android from in India?