拷贝patch文件拷贝至私有目录,然后调用.:
protected static boolean tryRecoverDexFiles(Tinker manager, ShareSecurityCheck checker, Context context,String patchVersionDirectory, File patchFile) {String dexMeta = checker.getMetaContentMap().get(DEX_META_FILE);boolean result = patchDexExtractViaDexDiff(context, patchVersionDirectory, dexMeta, patchFile);return result;}
- 1
- 2
- 3
- 4
- 5
- 6
- 1
- 2
- 3
- 4
- 5
- 6
直接看xDiff
private static boolean patchDexExtractViaDexDiff(Context context, String patchVersionDirectory, String meta, final File patchFile) {String dir = patchVersionDirectory + "/" + DEX_PATH + "/";if (!extractDexDiffInternals(context, dir, meta, patchFile, TYPE_DEX)) {TinkerLog.w(TAG, "patch recover, extractDiffInternals fail");return false;}final Tinker manager = Tinker.with(context);File dexFiles = new File(dir);File[] files = dexFiles.listFiles();...files遍历执行:DexFile.loadDexreturn true;}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
核心代码主要在als中:
private static boolean extractDexDiffInternals(Context context, String dir, String meta, File patchFile, int type) {//parse metaArrayList patchList = new ArrayList<>();ShareDexDiffPatchInfo.parseDexDiffPatchInfo(meta, patchList);File directory = new File(dir);//I think it is better to extract the raw files from apkTinker manager = Tinker.with(context);ZipFile apk = null;ZipFile patch = null;ApplicationInfo applicationInfo = context.getApplicationInfo();String apkPath = applicationInfo.sourceDir; //base.apkapk = new ZipFile(apkPath);patch = new ZipFile(patchFile);for (ShareDexDiffPatchInfo info : patchList) {final String infoPath = info.path;String patchRealPath;if (infoPath.equals("")) {patchRealPath = info.rawName;} else {patchRealPath = info.path + "/" + info.rawName;}File extractedFile = new File(dir + info.realName);ZipEntry patchFileEntry = patch.getEntry(patchRealPath);ZipEntry rawApkFileEntry = apk.getEntry(patchRealPath);patchDexFile(apk, patch, rawApkFileEntry, patchFileEntry, info, extractedFile);}return true;}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
这里的代码比较关键了,可以看出首先解析了meta里面的信息,meta中包含了patch中每个dex的相关数据 。然后通过拿到,其实就是本机apk的路径以及patch文件;根据mate中的信息开始遍历,其实就是取出对应的dex文件,最后通过对两个dex文件做合并 。- HA Keepalived案例一:Keepalived双机热备精讲
- 2023年小暑热吗
- 十 LiveVideoStackCon讲师热身分享 —— “新潮”AI硬
- CSZ CMS 1.2.7 用户私信XSS漏洞复现+审计+修复建议
- Ubuntu 18.04.5 LTS 引导修复
- NOIP2017列队
- 【Python爬虫】CSDN热榜文章热门词汇分析
- 韩国进口方便面煮面三养火鸡面热干拌面要怎么吃
- amd积热是什么意思
- ipc开头的热点是啥