本文整理汇总了Java中com.tencent.tinker.loader.shareutil.ShareBsDiffPatchInfo.parseDiffPatchInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ShareBsDiffPatchInfo.parseDiffPatchInfo方法的具体用法?Java ShareBsDiffPatchInfo.parseDiffPatchInfo怎么用?Java ShareBsDiffPatchInfo.parseDiffPatchInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.tinker.loader.shareutil.ShareBsDiffPatchInfo
的用法示例。
在下文中一共展示了ShareBsDiffPatchInfo.parseDiffPatchInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkComplete
import com.tencent.tinker.loader.shareutil.ShareBsDiffPatchInfo; //导入方法依赖的package包/类
/**
* all the library files in meta file exist?
* fast check, only check whether exist
*
* @param directory
* @return boolean
*/
public static boolean checkComplete(String directory, ShareSecurityCheck securityCheck, Intent intentResult) {
String meta = securityCheck.getMetaContentMap().get(SO_MEAT_FILE);
//not found lib
if (meta == null) {
return true;
}
ArrayList<ShareBsDiffPatchInfo> libraryList = new ArrayList<>();
ShareBsDiffPatchInfo.parseDiffPatchInfo(meta, libraryList);
if (libraryList.isEmpty()) {
return true;
}
//tinker//patch-641e634c/lib
String libraryPath = directory + "/" + SO_PATH + "/";
HashMap<String, String> libs = new HashMap<>();
for (ShareBsDiffPatchInfo info : libraryList) {
if (!ShareBsDiffPatchInfo.checkDiffPatchInfo(info)) {
intentResult.putExtra(ShareIntentUtil.INTENT_PATCH_PACKAGE_PATCH_CHECK, ShareConstants.ERROR_PACKAGE_CHECK_LIB_META_CORRUPTED);
ShareIntentUtil.setIntentReturnCode(intentResult, ShareConstants.ERROR_LOAD_PATCH_PACKAGE_CHECK_FAIL);
return false;
}
String middle = info.path + "/" + info.name;
//unlike dex, keep the original structure
libs.put(middle, info.md5);
}
File libraryDir = new File(libraryPath);
if (!libraryDir.exists() || !libraryDir.isDirectory()) {
ShareIntentUtil.setIntentReturnCode(intentResult, ShareConstants.ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST);
return false;
}
//fast check whether there is any dex files missing
for (String relative : libs.keySet()) {
File libFile = new File(libraryPath + relative);
if (!SharePatchFileUtil.isLegalFile(libFile)) {
ShareIntentUtil.setIntentReturnCode(intentResult, ShareConstants.ERROR_LOAD_PATCH_VERSION_LIB_FILE_NOT_EXIST);
intentResult.putExtra(ShareIntentUtil.INTENT_PATCH_MISSING_LIB_PATH, libFile.getAbsolutePath());
return false;
}
}
//if is ok, add to result intent
intentResult.putExtra(ShareIntentUtil.INTENT_PATCH_LIBS_PATH, libs);
return true;
}
示例2: checkComplete
import com.tencent.tinker.loader.shareutil.ShareBsDiffPatchInfo; //导入方法依赖的package包/类
public static boolean checkComplete(String directory, ShareSecurityCheck securityCheck,
Intent intentResult) {
String meta = (String) securityCheck.getMetaContentMap().get("assets/so_meta.txt");
if (meta == null) {
return true;
}
ArrayList<ShareBsDiffPatchInfo> libraryList = new ArrayList();
ShareBsDiffPatchInfo.parseDiffPatchInfo(meta, libraryList);
if (libraryList.isEmpty()) {
return true;
}
String libraryPath = directory + "/" + "lib" + "/";
HashMap<String, String> libs = new HashMap();
Iterator it = libraryList.iterator();
while (it.hasNext()) {
ShareBsDiffPatchInfo info = (ShareBsDiffPatchInfo) it.next();
if (ShareBsDiffPatchInfo.checkDiffPatchInfo(info)) {
libs.put(info.path + "/" + info.name, info.md5);
} else {
intentResult.putExtra(ShareIntentUtil.INTENT_PATCH_PACKAGE_PATCH_CHECK, -4);
ShareIntentUtil.setIntentReturnCode(intentResult, -9);
return false;
}
}
File libraryDir = new File(libraryPath);
if (libraryDir.exists() && libraryDir.isDirectory()) {
for (String relative : libs.keySet()) {
File libFile = new File(libraryPath + relative);
if (!libFile.exists()) {
ShareIntentUtil.setIntentReturnCode(intentResult, -17);
intentResult.putExtra(ShareIntentUtil.INTENT_PATCH_MISSING_LIB_PATH, libFile
.getAbsolutePath());
return false;
}
}
intentResult.putExtra(ShareIntentUtil.INTENT_PATCH_LIBS_PATH, libs);
return true;
}
ShareIntentUtil.setIntentReturnCode(intentResult, -16);
return false;
}