Renaming an Android shortcut in TouchWiz (the hard way)

Warning: the information presented below might break your phone. It’s quite easy to make a typo and delete all your shortcuts… which will leave you pretty much up the creek. I probably should have backed up launcher.db before I did all this, but I didn’t. Shame on me. So don’t do this unless you know what you’re doing. If you break things it’s not my fault.

I recently switched from using Astro File Manager to ES File Explorer. In almost all respects, ES File Explorer is a better file manager – but it has one significant shortcoming. In Astro, you can create a shortcut and specify its name at create time; in ES File Explorer your shortcut is named whatever the file was originally named.

This left me with ugly file names (including extension) on the home screen. I needed a way to rename. Lots of articles on the web pointed to apps that would do it, but it seemed unnecessary to have to download a whole other app just to rename something. In the end I figured out how to do it.

To start with, you’ll need the following (all of which I had installed on my phone already):

Incidentally, my phone is a Samsung Infuse running Froyo… other phones may be different, and I don’t think you’ll find TouchWiz on non-Samsung phones.

First, I had to locate where the TouchWiz database was on my phone. This thread on xda-developers pointed me to /dbdata/databases/

So… start up Terminal Emulator and do:

$ su
# cd /dbdata/databases/com.*twlaunch*
# pwd
# ls

Groovy, there’s the launcher.db in the right place. Next I inspected it with sqlite3:

# sqlite3 launcher.db
SQLite version
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
CREATE TABLE android_metadata (locale TEXT);
CREATE TABLE apps (_id INTEGER PRIMARY KEY,componentname TEXT,top_number INTEGER NOT NULL DEFAULT 65535,page_number INTEGER NOT NULL DEFAULT 65535,cell_number INTEGER NOT NULL DEFAULT 65535);
CREATE TABLE favorites (_id INTEGER PRIMARY KEY,title TEXT,intent TEXT,container INTEGER,screen INTEGER,cellX INTEGER,cellY,INTEGER,spanX INTEGER,spanY INTEGER,itemType INTEGER,appWidgetId INTEGER NOT NULL DEFAULT -1,isShortcut INTEGER,iconType INTEGER,iconPackage TEXT,iconResource TEXT,icon BLOB,uri TEXT,displayMode INTEGER);
CREATE TABLE gestures (_id INTEGER PRIMARY KEY,title TEXT,intent TEXT,itemType INTEGER,iconType INTEGER,iconPackage TEXT,iconResource TEXT,icon BLOB);

My educated guess based on the tables and what was in them was that the table “favorites” would be useful. Not only did it have a title and an intent, but cellX, cellY, spanX and spanY looked like things that might be used for shortcuts.

From there it was simple to look at what was in the table:

sqlite> select * from favorites;

Luckily, it looks like shortcuts are added by _id, and the number for _id increases as new shortcuts are added. That means the latest shortcut added is probably going to be at or near the end.

So… update the record and see what happens:

sqlite> update favorites set title="VE Manual" where _id=149;
sqlite> .quit

Then go back to the launcher and look at my shortcut. Boo, it’s still the same as it was. So then kill TouchWiz by holding “Home”, clicking the “Ram Manager” tab, pressing the “Level 2” button and then the “Clear Memory” button… success! The shortcut is renamed. Tapping it causes the same behaviour as before… in all respects it’s the same shortcut, just the title has changed.

Incidentally, I ran into what looks like a problem with doing this. If I rename the shortcut then reboot, the shortcut loses its icon information. I think this has something to do with ES File Explorer being stored on SD. Strangely, it doesn’t happen when I don’t rename the file. Astro fills in the icon BLOB, but ES File Explorer doesn’t.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: