1 #!/usr/bin/env python2.5
15 AUTO_FILE = "launcher.db"
17 APPLICATION_COMPONENTS = [
18 "com.google.android.apps.books/com.google.android.apps.books.app.BooksActivity",
19 "com.android.calculator2/com.android.calculator2.Calculator",
20 "com.google.android.camera/com.android.camera.Camera",
21 "com.google.android.carhome/com.google.android.carhome.CarHome",
22 "com.android.providers.downloads.ui/com.android.providers.downloads.ui.DownloadList",
23 "com.google.android.gallery3d/com.android.gallery3d.app.Gallery",
24 "com.google.android.apps.maps/com.google.android.maps.MapsActivity"
28 print "usage: fill_screens.py -- fills up the launcher db"
32 shutil.rmtree(DIR, True)
36 print "pull_file: " + fn
37 rv = os.system("adb pull"
38 + " /data/data/com.android.launcher/databases/launcher.db"
41 print "adb pull failed"
45 print "push_file: " + fn
46 rv = os.system("adb push"
48 + " /data/data/com.android.launcher/databases/launcher.db")
50 print "adb push failed"
54 print "process_file: " + fn
55 conn = sqlite3.connect(fn)
57 c.execute("DELETE FROM favorites")
59 intentFormat = "#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=%s;end"
62 for s in range(SCREENS):
64 for y in range(COLUMNS):
66 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)"
67 insert = insert % (id, "title", "", -100, s, x, y, 1, 1, 2, -1, 0)
73 intent = intentFormat % (APPLICATION_COMPONENTS[id % len(APPLICATION_COMPONENTS)])
74 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)"
75 insert = insert % (id, "title", intent, folder_id, 0, 0, 0, 1, 1, 0, -1, 0)
85 process_file(AUTO_FILE)
90 if __name__=="__main__":