当前位置: 首页>>代码示例>>Java>>正文


Java ShareBsDiffPatchInfo类代码示例

本文整理汇总了Java中com.tencent.tinker.loader.shareutil.ShareBsDiffPatchInfo的典型用法代码示例。如果您正苦于以下问题:Java ShareBsDiffPatchInfo类的具体用法?Java ShareBsDiffPatchInfo怎么用?Java ShareBsDiffPatchInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ShareBsDiffPatchInfo类属于com.tencent.tinker.loader.shareutil包,在下文中一共展示了ShareBsDiffPatchInfo类的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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:59,代码来源:TinkerSoLoader.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:42,代码来源:TinkerSoLoader.java


注:本文中的com.tencent.tinker.loader.shareutil.ShareBsDiffPatchInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。