1 #!/usr/bin/env python2.5
15 AUTO_FILE = "launcher.db"
17 APPLICATION_COMPONENTS = [
18 "com.android.calculator2/com.android.calculator2.Calculator",
19 "com.android.providers.downloads.ui/com.android.providers.downloads.ui.DownloadList",
20 "com.android.settings/com.android.settings.Settings",
21 "com.android.mms/com.android.mms.ui.ConversationList",
22 "com.android.contacts/com.android.contacts.activities.PeopleActivity",
23 "com.android.dialer/com.android.dialer.DialtactsActivity"
27 print "usage: fill_screens.py -- fills up the launcher db"
31 shutil.rmtree(DIR, True)
35 print "pull_file: " + fn
36 rv = os.system("adb pull"
37 + " /data/data/com.android.launcher/databases/launcher.db"
40 print "adb pull failed"
44 print "push_file: " + fn
45 rv = os.system("adb push"
47 + " /data/data/com.android.launcher/databases/launcher.db")
49 print "adb push failed"
53 print "process_file: " + fn
54 conn = sqlite3.connect(fn)
56 c.execute("DELETE FROM favorites")
58 intentFormat = "#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=%s;end"
61 for s in range(SCREENS):
63 for y in range(COLUMNS):
65 insert = "INSERT into favorites (_id, title, intent, container, screen, cellX, cellY, spanX, spanY, itemType, appWidgetId, iconType) VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d)"
66 insert = insert % (id, "title", "", -100, s, x, y, 1, 1, 2, -1, 0)
72 intent = intentFormat % (APPLICATION_COMPONENTS[id % len(APPLICATION_COMPONENTS)])
73 insert = "INSERT into favorites (_id, title, intent, container, screen, cellX, cellY, spanX, spanY, itemType, appWidgetId, iconType) VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d)"
74 insert = insert % (id, "title", intent, folder_id, 0, 0, 0, 1, 1, 0, -1, 0)
84 process_file(AUTO_FILE)
89 if __name__=="__main__":