Android Alarms Icon

Saturday, January 15, 2011 categories: a855, mobile, motorola droid

I've been having some trouble with my phone, since early December. There have been phantom inputs, random scrolling, and unresponsive areas of the touch screen on my Motorola Droid A855. I could temporarily resolve the issues by applying even pressure across the touch screen, but that's certainly not a long term solution.

And so I called up Verizon support (*611) and the person had me explain what was going on, and I tried my best to suggest that the factory reset wasn't going to solve my problem. Nevertheless, low tier support, following the script, factory reset here I come. Then spent the rest of the day trying to restore my configuration. Which was an ultimately futile effort, as I ended up killing the market application as it apparently hung trying to reinstall all of my applications. Which resolved the problem, and allowed for manual installation of the various ones I still wanted. (At least it preserved the list of formerly-installed applications!)

Regarding other pieces of data, I was not so lucky. Apparently various applications store data in /data/data/<APP>/databases/<DB NAME>.db which is a sqlite database. This tidbit comes in handy later, but /data/data/* is on the NAND and is wiped clean during the factory reset. Goodbye SMS messages (but they are safely in GMail thanks to SMS Backup). Goodbye history of called numbers, and thus the handy favorites list. Goodbye my list of Shazam "tagged" songs that I might have wanted to sift through some day. And goodbye Angry Birds progress.

I think some of that stuff should be backed up onto the SD card in some signed format (if the concern is tampering) and sucked back in after the reset.

Little did I know that I would be even more annoyed by the lack of an "Alarms" shortcut in the applications drawer. I didn't realize how handy it was until it was gone, like most truly useful and under-appreciated things I suppose. So began the quest of complaining to my fellow Droid-wielding coworkers. One of which also happened to have the coveted "Alarms" shortcut still on his Droid's desktop.

A Google search led to most of the answer. However, upon first try that did not work. I wasn't sure how to access the database, and even after reviewing the recommended applications in the market, they required root access to edit other applications' database -- which makes perfect sense. Which led to a long road of understanding the current root escalation techniques, and ultimately to psneuter. The "trick" is pretty cool, if you take a look at the source.

With that in place, and after learning that /data/local/tmp is writable (the SD card doesn't work because setting permissions doesn't work there) I was off to the races.

adb pull /data/data/com.android.launcher/databases/launcher.db
sqlite3 launcher.db
sqlite> .tables
android_metadata  favorites
sqlite> .mode line
sqlite> .headers on
sqlite> select * from favorites where title like '%clock%'
_id = 18
title = Clock
intent = #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.google.android.deskclock/com.android.deskclock.DeskClock;end
container = -100
screen = 3
cellX = 0
cellY = 1
spanX = 1
spanY = 1
itemType = 0
appWidgetId = -1
isShortcut =
iconType = 0
iconPackage =
iconResource =
icon =
uri =
displayMode =
sqlite3> update favorites set title='Alarms',intent='#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000component=com.google.android.deskclock/com.android.deskclock.AlarmClock;end' where _id=18;
sqlite3> .quit

It took a few tries to get the intent component value right (the post from earlier didn't have a value that worked for 2.2.1) but now it works! And I'm quite happy to have that special purpose icon back. As trivial as that may seem.

After moving to my replacement phone, I had to use the SD card as an intermediary in order to make editing the database work. That seems very strange to me, but was mentioned somewhere else as well. With no cp (?!?) I had to resort to cat /data/data/com.android.launcher/databases/launcher.db > /mnt/sdcard/launcher.db; mount it on my computer; and then edit it with sqlite3. Finally, used cat to overwrite the old file, and my 'Alarms' shortcut survived a reboot.