use of com.tencent.tinker.loader.TinkerRuntimeException in project tinker by Tencent.
the class TinkerApplicationHelper method getLoadLibraryAndMd5.
/**
* you can use this api to get load libs before tinker is installed
* same as {@code Tinker.getTinkerLoadResultIfPresent.libs}
*
* @return
*/
public static HashMap<String, String> getLoadLibraryAndMd5(ApplicationLike applicationLike) {
if (applicationLike == null || applicationLike.getApplication() == null) {
throw new TinkerRuntimeException("tinkerApplication is null");
}
Intent tinkerResultIntent = applicationLike.getTinkerResultIntent();
if (tinkerResultIntent == null) {
return null;
}
int loadCode = ShareIntentUtil.getIntentReturnCode(tinkerResultIntent);
if (loadCode == ShareConstants.ERROR_LOAD_OK) {
return ShareIntentUtil.getIntentPatchLibsPaths(tinkerResultIntent);
}
return null;
}
use of com.tencent.tinker.loader.TinkerRuntimeException in project tinker by Tencent.
the class TinkerApplicationHelper method getPackageConfigs.
/**
* you can use this api to get tinker package configs before tinker is installed
* same as {@code Tinker.getTinkerLoadResultIfPresent.packageConfig}
*
* @return
*/
public static HashMap<String, String> getPackageConfigs(ApplicationLike applicationLike) {
if (applicationLike == null || applicationLike.getApplication() == null) {
throw new TinkerRuntimeException("tinkerApplication is null");
}
Intent tinkerResultIntent = applicationLike.getTinkerResultIntent();
if (tinkerResultIntent == null) {
return null;
}
int loadCode = ShareIntentUtil.getIntentReturnCode(tinkerResultIntent);
if (loadCode == ShareConstants.ERROR_LOAD_OK) {
return ShareIntentUtil.getIntentPackageConfig(tinkerResultIntent);
}
return null;
}
use of com.tencent.tinker.loader.TinkerRuntimeException in project tinker by Tencent.
the class TinkerApplicationHelper method getLoadDexesAndMd5.
/**
* you can use this api to get load dexes before tinker is installed
* same as {@code Tinker.getTinkerLoadResultIfPresent.dexes}
*
* @return
*/
public static HashMap<String, String> getLoadDexesAndMd5(ApplicationLike applicationLike) {
if (applicationLike == null || applicationLike.getApplication() == null) {
throw new TinkerRuntimeException("tinkerApplication is null");
}
Intent tinkerResultIntent = applicationLike.getTinkerResultIntent();
if (tinkerResultIntent == null) {
return null;
}
int loadCode = ShareIntentUtil.getIntentReturnCode(tinkerResultIntent);
if (loadCode == ShareConstants.ERROR_LOAD_OK) {
return ShareIntentUtil.getIntentPatchDexPaths(tinkerResultIntent);
}
return null;
}
use of com.tencent.tinker.loader.TinkerRuntimeException in project tinker by Tencent.
the class TinkerApplication method createDelegate.
private ApplicationLike createDelegate() {
try {
// Use reflection to create the delegate so it doesn't need to go into the primary dex.
// And we can also patch it
Class<?> delegateClass = Class.forName(delegateClassName, false, getClassLoader());
Constructor<?> constructor = delegateClass.getConstructor(Application.class, int.class, boolean.class, long.class, long.class, Intent.class);
return (ApplicationLike) constructor.newInstance(this, tinkerFlags, tinkerLoadVerifyFlag, applicationStartElapsedTime, applicationStartMillisTime, tinkerResultIntent);
} catch (Throwable e) {
throw new TinkerRuntimeException("createDelegate failed", e);
}
}
use of com.tencent.tinker.loader.TinkerRuntimeException in project tinker by Tencent.
the class SharePatchInfo method rewritePatchInfoFileWithLock.
public static boolean rewritePatchInfoFileWithLock(File pathInfoFile, SharePatchInfo info, File lockFile) {
if (pathInfoFile == null || info == null || lockFile == null) {
return false;
}
File lockParentFile = lockFile.getParentFile();
if (!lockParentFile.exists()) {
lockParentFile.mkdirs();
}
boolean rewriteSuccess;
ShareFileLockHelper fileLock = null;
try {
fileLock = ShareFileLockHelper.getFileLock(lockFile);
rewriteSuccess = rewritePatchInfoFile(pathInfoFile, info);
} catch (Exception e) {
throw new TinkerRuntimeException("rewritePatchInfoFileWithLock fail", e);
} finally {
try {
if (fileLock != null) {
fileLock.close();
}
} catch (IOException e) {
Log.i(TAG, "releaseInfoLock error", e);
}
}
return rewriteSuccess;
}
Aggregations