4 min read

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/com.sec.android.app.twlauncher/launcher.db.

So… start up Terminal Emulator and do: $ su # cd /dbdata/databases/com.*twlaunch* # pwd pwd /dbdata/databases/com.sec.android.app.twlauncher # ls shared_prefs launcher.db

Groovy, there’s the launcher.db in the right place. Next I inspected it with sqlite3: # sqlite3 launcher.db SQLite version 3.7.6.3-Titanium 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); sqlite>

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; ... 149|VE_Manual_Web_FINAL_2013.pdf|file:///mnt/sdcard/saved-pdf/VE_Manual_Web_FINAL_2013.pdf#Intent;action=android.intent.action.VIEW;type=application/pdf;launchFlags=0x10000000;end|-100|1|1|2|1|1|1|-1||0|com.estrongs.android.pop|com.estrongs.android.pop:drawable/format_pdf|||

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.