本文整理匯總了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;
}