本文整理汇总了Java中com.tencent.tinker.loader.shareutil.SharePatchFileUtil.getPatchDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java SharePatchFileUtil.getPatchDirectory方法的具体用法?Java SharePatchFileUtil.getPatchDirectory怎么用?Java SharePatchFileUtil.getPatchDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.tinker.loader.shareutil.SharePatchFileUtil
的用法示例。
在下文中一共展示了SharePatchFileUtil.getPatchDirectory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Builder
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的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);
}
示例2: Builder
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public Builder(Context context) {
if (context == null) {
throw new TinkerRuntimeException("Context must not be null.");
}
this.context = context;
this.mainProcess = ShareTinkerInternals.isInMainProcess(context);
this.patchProcess = TinkerServiceInternals.isInTinkerPatchServiceProcess(context);
this.patchDirectory = SharePatchFileUtil.getPatchDirectory(context);
if (this.patchDirectory == null) {
TinkerLog.e(Tinker.TAG, "patchDirectory is null!", new Object[0]);
return;
}
this.patchInfoFile = SharePatchFileUtil.getPatchInfoFile(this.patchDirectory
.getAbsolutePath());
TinkerLog.w(Tinker.TAG, "tinker patch directory: %s", this.patchDirectory);
}
示例3: getTinkerPatchDirectory
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
/**
* same as {@code Tinker.getPatchDirectory}
*
* @param applicationLike
* @return
*/
public static File getTinkerPatchDirectory(ApplicationLike applicationLike) {
if (applicationLike == null || applicationLike.getApplication() == null) {
throw new TinkerRuntimeException("tinkerApplication is null");
}
return SharePatchFileUtil.getPatchDirectory(applicationLike.getApplication());
}
示例4: UpgradePatchRetry
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public UpgradePatchRetry(Context context) {
this.context = context;
this.retryInfoFile = new File(SharePatchFileUtil.getPatchDirectory(context),
RETRY_INFO_NAME);
this.tempPatchFile = new File(SharePatchFileUtil.getPatchDirectory(context),
TEMP_PATCH_NAME);
}
示例5: loadLibraryFromTinker
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
/**
* you can use these api to load tinker library without tinker is installed!
* same as {@code TinkerInstaller#loadLibraryFromTinker}
*
* @param applicationLike
* @param relativePath
* @param libname
* @return
* @throws UnsatisfiedLinkError
*/
public static boolean loadLibraryFromTinker(ApplicationLike applicationLike, String relativePath, String libname) throws UnsatisfiedLinkError {
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 (TinkerApplicationHelper.isTinkerEnableForNativeLib(applicationLike)
&& TinkerApplicationHelper.isTinkerLoadSuccess(applicationLike)) {
HashMap<String, String> loadLibraries = TinkerApplicationHelper.getLoadLibraryAndMd5(applicationLike);
if (loadLibraries != null) {
String currentVersion = TinkerApplicationHelper.getCurrentVersion(applicationLike);
if (ShareTinkerInternals.isNullOrNil(currentVersion)) {
return false;
}
File patchDirectory = SharePatchFileUtil.getPatchDirectory(applicationLike.getApplication());
if (patchDirectory == null) {
return false;
}
File patchVersionDirectory = new File(patchDirectory.getAbsolutePath() + "/" + SharePatchFileUtil.getPatchVersionDirectory(currentVersion));
String libPrePath = patchVersionDirectory.getAbsolutePath() + "/" + ShareConstants.SO_PATH;
for (String name : loadLibraries.keySet()) {
if (name.equals(relativeLibPath)) {
String patchLibraryPath = libPrePath + "/" + name;
File library = new File(patchLibraryPath);
if (library.exists()) {
//whether we check md5 when load
boolean verifyMd5 = applicationLike.getTinkerLoadVerifyFlag();
if (verifyMd5 && !SharePatchFileUtil.verifyFileMd5(library, loadLibraries.get(name))) {
//do not report, because tinker is not install
TinkerLog.i(TAG, "loadLibraryFromTinker md5mismatch fail:" + patchLibraryPath);
} else {
System.load(patchLibraryPath);
TinkerLog.i(TAG, "loadLibraryFromTinker success:" + patchLibraryPath);
return true;
}
}
}
}
}
}
return false;
}
示例6: getTinkerPatchDirectory
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public static File getTinkerPatchDirectory(ApplicationLike applicationLike) {
if (applicationLike != null && applicationLike.getApplication() != null) {
return SharePatchFileUtil.getPatchDirectory(applicationLike.getApplication());
}
throw new TinkerRuntimeException("tinkerApplication is null");
}
示例7: loadLibraryFromTinker
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public static boolean loadLibraryFromTinker(ApplicationLike applicationLike, String
relativePath, String libname) throws UnsatisfiedLinkError {
if (!libname.startsWith(ShareConstants.SO_PATH)) {
libname = ShareConstants.SO_PATH + libname;
}
if (!libname.endsWith(".so")) {
libname = libname + ".so";
}
String relativeLibPath = relativePath + "/" + libname;
if (isTinkerEnableForNativeLib(applicationLike) && isTinkerLoadSuccess(applicationLike)) {
HashMap<String, String> loadLibraries = getLoadLibraryAndMd5(applicationLike);
if (loadLibraries != null) {
String currentVersion = getCurrentVersion(applicationLike);
if (ShareTinkerInternals.isNullOrNil(currentVersion)) {
return false;
}
File patchDirectory = SharePatchFileUtil.getPatchDirectory(applicationLike
.getApplication());
if (patchDirectory == null) {
return false;
}
String libPrePath = new File(patchDirectory.getAbsolutePath() + "/" +
SharePatchFileUtil.getPatchVersionDirectory(currentVersion))
.getAbsolutePath() + "/" + ShareConstants.SO_PATH;
for (String name : loadLibraries.keySet()) {
if (name.equals(relativeLibPath)) {
String patchLibraryPath = libPrePath + "/" + name;
File library = new File(patchLibraryPath);
if (!library.exists()) {
continue;
} else if (!applicationLike.getTinkerLoadVerifyFlag() ||
SharePatchFileUtil.verifyFileMd5(library, (String) loadLibraries
.get(name))) {
System.load(patchLibraryPath);
TinkerLog.i(TAG, "loadLibraryFromTinker success:" + patchLibraryPath,
new Object[0]);
return true;
} else {
TinkerLog.i(TAG, "loadLibraryFromTinker md5mismatch fail:" +
patchLibraryPath, new Object[0]);
}
}
}
}
}
return false;
}