use of com.tencent.tinker.lib.tinker.Tinker in project tinker by Tencent.
the class SampleLoadReporter method onLoadFileNotFound.
/**
* try to recover patch oat file
* @param file
* @param fileType
* @param isDirectory
*/
@Override
public void onLoadFileNotFound(File file, int fileType, boolean isDirectory) {
TinkerLog.i(TAG, "patch loadReporter onLoadFileNotFound: patch file not found: %s, fileType:%d, isDirectory:%b", file.getAbsolutePath(), fileType, isDirectory);
// check dex opt file at last, some phone such as VIVO/OPPO like to change dex2oat to interpreted
if (fileType == ShareConstants.TYPE_DEX_OPT) {
Tinker tinker = Tinker.with(context);
//we can recover at any process except recover process
if (tinker.isMainProcess()) {
File patchVersionFile = tinker.getTinkerLoadResultIfPresent().patchVersionFile;
if (patchVersionFile != null) {
if (UpgradePatchRetry.getInstance(context).onPatchListenerCheck(SharePatchFileUtil.getMD5(patchVersionFile))) {
TinkerLog.i(TAG, "try to repair oat file on patch process");
TinkerInstaller.onReceiveUpgradePatch(context, patchVersionFile.getAbsolutePath());
} else {
TinkerLog.i(TAG, "repair retry exceed must max time, just clean");
checkAndCleanPatch();
}
}
}
} else {
checkAndCleanPatch();
}
SampleTinkerReport.onLoadFileNotFound(fileType);
}
Aggregations