Sophix,Tinker简介:
https://www.cnblogs.com/ldq2016/p/10449433.html
Tinker:
安装过程 https://blog.csdn.net/qq_22393017/article/details/82110343
Tinker和QQ空间方案最大的不同是,Tinker 下发新旧DEX的差异包,然后将差异包和旧包合成新dex之后进行dex的全量替换,这样也就避免了QQ空间中的插桩操作。以上就是tinker热修复中代码加载实现的原理了。
https://zhuanlan.zhihu.com/p/54781576
Tinker的热修复使用了ClassCloader的类加载机制,将修复的类放到dex 数组的前面
整个流程主要包含两部分: patch的合成(UpgradePatch.java)以及 Patch的安装(TinkerLoader.java)两部分,
TinkerDexLoader: 负责加载dex,将修复的类放到dex 数组的前面
TinkerResourceLoader: 负责加载resource, 反射调用AssetManager的addAssetPath,添加资源apk(resource.apk)
TinkerSoLoader: 负责加载so
patch的合成过程:https://yuqirong.me/2019/03/14/Tinker%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90(%E5%85%AD)/
收到Patch,启动TinkerPatchService(本质是一个IntentService),进行Patch的检验,合成 ,通过patch的MD5作为当前patch的version,如果version一致,则patch无变化,不需要合成
app进程启动时,通过TinkerLoader的tryLoad 加载已合成后的patch
tinker接入事项:
1 在gradle.property中配置如下:
#设为true,才可以执行patch打包,需要关闭instant run,默认打包时,需要更改 TINKER_ENABLE = false
TINKER_ENABLE = true
# VERSION_CODE 用于设置打基准包的版本号,每次打patch,需要根据当前的版本有必要的进行修改
VERSION_CODE = 220900
3 执行相应环境的tinkerPatch task,比如tinkerPatchDongmanQaforservice,patch生成目录为
app/build/outputs/tinkerPatch/dongman/当前环境/patch_signed_7zip.apk
4 tinker针对多一个base apk,可以多次修复,这需要保证base apk的 tinkerId一致,同时需要改tinker.gradle中的patchVersion的版本
5 tinker支持新增activity
tinker内部配置:
1 默认最大重试加载patch次数 5次,定义在UpgradePatchRetry.java
2 如果app冷启动时,联系发生3次crash,从app启动到crash时间小于10ms,tinker会清除patch。
逻辑定义在SampleUncaughtExceptionHandler.java
3 TinkerPatchListener 用来检查patch的合法性
4 TinkerPatchReporter 用来上报patch的解析过程中的每个阶段的状态
5 TinkerUpgradePatch 真正用来patch加载的过程
6 加载过程中的ErrorCode可参见 ShareConstants.java
参见ShareTinkerInternals.java 中的 checkSignatureAndTinkerID()
7 tinker针对多一个base apk,可以多次修复,这需要保证base apk的 tinkerId一致,同时需要求改tinker.gradle中的patchVersion的版本
8 tinker支持新增activity,采用了插件化原理,在androidManifest.xml 中插入坑位,startActivity时,用代理activity来启动新增的activity
原理可见:ComponentHotplug.java(hook AMS,) IncrementComponentManager.java (保存新增Patch的activity)
AMSInterceptHandler.java(拦截启动,用代理替换),MHMessageHandler(启动真正的targetActivity),PMSInterceptHandler.java(hook了PMS)
测试方面: 多机型(三星,华为,小米,oppo,vivio 测试),多个Android平台(android 4.2,5.0,6.0,7.0,8.0,9.0)
待确认: 目前没有开启加固模式,在360的加密渠道包上,能否修复成功?
从Android 9开始,华为9.0(PAR-AL00)手机,tinker可正常修复
tinker patch加载步骤:
第一次启动 1 解析patch,获取diffDex,2 dex 优化
日志如下:
(standard input):42473:09-16 16:30:33.512 2761 2761 D TinkerPatchUtils: path: /storage/emulated/0/patch_signed_7zip.apk exsit
(standard input):42477:09-16 16:30:33.512 2761 2761 D TinkerPatchUtils: can read: true , size: 17763
(standard input):42481:09-16 16:30:33.515 2761 2761 D TinkerPatchUtils: path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk exsit
(standard input):42485:09-16 16:30:33.515 2761 2761 D TinkerPatchUtils: can read: true , size: 17763
(standard input):42489:09-16 16:30:33.516 2761 2761 D Tinker.TinkerPatchListener: onLoadInterpret path=/data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk
(standard input):42493:09-16 16:30:33.516 2761 2761 I Tinker.TinkerPatchListener: receive a patch file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk, file size:17763
(standard input):42506:09-16 16:30:33.539 2761 2761 W Tinker.UpgradePatchRetry: onPatchListenerCheck retry file is not exist, just return
(standard input):42507:09-16 16:30:33.539 2761 2761 D Tinker.TinkerPatchListener: checkForPatchRecover returnCode=0
(standard input):42508:09-16 16:30:33.541 2761 2761 D Tinker.TinkerPatchListener: get platform:all
(standard input):42611:09-16 16:30:33.651 3487 3487 W Tinker.TinkerLoader: tryLoadPatchFiles: we don't load patch with :patch process itself, just return
(standard input):42652:09-16 16:30:33.664 3487 3487 D Tinker.DefaultAppLike: onBaseContextAttached:
(standard input):42660:09-16 16:30:33.671 3487 3487 I Tinker.TinkerPatchListener: application maxMemory:256
(standard input):42664:09-16 16:30:33.675 3487 3487 W Tinker.Tinker: tinker patch directory: /data/user/0/com.naver.linewebtoon.cn/tinker
(standard input):42668:09-16 16:30:33.676 3487 3487 I Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.2
(standard input):42672:09-16 16:30:33.679 3487 3487 I Tinker.TinkerLoadResult: parseTinkerResult loadCode:-1, process name:com.naver.linewebtoon.cn:patch, main process:false, systemOTA:false, fingerPrint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys, oatDir:null, useInterpretMode:false
(standard input):42676:09-16 16:30:33.679 3487 3487 W Tinker.TinkerLoadResult: tinker is disable, just return
(standard input):42680:09-16 16:30:33.679 3487 3487 I Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/com.naver.linewebtoon.cn/tinker, code: -1, cost: 2ms
(standard input):42684:09-16 16:30:33.680 3487 3487 D Tinker.TinkerLoadReporter: onLoadResult loadCode=-1
(standard input):42688:09-16 16:30:33.680 3487 3487 W Tinker.Tinker: tinker load fail!
(standard input):42692:09-16 16:30:33.682 3487 3487 I Tinker.ComponentHotplug: method install() is not invoked, ignore ensuring operations.
(standard input):42694:09-16 16:30:33.682 3487 3487 D Tinker.DefaultAppLike: onCreate
(standard input):42698:09-16 16:30:33.686 3487 3515 I Tinker.DefaultPatchReporter: patchReporter onPatchServiceStart: patch service start
(standard input):42702:09-16 16:30:33.687 3487 3487 W Tinker.UpgradePatchRetry: onPatchRetryLoad retry is not main process, just return
(standard input):42754:09-16 16:30:33.702 3487 3515 W Tinker.UpgradePatchRetry: try copy file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk to /data/user/0/com.naver.linewebtoon.cn/tinker_temp/temp.apk
(standard input):42774:09-16 16:30:33.713 3487 3515 D Tinker.TinkerPatchReporter: onPatchServiceStart ...
(standard input):42779:09-16 16:30:33.714 3487 3515 I Tinker.TinkerPatchService: try to increase patch process priority
(standard input):42791:09-16 16:30:33.800 3487 3515 I Tinker.UpgradePatch: UpgradePatch tryPatch:patchMd5:67ae84e03f4daff9e75b872320e8a770
(standard input):42795:09-16 16:30:33.802 3487 3515 W Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.naver.linewebtoon.cn/tinker/patch.info (No such file or directory)
(standard input):42799:09-16 16:30:33.802 3487 3515 W Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.naver.linewebtoon.cn/tinker/patch.info (No such file or directory)
(standard input):42803:09-16 16:30:33.802 3487 3515 I Tinker.UpgradePatch: UpgradePatch tryPatch:patchVersionDirectory:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0
(standard input):42807:09-16 16:30:33.804 3487 3515 W Tinker.UpgradePatch: UpgradePatch copy patch file, src file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk size: 17763, dest file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/patch-67ae84e0.apk size:17763
(standard input):42811:09-16 16:30:33.808 3487 3515 I Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar
(standard input):42815:09-16 16:30:33.816 3487 3515 I Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
(standard input):42819:09-16 16:30:33.816 3487 3515 I Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/test.dex.jar
(standard input):42823:09-16 16:30:33.820 3487 3515 I Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
(standard input):42827:09-16 16:30:33.827 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/test.dex.jar
(standard input):42831:09-16 16:30:33.828 3487 3515 I Tinker.DexDiffPatchInternal: merge classN dex file /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk, result: true, size: 470, use: 7ms
(standard input):42835:09-16 16:30:33.830 3487 3515 D Tinker.TinkerInternals: getCurrentInstructionSet:arm
(standard input):42839:09-16 16:30:33.831 3487 3515 I Tinker.DexDiffPatchInternal: patch recover, try to optimize dex file count:2, optimizeDexDirectory:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/odex/
(standard input):42854:09-16 16:30:33.833 3487 3515 I Tinker.DexDiffPatchInternal: start to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar, size: 10849
(standard input):42869:09-16 16:30:33.860 3521 3521 I dex2oat : /system/bin/dex2oat --debuggable --debuggable --dex-file=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar --output-vdex-fd=50 --oat-fd=51 --oat-location=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/changed_classes.dex.odex --compiler-filter=quicken
(standard input):42881:09-16 16:30:33.943 3487 3515 I Tinker.DexDiffPatchInternal: success to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar, opt file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/changed_classes.dex.odex, opt file size: 16808, use time 110
(standard input):42885:09-16 16:30:33.943 3487 3515 I Tinker.DexDiffPatchInternal: start to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk, size: 470
(standard input):42895:09-16 16:30:33.990 3539 3539 I dex2oat : /system/bin/dex2oat --debuggable --debuggable --dex-file=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk --output-vdex-fd=50 --oat-fd=51 --oat-location=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/tinker_classN.odex --compiler-filter=quicken
(standard input):42909:09-16 16:30:34.068 3487 3515 I Tinker.DexDiffPatchInternal: success to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk, opt file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/tinker_classN.odex, opt file size: 16808, use time 124
(standard input):42910:09-16 16:30:34.068 3487 3515 I Tinker.DexDiffPatchInternal: recover dex result:true, cost:263
(standard input):42911:09-16 16:30:34.068 3487 3515 W Tinker.BsDiffPatchInternal: patch recover, library is not contained
(standard input):42912:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: res dir: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/, meta: resArscMd5:a9d829145135d831eef1d41d4b4d79ee
(standard input):42913:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: arscBaseCrc:2866433521
(standard input):42914:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: pattern:resources\.arsc
(standard input):42915:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: pattern:assets/.*
(standard input):42916:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: pattern:res/.*
(standard input):42917:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: addedSet:assets/only_use_to_test_tinker_resource.txt
(standard input):42918:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: largeModifiedSet:resources.arsc
(standard input):42925:09-16 16:30:34.256 3487 3515 W Tinker.ResDiffPatchInternal: success recover large modify file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/res_temp/resources.arsc, file size:1124900, use time:183
(standard input):42929:09-16 16:30:34.256 3487 3515 W Tinker.ResDiffPatchInternal: success recover all large modify and store resources use time:186
(standard input):42984:09-16 16:30:35.025 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/res_temp/resources.arsc
(standard input):42985:09-16 16:30:35.026 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/res_temp
(standard input):42986:09-16 16:30:35.041 3487 3515 I Tinker.ResDiffPatchInternal: final new resource file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/resources.apk, entry count:2336, size:12059197
(standard input):42987:09-16 16:30:35.041 3487 3515 I Tinker.ResDiffPatchInternal: recover resource result:true, cost:972
(standard input):42988:09-16 16:30:35.041 3487 3515 I Tinker.DexDiffPatchInternal: raw dex count: 2, dex opt dex count: 2, final wait times: 16
(standard input):42992:09-16 16:30:35.044 3487 3515 I
(standard input):42473:09-16 16:30:33.512 2761 2761 D TinkerPatchUtils: path: /storage/emulated/0/patch_signed_7zip.apk exsit
(standard input):42477:09-16 16:30:33.512 2761 2761 D TinkerPatchUtils: can read: true , size: 17763
(standard input):42481:09-16 16:30:33.515 2761 2761 D TinkerPatchUtils: path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk exsit
(standard input):42485:09-16 16:30:33.515 2761 2761 D TinkerPatchUtils: can read: true , size: 17763
(standard input):42489:09-16 16:30:33.516 2761 2761 D Tinker.TinkerPatchListener: onLoadInterpret path=/data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk
(standard input):42493:09-16 16:30:33.516 2761 2761 I Tinker.TinkerPatchListener: receive a patch file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk, file size:17763
(standard input):42506:09-16 16:30:33.539 2761 2761 W Tinker.UpgradePatchRetry: onPatchListenerCheck retry file is not exist, just return
(standard input):42507:09-16 16:30:33.539 2761 2761 D Tinker.TinkerPatchListener: checkForPatchRecover returnCode=0
(standard input):42508:09-16 16:30:33.541 2761 2761 D Tinker.TinkerPatchListener: get platform:all
(standard input):42611:09-16 16:30:33.651 3487 3487 W Tinker.TinkerLoader: tryLoadPatchFiles: we don't load patch with :patch process itself, just return
(standard input):42652:09-16 16:30:33.664 3487 3487 D Tinker.DefaultAppLike: onBaseContextAttached:
(standard input):42660:09-16 16:30:33.671 3487 3487 I Tinker.TinkerPatchListener: application maxMemory:256
(standard input):42664:09-16 16:30:33.675 3487 3487 W Tinker.Tinker: tinker patch directory: /data/user/0/com.naver.linewebtoon.cn/tinker
(standard input):42668:09-16 16:30:33.676 3487 3487 I Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.2
(standard input):42672:09-16 16:30:33.679 3487 3487 I Tinker.TinkerLoadResult: parseTinkerResult loadCode:-1, process name:com.naver.linewebtoon.cn:patch, main process:false, systemOTA:false, fingerPrint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys, oatDir:null, useInterpretMode:false
(standard input):42676:09-16 16:30:33.679 3487 3487 W Tinker.TinkerLoadResult: tinker is disable, just return
(standard input):42680:09-16 16:30:33.679 3487 3487 I Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/com.naver.linewebtoon.cn/tinker, code: -1, cost: 2ms
(standard input):42684:09-16 16:30:33.680 3487 3487 D Tinker.TinkerLoadReporter: onLoadResult loadCode=-1
(standard input):42688:09-16 16:30:33.680 3487 3487 W Tinker.Tinker: tinker load fail!
(standard input):42692:09-16 16:30:33.682 3487 3487 I Tinker.ComponentHotplug: method install() is not invoked, ignore ensuring operations.
(standard input):42694:09-16 16:30:33.682 3487 3487 D Tinker.DefaultAppLike: onCreate
(standard input):42698:09-16 16:30:33.686 3487 3515 I Tinker.DefaultPatchReporter: patchReporter onPatchServiceStart: patch service start
(standard input):42702:09-16 16:30:33.687 3487 3487 W Tinker.UpgradePatchRetry: onPatchRetryLoad retry is not main process, just return
(standard input):42754:09-16 16:30:33.702 3487 3515 W Tinker.UpgradePatchRetry: try copy file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk to /data/user/0/com.naver.linewebtoon.cn/tinker_temp/temp.apk
(standard input):42774:09-16 16:30:33.713 3487 3515 D Tinker.TinkerPatchReporter: onPatchServiceStart ...
(standard input):42779:09-16 16:30:33.714 3487 3515 I Tinker.TinkerPatchService: try to increase patch process priority
(standard input):42791:09-16 16:30:33.800 3487 3515 I Tinker.UpgradePatch: UpgradePatch tryPatch:patchMd5:67ae84e03f4daff9e75b872320e8a770
(standard input):42795:09-16 16:30:33.802 3487 3515 W Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.naver.linewebtoon.cn/tinker/patch.info (No such file or directory)
(standard input):42799:09-16 16:30:33.802 3487 3515 W Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.naver.linewebtoon.cn/tinker/patch.info (No such file or directory)
(standard input):42803:09-16 16:30:33.802 3487 3515 I Tinker.UpgradePatch: UpgradePatch tryPatch:patchVersionDirectory:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0
(standard input):42807:09-16 16:30:33.804 3487 3515 W Tinker.UpgradePatch: UpgradePatch copy patch file, src file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk size: 17763, dest file: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/patch-67ae84e0.apk size:17763
(standard input):42811:09-16 16:30:33.808 3487 3515 I Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar
(standard input):42815:09-16 16:30:33.816 3487 3515 I Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
(standard input):42819:09-16 16:30:33.816 3487 3515 I Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/test.dex.jar
(standard input):42823:09-16 16:30:33.820 3487 3515 I Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
(standard input):42827:09-16 16:30:33.827 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/test.dex.jar
(standard input):42831:09-16 16:30:33.828 3487 3515 I Tinker.DexDiffPatchInternal: merge classN dex file /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk, result: true, size: 470, use: 7ms
(standard input):42835:09-16 16:30:33.830 3487 3515 D Tinker.TinkerInternals: getCurrentInstructionSet:arm
(standard input):42839:09-16 16:30:33.831 3487 3515 I Tinker.DexDiffPatchInternal: patch recover, try to optimize dex file count:2, optimizeDexDirectory:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/odex/
(standard input):42854:09-16 16:30:33.833 3487 3515 I Tinker.DexDiffPatchInternal: start to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar, size: 10849
(standard input):42869:09-16 16:30:33.860 3521 3521 I dex2oat : /system/bin/dex2oat --debuggable --debuggable --dex-file=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar --output-vdex-fd=50 --oat-fd=51 --oat-location=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/changed_classes.dex.odex --compiler-filter=quicken
(standard input):42881:09-16 16:30:33.943 3487 3515 I Tinker.DexDiffPatchInternal: success to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar, opt file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/changed_classes.dex.odex, opt file size: 16808, use time 110
(standard input):42885:09-16 16:30:33.943 3487 3515 I Tinker.DexDiffPatchInternal: start to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk, size: 470
(standard input):42895:09-16 16:30:33.990 3539 3539 I dex2oat : /system/bin/dex2oat --debuggable --debuggable --dex-file=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk --output-vdex-fd=50 --oat-fd=51 --oat-location=/data/data/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/tinker_classN.odex --compiler-filter=quicken
(standard input):42909:09-16 16:30:34.068 3487 3515 I Tinker.DexDiffPatchInternal: success to parallel optimize dex /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk, opt file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/tinker_classN.odex, opt file size: 16808, use time 124
(standard input):42910:09-16 16:30:34.068 3487 3515 I Tinker.DexDiffPatchInternal: recover dex result:true, cost:263
(standard input):42911:09-16 16:30:34.068 3487 3515 W Tinker.BsDiffPatchInternal: patch recover, library is not contained
(standard input):42912:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: res dir: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/, meta: resArscMd5:a9d829145135d831eef1d41d4b4d79ee
(standard input):42913:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: arscBaseCrc:2866433521
(standard input):42914:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: pattern:resources\.arsc
(standard input):42915:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: pattern:assets/.*
(standard input):42916:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: pattern:res/.*
(standard input):42917:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: addedSet:assets/only_use_to_test_tinker_resource.txt
(standard input):42918:09-16 16:30:34.070 3487 3515 I Tinker.ResDiffPatchInternal: largeModifiedSet:resources.arsc
(standard input):42925:09-16 16:30:34.256 3487 3515 W Tinker.ResDiffPatchInternal: success recover large modify file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/res_temp/resources.arsc, file size:1124900, use time:183
(standard input):42929:09-16 16:30:34.256 3487 3515 W Tinker.ResDiffPatchInternal: success recover all large modify and store resources use time:186
(standard input):42984:09-16 16:30:35.025 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/res_temp/resources.arsc
(standard input):42985:09-16 16:30:35.026 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/res_temp
(standard input):42986:09-16 16:30:35.041 3487 3515 I Tinker.ResDiffPatchInternal: final new resource file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/resources.apk, entry count:2336, size:12059197
(standard input):42987:09-16 16:30:35.041 3487 3515 I Tinker.ResDiffPatchInternal: recover resource result:true, cost:972
(standard input):42988:09-16 16:30:35.041 3487 3515 I Tinker.DexDiffPatchInternal: raw dex count: 2, dex opt dex count: 2, final wait times: 16
(standard input):42992:09-16 16:30:35.044 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file exist: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/changed_classes.dex.odex, size 16808
(standard input):42996:09-16 16:30:35.044 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file exist: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/tinker_classN.odex, size 16808
(standard input):43000:09-16 16:30:35.045 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file format: changed_classes.dex.odex, size 16808
(standard input):43004:09-16 16:30:35.049 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file format: tinker_classN.odex, size 16808
(standard input):43008:09-16 16:30:35.052 3487 3515 I Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.naver.linewebtoon.cn/tinker/patch.info , oldVer:, newVer:67ae84e03f4daff9e75b872320e8a770, fingerprint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys, oatDir:odex
(standard input):43012:09-16 16:30:35.054 3487 3515 W Tinker.UpgradePatch: UpgradePatch tryPatch: done, it is ok
(standard input):43015:09-16 16:30:35.054 3487 3515 D Tinker.TinkerUpgradePatch: TinkerUpgradePatch tryPatch result: true
(standard input):43019:09-16 16:30:35.055 3487 3515 I Tinker.DefaultPatchReporter: patchReporter onPatchResult: patch all result path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk, success: true, cost: 1341
(standard input):43023:09-16 16:30:35.055 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker_temp/temp.apk
(standard input):43027:09-16 16:30:35.055 3487 3515 D Tinker.TinkerPatchReporter: onPatchResult success=true|cost=1341
check dex optimizer file exist: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/changed_classes.dex.odex, size 16808
(standard input):42996:09-16 16:30:35.044 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file exist: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/oat/arm/tinker_classN.odex, size 16808
(standard input):43000:09-16 16:30:35.045 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file format: changed_classes.dex.odex, size 16808
(standard input):43004:09-16 16:30:35.049 3487 3515 I Tinker.DexDiffPatchInternal: check dex optimizer file format: tinker_classN.odex, size 16808
(standard input):43008:09-16 16:30:35.052 3487 3515 I Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.naver.linewebtoon.cn/tinker/patch.info , oldVer:, newVer:67ae84e03f4daff9e75b872320e8a770, fingerprint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys, oatDir:odex
(standard input):43012:09-16 16:30:35.054 3487 3515 W Tinker.UpgradePatch: UpgradePatch tryPatch: done, it is ok
(standard input):43015:09-16 16:30:35.054 3487 3515 D Tinker.TinkerUpgradePatch: TinkerUpgradePatch tryPatch result: true
(standard input):43019:09-16 16:30:35.055 3487 3515 I Tinker.DefaultPatchReporter: patchReporter onPatchResult: patch all result path: /data/user/0/com.naver.linewebtoon.cn/tinker/patch_signed_7zip.apk, success: true, cost: 1341
(standard input):43023:09-16 16:30:35.055 3487 3515 I Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.naver.linewebtoon.cn/tinker_temp/temp.apk
(standard input):43027:09-16 16:30:35.055 3487 3515 D Tinker.TinkerPatchReporter: onPatchResult success=true|cost=1341
下一次冷启动,开始通过TinkerClassLoader 去load diffPatch ,然后通过使用合成后的dex,进行全量替换
日志如下:
(standard input):56422:09-16 16:55:50.123 5699 5699 D Tinker.TinkerInternals: getCurrentInstructionSet:arm
(standard input):56423:09-16 16:55:50.124 5699 5699 W Tinker.TinkerLoader: tryLoadPatchFiles:isEnabledForResource:true
(standard input):56426:09-16 16:55:50.126 5699 5699 D Tinker.TinkerInternals: same fingerprint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys
(standard input):56427:09-16 16:55:50.126 5699 5699 I Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.naver.linewebtoon.cn/tinker/patch.info , oldVer:67ae84e03f4daff9e75b872320e8a770, newVer:67ae84e03f4daff9e75b872320e8a770, fingerprint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys, oatDir:odex
(standard input):56431:09-16 16:55:50.130 5699 5699 W Tinker.TinkerLoader: tinker safe mode preferName:tinker_own_config_com.naver.linewebtoon.cn count:1
(standard input):56438:09-16 16:55:50.136 5699 5699 I Tinker.TinkerDexLoader: classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.naver.linewebtoon.cn-zpDk2TXqDwPCpDhbGhMhfA==/base.apk"],nativeLibraryDirectories=[/data/app/com.naver.linewebtoon.cn-zpDk2TXqDwPCpDhbGhMhfA==/lib/arm, /data/app/com.naver.linewebtoon.cn-zpDk2TXqDwPCpDhbGhMhfA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]]
(standard input):56439:09-16 16:55:50.136 5699 5699 I Tinker.TinkerDexLoader: verify dex file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk md5, use time: 0
(standard input):56441:09-16 16:55:50.136 5699 5699 I Tinker.ClassLoaderAdder: installDexes dexOptDir: /data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/odex, dex size:2
(standard input):56444:09-16 16:55:50.145 5699 5699 I Tinker.ClassLoaderAdder: after loaded classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/changed_classes.dex.jar", zip file "/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/dex/tinker_classN.apk", zip file "/data/app/com.naver.linewebtoon.cn-zpDk2TXqDwPCpDhbGhMhfA==/base.apk"],nativeLibraryDirectories=[/data/app/com.naver.linewebtoon.cn-zpDk2TXqDwPCpDhbGhMhfA==/lib/arm, /data/app/com.naver.linewebtoon.cn-zpDk2TXqDwPCpDhbGhMhfA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]], dex size:2
(standard input):56445:09-16 16:55:50.145 5699 5699 W Tinker.ClassLoaderAdder: checkDexInstall result:true
(standard input):56449:09-16 16:55:50.148 5699 5699 W Tinker.ResourcePatcher: try to clear typedArray cache!
(standard input):56452:09-16 16:55:50.150 5699 5699 I Tinker.ResourcePatcher: checkResUpdate success, found test resource assets file only_use_to_test_tinker_resource.txt
(standard input):56453:09-16 16:55:50.150 5699 5699 I Tinker.ResourceLoader: monkeyPatchExistingResources resource file:/data/user/0/com.naver.linewebtoon.cn/tinker/patch-67ae84e0/res/resources.apk, use time: 5
(standard input):56461:09-16 16:55:50.179 5699 5699 I Tinker.ComponentHotplug: installed successfully.
(standard input):56462:09-16 16:55:50.179 5699 5699 I Tinker.TinkerLoader: tryLoadPatchFiles: load end, ok!
(standard input):56467:09-16 16:55:50.188 5699 5699 D Tinker.DefaultAppLike: onBaseContextAttached:
(standard input):56469:09-16 16:55:50.189 5699 5699 I Tinker.TinkerPatchListener: application maxMemory:256
(standard input):56471:09-16 16:55:50.191 5699 5699 W Tinker.Tinker: tinker patch directory: /data/user/0/com.naver.linewebtoon.cn/tinker
(standard input):56472:09-16 16:55:50.191 5699 5699 I Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.2
(standard input):56473:09-16 16:55:50.192 5699 5699 I Tinker.TinkerLoadResult: parseTinkerResult loadCode:0, process name:com.naver.linewebtoon.cn, main process:true, systemOTA:false, fingerPrint:Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/8.7.5:user/release-keys, oatDir:odex, useInterpretMode:false
(standard input):56474:09-16 16:55:50.193 5699 5699 I Tinker.TinkerLoadResult: parseTinkerResult oldVersion:, newVersion:67ae84e03f4daff9e75b872320e8a770, current:67ae84e03f4daff9e75b872320e8a770
(standard input):56475:09-16 16:55:50.193 5699 5699 I Tinker.TinkerLoadResult: oh yeah, tinker load all success
(standard input):56476:09-16 16:55:50.193 5699 5699 I Tinker.DefaultLoadR