Friday, February 25, 2011

How Do I Customize My Android


I have been using my HTC Desire for half a year. Recently I’ve rooted my phone (which I described in my previous post) and flashed the custom Cyanogen 6.1 ROM. It’s equipped with the ADW Launcher, which is highly customizable. I’ve spent a few days customizing it to my convenience, now looks pretty good (for me), at last. I’d also like to share a few hidden tricks with Cyanogen which users can easily missed out, as well as some un-popular good apps which I like.

Icons


The ADW allows me to change the icon of the shortcuts on my home page. I do that a lot so that I can recognize the shortcuts easier, as well as having a better look of the screen. :P To do so, long press on your icon and then release it on the same location. You can select your own image stored in your SD card, or select from downloaded AWD themes. I put this paragraph at the beginning, just in case you got confused with the custom icons shown below. :)

Main Dock

The “Main Dock” refers to the bottom fixed bar. I expanded it 5 slots because I really want to utilize all space available. And then I changed the home paginator to bottom sliding bar instead of regular Android-style dots, and have it auto-hide. This way I can still know where I am while scrolling thru the home pages. These settings can be found under Settings à AWD Launcher à UI Settings.

The first slot is a small simple app called “Lock Screen”. It does nothing else but to put the device into sleep. I use this because I don’t want to press the hard power button: it’s just not located in a convenient place for my finger.

Having said that, I also changed a setting in Settings à CyanogenMod Settings à Input Settings, so that my trackball button wakes up the device. I really find it more convenient than the power button located at the top.

The second slot is the App Drawer. In case you don’t already know, yes you can recreate the App Drawer shortcut by going Menu à Add à Custom Shortcut à Pick Your Activity à Launcher Actions à Open/Close App Drawer.

Third slot is the “ES File Explorer”. I find this to be the best file management app available in the market. I also rely on it to exchange files with my computer, by using the LAN functionality.

Forth slot is a file shortcut pointing to a blank text file stored in my SD card. When clicked, it opens up with m favorite text editor called “TxtPad Lite”. This shortcut allows me to quickly launch a note, type, and then save.

There are many apps that can create file shortcuts, including the ES File Explorer. However, sometimes they don’t work for many reasons. I ended up creating the file shortcut manually using an app called “Any Cut”. You’ll need to have a little technical knowledge on Android’s Intent API to do this thou. For my case, I used these parameters:
Action: android.intent.action.View
Data: file:///sdcard/mynotes.txt
Type: text/plain
Yes the typing is a bit inconvenience. I’d love to allocate some time to develop a simply app to help me do this in the future.

In case you haven’t noticed, the commonly-important shortcuts such as the phone app and contacts app are not in my main dock. Yes, to me the device is much more than a phone, these functions are not what I mainly use it for.

The last slot on the main dock is a shortcut to show the “Dockbar”.

Dockbar
The dockbar is sometimes quite confusing for users new to Cyanogen. Look at it this way: it’s the second page of the main dock. You can “flip” to the dockbar by sliding your finger from the bottom edge of the screen up. By default the dockbar is empty, so you’ll thought your main dock is gone. But what happen actually is you can drag icons and drop it in. To “flip” back to the main dock, it’s even trickier: slide your finger from the bottom edge of the screen up – and then – slide back down.

So after some touching around, I found a way to create a shortcut to show/hide the dockbar: Menu à Add à Custom Shortcut à Pick Your Activity à Launcher Actions à Open/Close Dockbar. With this, the dockbar now becomes very practical. You can also find more settings for the dockbar in Settings à AWD Launcher à UI Settings.

The good thing about the dockbar is, you can add as many icons in as you like. You’ll be able to scroll thru them horizontally. My shortcuts here change quite frequently, I drag shortcuts in & out, depends on which apps I used most often during different time.

The first icon is, again, the shortcut to allow me to go back to my main dock.

The second icon is a folder, which contains my most-used setting dialogs. The main settings dialog has became very crowded, sometimes I forgot where is the settings that I’m looking for. Also for frequently used setting dialogs such as wifi, Bluetooth and battery, I like to access them with as few clicks as possible. Some of the shortcuts here are not available in the app drawer, but you can get it by going Menu à Add à Custom Shortcut à Pick Your Activity à Activities, then look for Settings, expand it and you can see a list of all available dialogs.

