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


Java Tinker.isEnabledForNativeLib方法代码示例

本文整理汇总了Java中com.tencent.tinker.lib.tinker.Tinker.isEnabledForNativeLib方法的典型用法代码示例。如果您正苦于以下问题:Java Tinker.isEnabledForNativeLib方法的具体用法?Java Tinker.isEnabledForNativeLib怎么用?Java Tinker.isEnabledForNativeLib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tencent.tinker.lib.tinker.Tinker的用法示例。


在下文中一共展示了Tinker.isEnabledForNativeLib方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tryRecoverLibraryFiles

import com.tencent.tinker.lib.tinker.Tinker; //导入方法依赖的package包/类
protected static boolean tryRecoverLibraryFiles(Tinker manager, ShareSecurityCheck checker, Context context,
                                                String patchVersionDirectory, File patchFile) {

    if (!manager.isEnabledForNativeLib()) {
        TinkerLog.w(TAG, "patch recover, library is not enabled");
        return true;
    }
    String libMeta = checker.getMetaContentMap().get(SO_META_FILE);

    if (libMeta == null) {
        TinkerLog.w(TAG, "patch recover, library is not contained");
        return true;
    }
    long begin = SystemClock.elapsedRealtime();
    boolean result = patchLibraryExtractViaBsDiff(context, patchVersionDirectory, libMeta, patchFile);
    long cost = SystemClock.elapsedRealtime() - begin;
    TinkerLog.i(TAG, "recover lib result:%b, cost:%d", result, cost);
    return result;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:BsDiffPatchInternal.java

示例2: tryRecoverLibraryFiles

import com.tencent.tinker.lib.tinker.Tinker; //导入方法依赖的package包/类
protected static boolean tryRecoverLibraryFiles(Tinker manager, ShareSecurityCheck checker,
                                                Context context, String
                                                        patchVersionDirectory, File
                                                        patchFile, boolean isUpgradePatch) {
    if (manager.isEnabledForNativeLib()) {
        String libMeta = (String) checker.getMetaContentMap().get(ShareConstants.SO_META_FILE);
        if (libMeta == null) {
            TinkerLog.w(TAG, "patch recover, library is not contained", new Object[0]);
            return true;
        }
        long begin = SystemClock.elapsedRealtime();
        long cost = SystemClock.elapsedRealtime() - begin;
        TinkerLog.i(TAG, "recover lib result:%b, cost:%d, isUpgradePatch:%b", Boolean.valueOf
                (patchLibraryExtractViaBsDiff(context, patchVersionDirectory, libMeta,
                        patchFile, isUpgradePatch)), Long.valueOf(cost), Boolean.valueOf
                (isUpgradePatch));
        return patchLibraryExtractViaBsDiff(context, patchVersionDirectory, libMeta,
                patchFile, isUpgradePatch);
    }
    TinkerLog.w(TAG, "patch recover, library is not enabled", new Object[0]);
    return true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:BsDiffPatchInternal.java

示例3: tryRecoverLibraryFiles

import com.tencent.tinker.lib.tinker.Tinker; //导入方法依赖的package包/类
public static boolean tryRecoverLibraryFiles(Tinker manager, ShareSecurityCheck checker, Context context,
                                                String patchVersionDirectory, File patchFile) {

    if (!manager.isEnabledForNativeLib()) {
        TinkerLog.w(TAG, "patch recover, library is not enabled");
        return true;
    }
    String libMeta = checker.getMetaContentMap().get(SO_META_FILE);

    if (libMeta == null) {
        TinkerLog.w(TAG, "patch recover, library is not contained");
        return true;
    }
    long begin = SystemClock.elapsedRealtime();
    boolean result = patchLibraryExtractViaBsDiff(context, patchVersionDirectory, libMeta, patchFile);
    long cost = SystemClock.elapsedRealtime() - begin;
    TinkerLog.i(TAG, "recover lib result:%b, cost:%d", result, cost);
    return result;
}
 
开发者ID:baidao,项目名称:tinker-manager,代码行数:20,代码来源:SampleBsDiffPatchInternal.java

示例4: loadArmLibrary

import com.tencent.tinker.lib.tinker.Tinker; //导入方法依赖的package包/类
/**
 * you can use TinkerInstaller.loadLibrary replace your System.loadLibrary for auto update library!
 * only support auto load lib/armeabi library from patch.
 * for other library in lib/* or assets,
 * you can load through {@code TinkerInstaller#loadLibraryFromTinker}
 */
public static void loadArmLibrary(Context context, String libName) {
    if (libName == null || libName.isEmpty() || context == null) {
        throw new TinkerRuntimeException("libName or context is null!");
    }

    Tinker tinker = Tinker.with(context);
    if (tinker.isEnabledForNativeLib()) {
        if (TinkerLoadLibrary.loadLibraryFromTinker(context, "lib/armeabi", libName)) {
            return;
        }

    }
    System.loadLibrary(libName);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:TinkerLoadLibrary.java

示例5: loadArmV7Library

import com.tencent.tinker.lib.tinker.Tinker; //导入方法依赖的package包/类
/**
 * you can use TinkerInstaller.loadArmV7Library replace your System.loadLibrary for auto update library!
 * only support auto load lib/armeabi-v7a library from patch.
 * for other library in lib/* or assets,
 * you can load through {@code TinkerInstaller#loadLibraryFromTinker}
 */
public static void loadArmV7Library(Context context, String libName) {
    if (libName == null || libName.isEmpty() || context == null) {
        throw new TinkerRuntimeException("libName or context is null!");
    }

    Tinker tinker = Tinker.with(context);
    if (tinker.isEnabledForNativeLib()) {
        if (TinkerLoadLibrary.loadLibraryFromTinker(context, "lib/armeabi-v7a", libName)) {
            return;
        }

    }
    System.loadLibrary(libName);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:TinkerLoadLibrary.java

示例6: loadLibraryFromTinker

import com.tencent.tinker.lib.tinker.Tinker; //导入方法依赖的package包/类
/**
 * sample usage for native library
 *
 * @param context
 * @param relativePath such as lib/armeabi
 * @param libName      for the lib libTest.so, you can pass Test or libTest, or libTest.so
 * @return boolean
 * @throws UnsatisfiedLinkError
 */
public static boolean loadLibraryFromTinker(Context context, String relativePath, String libName) throws UnsatisfiedLinkError {
    final Tinker tinker = Tinker.with(context);

    libName = libName.startsWith("lib") ? libName : "lib" + libName;
    libName = libName.endsWith(".so") ? libName : libName + ".so";
    String relativeLibPath = relativePath + "/" + libName;

    //TODO we should add cpu abi, and the real path later
    if (tinker.isEnabledForNativeLib() && tinker.isTinkerLoaded()) {
        TinkerLoadResult loadResult = tinker.getTinkerLoadResultIfPresent();
        if (loadResult.libs != null) {
            for (String name : loadResult.libs.keySet()) {
                if (name.equals(relativeLibPath)) {
                    String patchLibraryPath = loadResult.libraryDirectory + "/" + name;
                    File library = new File(patchLibraryPath);
                    if (library.exists()) {
                        //whether we check md5 when load
                        boolean verifyMd5 = tinker.isTinkerLoadVerify();
                        if (verifyMd5 && !SharePatchFileUtil.verifyFileMd5(library, loadResult.libs.get(name))) {
                            tinker.getLoadReporter().onLoadFileMd5Mismatch(library, ShareConstants.TYPE_LIBRARY);
                        } else {
                            System.load(patchLibraryPath);
                            TinkerLog.i(TAG, "loadLibraryFromTinker success:" + patchLibraryPath);
                            return true;
                        }
                    }
                }
            }
        }
    }

    return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:TinkerLoadLibrary.java


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