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


Java TinkerLog类代码示例

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


TinkerLog类属于com.tencent.tinker.lib.util包,在下文中一共展示了TinkerLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLoaded

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
public static void onLoaded(long cost) {
    if (reporter == null) {
        return;
    }
    reporter.onReport(KEY_LOADED);

    if (cost < 0L) {
        TinkerLog.e(TAG, "hp_report report load cost failed, invalid cost");
        return;
    }

    if (cost <= 500) {
        reporter.onReport(KEY_LOADED_SUCC_COST_500_LESS);
    } else if (cost <= 1000) {
        reporter.onReport(KEY_LOADED_SUCC_COST_1000_LESS);
    } else if (cost <= 3000) {
        reporter.onReport(KEY_LOADED_SUCC_COST_3000_LESS);
    } else if (cost <= 5000) {
        reporter.onReport(KEY_LOADED_SUCC_COST_5000_LESS);
    } else {
        reporter.onReport(KEY_LOADED_SUCC_COST_OTHER);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:SampleTinkerReport.java

示例2: onLoadException

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
@Override
public void onLoadException(Throwable e, int errorCode) {
    super.onLoadException(e, errorCode);
    switch (errorCode) {
        case ShareConstants.ERROR_LOAD_EXCEPTION_UNCAUGHT:
            String uncaughtString = SharePatchFileUtil.checkTinkerLastUncaughtCrash(context);
            if (!ShareTinkerInternals.isNullOrNil(uncaughtString)) {
                File laseCrashFile = SharePatchFileUtil.getPatchLastCrashFile(context);
                SharePatchFileUtil.safeDeleteFile(laseCrashFile);
                // found really crash reason
                TinkerLog.e(TAG, "tinker uncaught real exception:" + uncaughtString);
            }
            break;
    }
    SampleTinkerReport.onLoadException(e, errorCode);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:SampleLoadReporter.java

示例3: onPatchListenerCheck

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
public boolean onPatchListenerCheck(String md5) {
    if (!isRetryEnable) {
        TinkerLog.w(TAG, "onPatchListenerCheck retry disabled, just return");
        return true;
    }
    if (!retryInfoFile.exists()) {
        TinkerLog.w(TAG, "onPatchListenerCheck retry file is not exist, just return");
        return true;
    }
    if (md5 == null) {
        TinkerLog.w(TAG, "onPatchListenerCheck md5 is null, just return");
        return true;
    }
    RetryInfo retryInfo = RetryInfo.readRetryProperty(retryInfoFile);
    if (md5.equals(retryInfo.md5)) {
        int nowTimes = Integer.parseInt(retryInfo.times);
        if (nowTimes >= RETRY_MAX_COUNT) {
            TinkerLog.w(TAG, "onPatchListenerCheck, retry count %d must exceed than max retry count", nowTimes);
            SharePatchFileUtil.safeDeleteFile(tempPatchFile);
            return false;
        }
    }
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:UpgradePatchRetry.java

示例4: onLoadFileNotFound

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
public void onLoadFileNotFound(File file, int fileType, boolean isDirectory) {
    TinkerLog.i(TAG, "patch file not found: %s, fileType:%d, isDirectory:%b", file
            .getAbsolutePath(), Integer.valueOf(fileType), Boolean.valueOf(isDirectory));
    if (fileType == 3 || fileType == 5 || fileType == 6 || fileType == 7) {
        Tinker tinker = Tinker.with(this.context);
        if (!tinker.isPatchProcess()) {
            File patchVersionFile = tinker.getTinkerLoadResultIfPresent().patchVersionFile;
            if (patchVersionFile != null) {
                TinkerInstaller.onReceiveRepairPatch(this.context, patchVersionFile
                        .getAbsolutePath());
            }
        }
    } else if (fileType == 1 || fileType == 2) {
        Tinker.with(this.context).cleanPatch();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:DefaultLoadReporter.java

示例5: tryRecoverDexFiles

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
protected static boolean tryRecoverDexFiles(Tinker manager, ShareSecurityCheck checker, Context context,
                                            String patchVersionDirectory, File patchFile) {
    if (!manager.isEnabledForDex()) {
        TinkerLog.w(TAG, "patch recover, dex is not enabled");
        return true;
    }
    String dexMeta = checker.getMetaContentMap().get(DEX_META_FILE);

    if (dexMeta == null) {
        TinkerLog.w(TAG, "patch recover, dex is not contained");
        return true;
    }

    long begin = SystemClock.elapsedRealtime();
    boolean result = patchDexExtractViaDexDiff(context, patchVersionDirectory, dexMeta, patchFile);
    long cost = SystemClock.elapsedRealtime() - begin;
    TinkerLog.i(TAG, "recover dex result:%b, cost:%d", result, cost);
    return result;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:DexDiffPatchInternal.java

示例6: patchDexExtractViaDexDiff

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
private static boolean patchDexExtractViaDexDiff(Context context, String patchVersionDirectory, String meta, final File patchFile) {
    String dir = patchVersionDirectory + "/" + DEX_PATH + "/";

    if (!extractDexDiffInternals(context, dir, meta, patchFile, TYPE_DEX)) {
        TinkerLog.w(TAG, "patch recover, extractDiffInternals fail");
        return false;
    }

    File dexFiles = new File(dir);
    File[] files = dexFiles.listFiles();
    List<File> dexList = files != null ? Arrays.asList(files) : null;

    final String optimizeDexDirectory = patchVersionDirectory + "/" + DEX_OPTIMIZE_PATH + "/";
    return dexOptimizeDexFiles(context, dexList, optimizeDexDirectory, patchFile);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:DexDiffPatchInternal.java

示例7: tryRecoverLibraryFiles

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的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

示例8: Builder

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
/**
 * Start building a new {@link Tinker} instance.
 */
public Builder(Context context) {
    if (context == null) {
        throw new TinkerRuntimeException("Context must not be null.");
    }
    this.context = context;
    this.mainProcess = TinkerServiceInternals.isInMainProcess(context);
    this.patchProcess = TinkerServiceInternals.isInTinkerPatchServiceProcess(context);
    this.patchDirectory = SharePatchFileUtil.getPatchDirectory(context);
    if (this.patchDirectory == null) {
        TinkerLog.e(TAG, "patchDirectory is null!");
        return;
    }
    this.patchInfoFile = SharePatchFileUtil.getPatchInfoFile(patchDirectory.getAbsolutePath());
    this.patchInfoLockFile = SharePatchFileUtil.getPatchInfoLockFile(patchDirectory.getAbsolutePath());
    TinkerLog.w(TAG, "tinker patch directory: %s", patchDirectory);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:Tinker.java

示例9: onPatchRetryLoad

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
public void onPatchRetryLoad() {
    if (!this.isRetryEnable) {
        TinkerLog.w(TAG, "onPatchRetryLoad retry disabled, just return", new Object[0]);
    } else if (!Tinker.with(this.context).isMainProcess()) {
        TinkerLog.w(TAG, "onPatchRetryLoad retry is not main process, just return", new
                Object[0]);
    } else if (!this.retryInfoFile.exists()) {
        TinkerLog.w(TAG, "onPatchRetryLoad retry info not exist, just return", new Object[0]);
    } else if (TinkerServiceInternals.isTinkerPatchServiceRunning(this.context)) {
        TinkerLog.w(TAG, "onPatchRetryLoad tinker service is running, just return", new
                Object[0]);
    } else {
        String path = this.tempPatchFile.getAbsolutePath();
        if (path == null || !new File(path).exists()) {
            TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is not exist, just return", path);
            return;
        }
        TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is exist, retry to patch", path);
        TinkerInstaller.onReceiveUpgradePatch(this.context, path);
        SampleTinkerReport.onReportRetryPatch();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:UpgradePatchRetry.java

示例10: onLoadInterpret

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
/**
 * After system ota, we will try to load dex with interpret mode
 *
 * @param type type define as following
 *             {@code ShareConstants.TYPE_INTERPRET_OK}                                    it is ok, using interpret mode
 *             {@code ShareConstants.TYPE_INTERPRET_GET_INSTRUCTION_SET_ERROR}             get instruction set from exist oat file fail
 *             {@code ShareConstants.TYPE_INTERPRET_COMMAND_ERROR}                         use command line to generate interpret oat file fail
 * @param e
 */
@Override
public void onLoadInterpret(int type, Throwable e) {
    TinkerLog.i(TAG, "patch loadReporter onLoadInterpret: type: %d, throwable: %s",
        type, e);
    switch (type) {
        case ShareConstants.TYPE_INTERPRET_GET_INSTRUCTION_SET_ERROR:
            TinkerLog.e(TAG, "patch loadReporter onLoadInterpret fail, can get instruction set from existed oat file");
            break;
        case ShareConstants.TYPE_INTERPRET_COMMAND_ERROR:
            TinkerLog.e(TAG, "patch loadReporter onLoadInterpret fail, command line to interpret return error");
            break;
        case ShareConstants.TYPE_INTERPRET_OK:
            TinkerLog.i(TAG, "patch loadReporter onLoadInterpret ok");
            break;
    }

    retryPatch();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:DefaultLoadReporter.java

示例11: retryPatch

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
public boolean retryPatch() {
        final Tinker tinker = Tinker.with(context);
        if (!tinker.isMainProcess()) {
            return false;
        }

        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());
                return true;
            }
//          else {
//                TinkerLog.i(TAG, "repair retry exceed must max time, just clean");
//                checkAndCleanPatch();
//            }
        }

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

示例12: tinkerPreVerifiedCrashHandler

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
private void tinkerPreVerifiedCrashHandler(Throwable ex) {
    if (Utils.isXposedExists(ex)) {
        ApplicationLike applicationLike = TinkerManager.getTinkerApplicationLike();
        if (applicationLike != null && applicationLike.getApplication() != null &&
                TinkerApplicationHelper.isTinkerLoadSuccess(applicationLike)) {
            boolean isCausedByXposed = false;
            if (ShareTinkerInternals.isVmArt()) {
                isCausedByXposed = true;
            } else if ((ex instanceof IllegalAccessError) && ex.getMessage().contains
                    (DALVIK_XPOSED_CRASH)) {
                isCausedByXposed = true;
            }
            if (isCausedByXposed) {
                SampleTinkerReport.onXposedCrash();
                TinkerLog.e(TAG, "have xposed: just clean tinker", new Object[0]);
                ShareTinkerInternals.killAllOtherProcess(applicationLike.getApplication());
                TinkerApplicationHelper.cleanPatch(applicationLike);
                ShareTinkerInternals.setTinkerDisableWithSharedPreferences(applicationLike
                        .getApplication());
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:SampleUncaughtExceptionHandler.java

示例13: installNavitveLibraryABI

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
/**
 * you can reflect your current abi to classloader library path
 * as you don't need to use load*Library method above
 * @param context
 * @param currentABI
 */
public static void installNavitveLibraryABI(Context context, String currentABI) {
    Tinker tinker = Tinker.with(context);
    if (!tinker.isTinkerLoaded()) {
        TinkerLog.i(TAG, "tinker is not loaded, just return");
        return;
    }
    TinkerLoadResult loadResult = tinker.getTinkerLoadResultIfPresent();
    if (loadResult.libs == null) {
        TinkerLog.i(TAG, "tinker libs is null, just return");
        return;
    }
    File soDir = new File(loadResult.libraryDirectory, "lib/" + currentABI);
    if (!soDir.exists()) {
        TinkerLog.e(TAG, "current libraryABI folder is not exist, path: %s", soDir.getPath());
        return;
    }
    ClassLoader classLoader = context.getClassLoader();
    if (classLoader == null) {
        TinkerLog.e(TAG, "classloader is null");
        return;
    }
    TinkerLog.i(TAG, "before hack classloader:" + classLoader.toString());

    try {
        installNativeLibraryPath(classLoader, soDir);
    } catch (Throwable throwable) {
        TinkerLog.e(TAG, "installNativeLibraryPath fail:" + throwable);
    }
    TinkerLog.i(TAG, "after hack classloader:" + classLoader.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:TinkerLoadLibrary.java

示例14: installTinker

import com.tencent.tinker.lib.util.TinkerLog; //导入依赖的package包/类
/**
 * you can specify all class you want.
 * sometimes, you can only install tinker in some process you want!
 *
 * @param appLike
 */
public static void installTinker(ApplicationLike appLike) {
    if (isInstalled) {
        TinkerLog.w(TAG, "install tinker, but has installed, ignore");
        return;
    }
    //or you can just use DefaultLoadReporter
    LoadReporter loadReporter = new SampleLoadReporter(appLike.getApplication());
    //or you can just use DefaultPatchReporter
    PatchReporter patchReporter = new SamplePatchReporter(appLike.getApplication());
    //or you can just use DefaultPatchListener
    PatchListener patchListener = new SamplePatchListener(appLike.getApplication());
    //you can set your own upgrade patch if you need
    AbstractPatch upgradePatchProcessor = new UpgradePatch();

    TinkerInstaller.install(appLike,
        loadReporter, patchReporter, patchListener,
        SampleResultService.class, upgradePatchProcessor);

    isInstalled = true;
}
 
开发者ID:xingstarx,项目名称:TinkerDemo,代码行数:27,代码来源:TinkerManager.java

示例15: tryRecoverDexFiles

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


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