The third icon is an app called “My Settings”. A very good app which allows me to switch on/off many battery-draining features quickly. It’s also equipped with a volume controller. Some of its features has been duplicated in other places, but this app has helped me a lot in my previous HTC Sense.

Notification Bar

Cyanogen’s notification bar (the bar on top) consists of a useful power management “widget”. The widget can be configured in Settings à CyanogenMod Settings à User Interface à Notification Power Widget. Choosing from the predefined list, you can choose to display up to 6 buttons. Mine is: GPS, wifi, Bluetooth, hotspot, 3G and sync.

Secondly, I have the battery percentage displayed on top of the battery icon. This way I have more precise information about the battery level. More settings on the notification bar can be found in Settings à CyanogenMod Settings à User Interface à Status Bar.

Homepages

Now about the shortcuts on the home pages. First, I've hid the label display of the icons, because I can recognize all of them without the label, I find the labels wasting space. Secondly, I changed it to 5 columns and 7 rows, so that the icons look more packed, and I can put more things on the pages.

My main home page has only 4 shortcuts. I want a blank main home page because I want to see my wallpaper clearly. That’s the whole reason I put up my favorite wallpaper after all.

The first icon is an app called “Bookmark Home”. It displays your bookmarked websites as icons in a home-style itself. I find it pretty cool and easy to navigate. I put this here so that I can access my favorite websites really quickly.

The second icon is an app called “Hertz”. It’s a simple voice recorder. I like its auto-save feature over the bundled recorder: I’d not like to miss a precious moment while I’m touching around to save my previous recorded sound, I can always do housekeeping later to clean unwanted files. I put it here because I want super-fast access to this app, because people don’t wait for me to launch this app before they start talking. This is also the same reason I put the next 2 shortcuts in my main home page.

The third and forth icons are the camera in video and picture mode, respectively. The video mode camera is not available in the app drawer, but you can get it in Menu à Add à Custom Shortcut à Pick Your Activity à Activities, then look for the Camera icon, expand it, then select Camcorder.

Utilities, Organizers and Games

