def find_model_via_suffix(pkg_list, suffix_list, dl_lib):
	def filter(path):
		for su in suffix_list:
			if path.endswith(su):
				return True
		return False
	ret = {}
	for pkg in pkg_list:
		decomposed_pkg_path = os.path.join(DECOMPOSED_APK_PATH, pkg)
		models = iterate_dir(decomposed_pkg_path, filter)
		ret[pkg] = models
	DL_MODELS[dl_lib] = ret
Exemplo n.º 2
0
def find_model_via_suffix(pkg_list, suffix_list, dl_lib):
    def filter(path):
        for su in suffix_list:
            if path.endswith(su):
                pathSplited = path.split('.')
                # bin file not find from style
                if '/style/' in path and dl_lib=='ncnn' and len(pathSplited)>1 and path.split('.')[-1]=='bin':
                    continue
                # textures
                if 'textures' in path and dl_lib=='dlib':
                    continue
                return True
        return False
    ret = {}
    for pkg in pkg_list:
        decomposed_pkg_path = os.path.join(config.DECOMPOSED_APK_PATH, pkg)
        models = iterate_dir(decomposed_pkg_path, filter)
        ret[pkg] = models
    DL_MODELS[dl_lib] = ret
Exemplo n.º 3
0
raw_txt = raw_txt.strip().split('\n')
xsl_data = {x.split('\t')[0]: x.split('/\t')[1:] for x in raw_txt}
dl_size = {}
all_size = []
all_dl = []
for app in xsl_data.keys():
    decomposed_dir = os.path.join(DECOMPOSED_APK_PATH, app, 'lib')
    fmk = xsl_data[app][1]

    def get_dl_lib(x):
        return x.endswith(xsl_data[app][0][:-4] + '.so')

    def get_all_lib(x):
        return x.endswith('.so')

    dl_lib = iterate_dir(decomposed_dir, get_dl_lib)
    dl_lib_size = [1.0 * getFileSize(x) / 1024 / 1024 for x in dl_lib]
    all_lib = iterate_dir(decomposed_dir, get_all_lib)
    all_lib_size = [1.0 * getFileSize(x) / 1024 / 1024 for x in all_lib]

    if fmk not in dl_size: dl_size[fmk] = []
    dl_size[fmk] += dl_lib_size
    all_size += all_lib_size
    all_dl += dl_lib_size

for dl in dl_size:
    print dl, np.mean(dl_size[dl])
print np.mean(all_dl), np.mean(all_size)

size = []
dl_size = []
Exemplo n.º 4
0
def get_zips(pkgs):
    ret = []
    for pkg in pkgs:
        ret += iterate_dir(os.path.join(DECOMPOSED_APK_PATH, pkg),
                           extract_filter)
    return ret