资源简介
Launcher3源码
代码片段和文件信息
#!/usr/bin/env python2.5
import cgi
import os
import shutil
import sys
import sqlite3
SCREENS = 5
COLUMNS = 4
ROWS = 4
CELL_SIZE = 110
DIR = “db_files“
AUTO_FILE = “launcher.db“
APPLICATION_COMPONENTS = [
“com.android.calculator2/com.android.calculator2.Calculator“
“com.android.providers.downloads.ui/com.android.providers.downloads.ui.DownloadList“
“com.android.settings/com.android.settings.Settings“
“com.android.mms/com.android.mms.ui.ConversationList“
“com.android.contacts/com.android.contacts.activities.PeopleActivity“
“com.android.dialer/com.android.dialer.DialtactsActivity“
]
def usage():
print “usage: fill_screens.py -- fills up the launcher db“
def make_dir():
shutil.rmtree(DIR True)
os.makedirs(DIR)
def pull_file(fn):
print “pull_file: “ + fn
rv = os.system(“adb pull“
+ “ /data/data/com.android.launcher/databases/launcher.db“
+ “ “ + fn);
if rv != 0:
print “adb pull failed“
sys.exit(1)
def push_file(fn):
print “push_file: “ + fn
rv = os.system(“adb push“
+ “ “ + fn
+ “ /data/data/com.android.launcher/databases/launcher.db“)
if rv != 0:
print “adb push failed“
sys.exit(1)
def process_file(fn):
print “process_file: “ + fn
conn = sqlite3.connect(fn)
c = conn.cursor()
c.execute(“DELETE FROM favorites“)
intentFormat = “#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=%s;end“
id = 0;
for s in range(SCREENS):
for x in range(ROWS):
for y in range(COLUMNS):
id += 1
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)“
insert = insert % (id “title“ ““ -100 s x y 1 1 2 -1 0)
c.execute(insert)
folder_id = id
for z in range(15):
id += 1
intent = intentFormat % (APPLICATION_COMPONENTS[id % len(APPLICATION_COMPONENTS)])
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)“
insert = insert % (id “title“ intent folder_id 0 0 0 1 1 0 -1 0)
c.execute(insert)
conn.commit()
c.close()
def main(argv):
if len(argv) == 1:
make_dir()
pull_file(AUTO_FILE)
process_file(AUTO_FILE)
push_file(AUTO_FILE)
else:
usage()
if __name__==“__main__“:
main(sys.argv)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-07-10 23:10 Launcher3\
文件 196 2016-07-10 00:40 Launcher3\.gitignore
文件 2577 2016-07-10 00:40 Launcher3\Android.mk
文件 10702 2016-07-10 01:13 Launcher3\AndroidManifest.xm
文件 2904 2016-07-10 00:40 Launcher3\CleanSpec.mk
文件 0 2016-07-10 00:40 Launcher3\MODULE_LICENSE_APACHE2
文件 10695 2016-07-10 00:40 Launcher3\NOTICE
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\
文件 330 2016-07-10 00:40 Launcher3\WallpaperPicker\AndroidManifest.xm
文件 278 2016-07-10 00:40 Launcher3\WallpaperPicker\README
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\res\
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\res\drawable\
文件 1626 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable\wallpaper_tile_fg.xm
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\res\drawable-hdpi\
文件 1335 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-hdpi\ic_actionbar_accept.png
文件 354 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-hdpi\ic_images.png
文件 159 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-hdpi\tile_shadow_bottom.9.png
文件 148 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-hdpi\tile_shadow_top.9.png
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\res\drawable-mdpi\
文件 1191 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-mdpi\ic_actionbar_accept.png
文件 249 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-mdpi\ic_images.png
文件 140 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-mdpi\tile_shadow_bottom.9.png
文件 138 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-mdpi\tile_shadow_top.9.png
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\res\drawable-v21\
文件 1077 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-v21\ic_tick.xm
文件 1309 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-v21\wallpaper_tile_fg.xm
目录 0 2016-07-10 23:10 Launcher3\WallpaperPicker\res\drawable-xhdpi\
文件 1599 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-xhdpi\ic_actionbar_accept.png
文件 431 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-xhdpi\ic_images.png
文件 164 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-xhdpi\tile_shadow_bottom.9.png
文件 151 2016-07-10 00:40 Launcher3\WallpaperPicker\res\drawable-xhdpi\tile_shadow_top.9.png
............此处省略950个文件信息
评论
共有 条评论