Then scrolling to the left, I have my group of utilities, organizers and games shortcuts. In this page:

  • Microphone: use my phone as a microphone, output directly to an amplifier, or to my computer for recording.
  • IP Webcam: use the camera on my phone as a webcam for my computer, including using it for video chats such as in Skype.
  • Paint Joy: a kids’ painting program, but I find it useful for drawing sketches during discussion. 
  • My Letter: creates hand writing graphics. Not really practical but I just find it cool.
  • Moon+ Reader: my favorite e-book reader.
  • Ringdroid: lets me trim my MP3s before setting it as my ringtone.
  • Barcode Scanner: QR and barcode scanner. It also allows me to create my own QR code from any text.
  • ShootMe: do screen capture.
  • TxtPad: my favorite text file editor.
  • Camera360: a powerful camera, for normal shooting as well as post processing effects. I don’t use it as my primary camera app because for its slow startup. But it could be fun in certain situation.
  • Radio: well, radio.
  • MortPlayer: way better than the default music player. Tons of features including alarm. You really have to test this out if you haven’t already done so.
  • Gallery: the default picture viewer. Not my preference in terms of practicality, I leave it here because it looks cool and it lets me view my Picasa photos directly.
  • QuickPic: the practical picture view. Best of it is, it lets me hide a folder to prevent it from showing as an “album” elsewhere (by creating the “nomedia” file.
  • FxCamera: a camera that lets you create funky picture effects. Just fun.
  • Torch: The life saver during a blackout in the night.
  • Calculator.
  • GTask: simple to-do task list. Just enough for me to quickly create tasks without too many touches and typing. Not too much, not to less.
  • Calender: bundled. I use it mainly to view dates. Setting appointments with it is simply a pain in the a**: too many questions asked!
  • Clock.

The 3 folders at the bottom are, well, one of the most important features in the phone, games. I put only 12 icons in a folder to avoid scrolling. Just in case all of them full – I still have 2 more empty slots ready :P

Internet and Communications

On the right of my main home page, I have my group of Internet and communication apps. In this page:

  • News and Weather: bundled. I have to admit I don’t really use it, just put here for the sake of… acting cool.
  • Voice Search: Google voice search.
  • Browser.
  • Flow Free: an alternative to the official Facebook app. It seems to have better notification features. I use it mainly for this function.
  • SlideMe: SlideMe app market.
  • Google Market.
  • GFan: One of the China based largest Android market. You can strangely find many apps that are not available in the official Google Market.
  • Google Map.
  • Facebook: the official Facebook app. Well, I didn’t use this neither, I usually use browser to browse the desktop version :P I install it purely for its video/photo sharing feature.
  • Gmail.
  • MSN Talk: the best MSN app I’ve seen so far. Unlike other IM apps, it only allows you to connect to MSN, but it has implemented MSN-specific features best.
  • GTalk: the default app.
  • SIM Toolkit: to use your telco provider’s SMS info services.
  • 2-Way CallRecorder: lets you record your calls in high quality format.
  • Tango: for video conferencing 3G calls.
  • Phone: the default app.
  • Watsapp: for free SMS-like messaging.
  • SMS: the default app.
  • The following 3 icons are shortcuts created from an app developed by myself :P It’s called QDial. It lets you put your favorite contacts into photo-collage format, and quickly dial by simple touch or long touch. You must try it out!


  • Contacts: the default app.
  • QNameCard: again developed by me! It lets you digitalize your business name cards. You can swipe thru your cards collection, flip front/back, dial/email directly, etc, you must try it out! :P


Administration and Development

Scrolling right again, I have my group of administration and development apps. In this page:

  • Any Cut: create custom shortcuts.
  • Remote RDP: remote desktop connection.
  • androidVNC: Real VNC connection.
  • PRemoteDroid: controlling your computer’s mouse and keyboard thru LAN connection. It’s cool and perfect for Power Point presentation!
  • Dev Tools: bundled app that helps simulating environments for application development.
  • ADB Wireless: when activated, it allows you to ADB into your phone using wireless LAN.
  • GScript Lite: create Linux script batch jobs.
  • Terminal Emulator: run Linux scripts.
  • aLogcat: view system log.
  • Shark: capture network traffics.
  • PhoneUsage: keeps track and analyze my wifi and 3G data usage.
  • Root Explorer: explorer system files with root user rights.
  • Disk Usage: analyze app storage and SD card usage. I use it to find large files in my storage easily.
  • Superuser: manage apps that use the root user rights.
  • ES Task Manager: kill running apps and services.
  • My Settings: as described earlier.
  • ROM Manager: checks and installs ROM updates.
  • Titanium Backup: great app to backup my apps and system data.

Other Tips

  • To quickly create a shortcut of your app, go to App Drawer, locate the app, long press.
  • To quickly uninstall your app, long press on the icon, drag to the top “Trash” bar, hold it and wait for a second. Messages will popup saying “Application will be uninstalled.” Now drop it.
  • The notification bar shows the current time. What if you want to find out today’s date? Simply drag down the notification bar, notice that the left side of the bar now display today’s date.
  • Ever wondering where is the file you received via Bluetooth? Create a “Bluetooth Received” shortcut folder: Menu à Add à Folders à Bluetooth Received.
  • To visit your recently launched app without jumping back to home? Long press the Home button. You can also set the number of recent apps shown at Settings à CyanogenMod Settings à Input Settings à Long-Press Home Settings à Number of Recent Apps.
  • Stuck in an un-responding app? Long press the back button to kill it instantly. You can enable this in Settings à Application Settings à Development à Stop app via long press.
Besides using cable, there’re other ways to exchange files with your computer.
  • Bluetooth. Once paired and after some setup using OBEX, you can browse your device’s SD card from your computer easily.
  • FTP. You can setup a FTP server on your device, my preference for this is an app called “FTPServer”, and then access from your computer using any FTP client such as FileZilla. LAN is required thou.
  • Using LAN. I find this the most convenient way. As long as both your device and computer are in the same LAN, you can simply browse the network folders using tools like ES File Explorer.

They are FREE

Just in case you are wondering, yes all apps listed above are free, some are ads supported, but free. I have not spent a single cent in buying apps. I really appreciate the hard work done by the developers. Some of the apps above are really great, I wish I’ll have some spare time to write more about them in the future. Till then, cya.

Monday, February 21, 2011

HTC Desire: Rooting, Custom ROM and A2SD

I spent a few days to flash a custom ROM to my HTC Desire. The experience was… fabulous. I thought I’d write a diary about it. So here it is.

I’m a .Net developer for many years, and have been doing Android apps development for the past year. I’m new to custom ROM thou, I could be wrong about many things below, feel free to correct me if you see any.

The Pathetic 150Mb

Just 3 months after I bought my HTC Desire I already encountered the famous low memory problem. The labeled 512Mb internal memory has a few partitions; practically there are only about 150Mb for user applications. This ridiculous 150Mb allocated for millions of applications on the Android market is just pathetic. It must be a practical joke by the guys at HTC. I had only less than 50 apps and available space was less then 15Mb. I had to keep uninstalling old apps to install new apps.

Froyo A2SD

Lucky enough HTC was pushing the Android 2.2 (Froyo) OTA update just around that time. I’ve been reading articles online about the new features in this version, including the ability to allow users to move applications to SD card instead of storing them inside internal memory. The community now called this feature “Froyo A2SD”. Cool, it sounded like a solution.

But it’s not. In many cases, an app cannot be moved. To name a few of them,

  • App developers haven’t enabled their apps.
  • Apps that were bundled together with the OS (called the “Stock Apps”) cannot be moved to SD card.
  • App updates to the stock apps, such as Adobe Flash Player update, cannot be moved to SD card.

So I was only able to free up like 20Mb of space. The only solution I had was: try not to visit the Android Market so often. Did I mention how pathetic it was?

Force Froyo A2SD

A few months later Google released the Google Maps 5.0 update. This compass-integrated map was cool enough for me to sacrifice other apps to free up some space for it. It took 10Mb. Then there was Adobe Flash Player 10.1 update, another 10Mb. Then there was Skype, 5Mb even after Froyo A2SD. And the list goes on.

No, there must be something I can do. So I did some googling, and found a way to force-enable Froyo A2SD for all apps. It was simple enough. Connect phone to PC, fire up ADB (which I already installed before for apps development), type a line of command and done. After that I was able to move more apps to SD card including those that haven’t enabled by the developers.

Here what I did: http://myhtcdesire.com/tutorials/how-to-force-apps-to-sd-without-rooting-on-froyo

That helps, but again not much. Very soon I ran into the same problem again. I was starting to give up. Even if I can free up the entire 150Mb it’s still not quite enough for my usage. I mean, can you blame me? Apps are meant to be downloaded! We’re talking about Terabytes in desktops and suddenly I’m being calculative with Megabytes. I was this close of throwing away the phone!

Rooting

I’ve read that after “rooting” the phone I’ll have more options in managing apps. I didn’t quite understand what those “options” mean, but since I’m prepared to throw it away I might as well give it a try. Of cause, by doing so, I voided the warranty of the 6-month-old phone.

Apparently when an Android phone ships to user, user only has some sort of “guest” access to the Android system, similar to Windows’ Guest users. “Rooting” a phone refers to gaining “super user” (or administrator in Windows) access.

After some survey reading, I’ve done it using Unrevoked3. It’s not as difficult as it looks, I did it without a glitch. Credits to the Unrevoked3 team.

Here’s what I did: http://myhtcdesire.com/modding/how-to-root-your-desire-easily-method-2

Then I was able to run some apps that require root access, such as ShootMe to take screenshot (impossible before root without connecting phone to PC), Root Manager to browse previously inaccessible system files, do a much higher quality call recordings, etc. I was finally able to see the system files created by the apps I developed before, cool. These are bonus I’d consider, but the memory problem remains.

Then I bought Titanium Backup (for $5.99), which has some pretty cool features that would help me clean up internal memory. These including the Force Froyo A2SD, integrate stock app updates (merge the original copy and the update copy to save space), and uninstall unused stock apps. So I tried these, but as soon as I hit the button my phone rebooted, and nothing happened. What’s wrong?

S-Off

Google it, what else. Apparently HTC’s devices have a security feature that protects the certain portion (NAND) of the device, it cannot be written even with root access. The solution is to turn the security off, which the community called “S-Off”.

I first tried Unrevoked Forever. Looks simple. I was suppose to download a zip file, put it into SD card, then reboot phone in recovery mode, then locate the zip file… but hey the file is not shown in the list?

Here’s what I did: http://theunlockr.com/2010/09/20/how-to-root-the-htc-desire-unrevoked-method/
(Section III. It DID NOT work for me.)

Some more googling and then I found AlphaRev. The steps are more complicated. I downloaded the Linux-based ISO image, mount it into VirtualBox, then emulate my phone’s USB connection to the VirtualBox, then wait for it to reboot a few times in the next 15 minutes, and then… done. I have S-Off.

Here’s what I did: http://forum.xda-developers.com/showthread.php?t=805811

So I retried the features in Titanium Backup, and they were successful. I managed to free up 50Mb of internal memory space. Phew.

Symlink

But I’m still not satisfied. Since I have the root access I did a in-depth browsing on the system file structure. Apps are stored inside in 3 major portions:

  • APK files, the actual application files. This is the portion that is moved to SD card when using Froyo A2SD.
  • App data files, files generated by applications. This portion usually quite small but a small amount of apps did generate large data files, even larger than the APK file itself. This portion is not moved SD card when using Froyo A2SD.
  • Dalvik Cache. Ah ha, I’ve seen this word, what does it mean? Apparently, when an app is executed, Android will generate an executable copy of the app (if not already exist), and this copy is called the “Dalvik Cache”. It’s usually similar or large than the APK file itself.

We usually read the app file size in Android Market before downloading an app. So you see, if an app labeled size is 1Mb, it may ended up taking 2Mb of internal memory space even if you use Froyo A2SD.

Then it occurred to me, I could move the app data and dalvik cache to SD card as well, by creating a Symbolic Link (Symlink). Symlink works like this: you create a symlink from /system/folderA to /sdcard/folderB, so when a program asks for path /system/folderA, it’ll be redirected to /sdcard/folderB transparently. Using this method I could tell a lie to the system, making it access my SD card instead of internal memory when it’s looking for apps.

So I did what I thought logically work. I tried it with one of the apps, symlink was successful, but the app no longer works. Now what’s wrong?

EXT2/EXT3

Some more googling. Apparently, for the above method to work correctly, the symlink target has to be formatted in EXT2/EXT3 file format, while my SD card is in FAT32 format. While FAT16 and FAT32 is the most compatible file format for various platforms, EXT2/EXT3 is a Linux-based file format. The difference between EXT2 and EXT3 is that, EXT3 has a “journaling” feature, similar to NTFS for Windows in some way. Journaling means mean bytes are read/written, additional change-info data will also be added in. This helps prevent data corruption. Back to the time of Win98, if you’d remember, if Win98 did not shut down properly, you’ll see a disk scanning progress bar during next boot. This is because Win98 runs on FAT32, which doesn’t have journaling feature.

So I formatted my SD card using GParted Live CD. It’s easy with the experience to mount AlphaRev previously. The SD card now consists of 2 partitions: 14Gb of FAT32 (this partition will be recognized as the regular SD card), and 800Mb of EXT3 (this partition should become an extended internal memory).

Here’s what I did: http://gparted.sourceforge.net/liveusb.php

Put the card back in, boot it, and OK here’s the 14Gb SD card detected correctly, and… where’s the EXT3? Apparently I have to mount it to somewhere so that the system recognizes it. Google’ed the command to do the mounting, I entered it thru ADB, works fine, in Titanium Backup I can now see 3 drives: SD card, internal memory, and extended internal memory. Yeah. The next step is to make the system run this command every time during boot. It should be simple, but turned out to be not quite so. I’m suppose to edit this /init.rc file, but seemed like every time the phone is reboot, the file will be reverted to original content. There’s just no way to insert a startup command using a Stock ROM.

I could prepare a script package and execute it manually every time I reboot my phone, but that way booting will become extremely slow since Android will rebuild dalvik cache during boot because the dalvik cache folder has not been symlink-ed to the EXT3 partition. I had to find another way around.

A2SD/A2SD+

I realize that, what I was trying to do is actually a method known as “A2SD”. The community came up with this method long before Froyo A2SD was introduced. The concept is exactly as I’ve described. Some developers argue that moving dalvik cache to SD card may slow down performance while running apps so they recommend moving only APK files and app data, thus “A2SD+” refers to configuration that moves everything including dalvik cache as well. With A2SD, one no longer needs to do Froyo A2SD, in fact, it’s better not to do Froyo A2SD.

So someone else must have done the tweak. After some search I found Darktremor. Following the instruction, I downloaded the zip file, install it using the recovery mode, then use ADB to enter the install command… and boom! My phone can’t boot anymore.

Here’s what I did: http://www.facebook.com/note.php?note_id=158809660835039
(It DID NOT work for me this time.)

Don’t panic, I told myself. The phone didn’t turn into a “brick”, as the community called it. It can still be started, but it kept restarting after the HTC boot sound effect. Google’ed but no solution found. So finally I booted into recovery mode, and did a factory reset. I should have done a ClockworkMod backup but I didn’t. The phone rebooted into a fresh copy, sure enough I lost all my apps and data. However thanks to Google contacts sync I managed to get all my contacts data back quite smoothly.

Custom ROM

I was trying to avoid flashing custom ROM because it sounds too scary, and I don’t want to take the risk to backup/restore my data. Now since things cannot be worst, I thought I might as well try out those custom ROMs.

Android phones sold by manufacturers such as HTC, Samsung, Motorola etc, are installed with a customized Android OS, i.e., a piece of software build on top of the original Android OS. For an example, HTC Sense. These are called the “Stock ROM”, something bundled together with the device when shipped. There are developers out there building various different customized Android OS, allowing users to install a different OS to their device. These are called the “Custom ROMs”.

A search in Google reveals a long list of them. I picked the Cyanogen 6.1. It turned out to be quite easy to install following the instructions on the website. Did it without a glitch. Boot it up, and it looks good. Better than the original stock HTC Sense I’d say. It works smooth without any problem so far (3 days). Credits to the Cyanogen team.

This is what I did: http://wiki.cyanogenmod.com/index.php?title=HTC_Desire_(GSM):_Full_Update_Guide
(I skipped the Rooting and ClockworkMod steps because already done so previously.)

And then I tried the Darktremor again, this time it worked like a charm.

Redo the Darktremor setup: http://www.facebook.com/note.php?note_id=158809660835039
(And worked just fine this time.)

So that’s it! I now have full 800Mb of space for apps. And if it’s not enough I can always reformat my SD card to increase the partition.

The Future

I have to admit, it sounds like (and in fact is) a big practice, just to solve a silly memory problem. HTC Desire HD now equipped with 1.5Gb internal memory, Samsung Galaxy S with 8Gb, Nexus S even pushed it to 16Gb. No any A2SD is required on these phones. So what’s the point of doing all these?

When I first got my HTC Desire, it straight away occurred to me that, it’s not a phone, it’s a Computer. It’s trivial that the industry’s model should work the same. When I buy a phone I’m only buying the hardware. Then I can choose to install any software/OS I like, and the custom ROMs serves this purpose. I can imagine developers releasing paid custom ROMs with superb features.

It’s not about solving a problem, it’s about having the freedom to choose. I’d love to see smart phone manufacturers offer customized hardware like how Dell did for desktop computers. I’d like to have a 4.0in” screen, Capacitive Super AMOLED, 2Gb internal memory, 1Gb RAM, oh I don’t need high res dpi, a medium 320x480 will do, leave it empty, I’ll flash my own ROM, and I’d prefer… this housing case, yes, the sharp red color one…