本文整理汇总了Java中com.tencent.tinker.loader.shareutil.SharePatchFileUtil.deleteDir方法的典型用法代码示例。如果您正苦于以下问题:Java SharePatchFileUtil.deleteDir方法的具体用法?Java SharePatchFileUtil.deleteDir怎么用?Java SharePatchFileUtil.deleteDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.tinker.loader.shareutil.SharePatchFileUtil
的用法示例。
在下文中一共展示了SharePatchFileUtil.deleteDir方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLoadPatchVersionChanged
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public void onLoadPatchVersionChanged(String oldVersion, String newVersion, File
patchDirectoryFile, String currentPatchName) {
int i = 0;
TinkerLog.i(TAG, "patch version change from " + oldVersion + " to " + newVersion, new
Object[0]);
if (oldVersion != null && newVersion != null && !oldVersion.equals(newVersion) && Tinker
.with(this.context).isMainProcess()) {
TinkerLog.i(TAG, "try kill all other process", new Object[0]);
ShareTinkerInternals.killAllOtherProcess(this.context);
File[] files = patchDirectoryFile.listFiles();
if (files != null) {
int length = files.length;
while (i < length) {
File file = files[i];
String name = file.getName();
if (file.isDirectory() && !name.equals(currentPatchName)) {
SharePatchFileUtil.deleteDir(file);
}
i++;
}
}
}
}
示例2: deleteOutOfDateOATFile
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
private static void deleteOutOfDateOATFile(String directory) {
String optimizeDexDirectory = directory + "/" + DEFAULT_DEX_OPTIMIZE_PATH + "/";
SharePatchFileUtil.deleteDir(optimizeDexDirectory);
// delete android o
if (ShareTinkerInternals.isAfterAndroidO()) {
String androidODexDirectory = directory + "/" + ShareConstants.ANDROID_O_DEX_OPTIMIZE_PATH + "/";
SharePatchFileUtil.deleteDir(androidODexDirectory);
}
}
示例3: cleanPatch
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
/**
* clean all patch files
*/
public void cleanPatch() {
if (patchDirectory == null) {
return;
}
if (isTinkerLoaded()) {
TinkerLog.e(TAG, "it is not safety to clean patch when tinker is loaded, you should kill all your process after clean!");
}
SharePatchFileUtil.deleteDir(patchDirectory);
}
示例4: cleanPatchByVersion
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
/**
* clean the patch version files, such as tinker/patch-641e634c
*
* @param versionName
*/
public void cleanPatchByVersion(String versionName) {
if (patchDirectory == null || versionName == null) {
return;
}
String path = patchDirectory.getAbsolutePath() + "/" + versionName;
SharePatchFileUtil.deleteDir(path);
}
示例5: cleanPatch
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
/**
* clean all patch files without install tinker
* same as {@code Tinker.cleanPatch}
*
* @param applicationLike
*/
public static void cleanPatch(ApplicationLike applicationLike) {
if (applicationLike == null || applicationLike.getApplication() == null) {
throw new TinkerRuntimeException("tinkerApplication is null");
}
if (TinkerApplicationHelper.isTinkerLoadSuccess(applicationLike)) {
TinkerLog.e(TAG, "it is not safety to clean patch when tinker is loaded, you should kill all your process after clean!");
}
SharePatchFileUtil.deleteDir(SharePatchFileUtil.getPatchDirectory(applicationLike.getApplication()));
}
示例6: onLoadPatchVersionChanged
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
/**
* we can only handle patch version change in the main process,
* we will need to kill all other process to ensure that all process's code is the same.
* you can delete the old patch version file as {@link DefaultLoadReporter#onLoadPatchVersionChanged(String, String, File, String)}
* or you can restart your other process here
*
* @param oldVersion
* @param newVersion
* @param patchDirectoryFile
* @param currentPatchName
*/
@Override
public void onLoadPatchVersionChanged(String oldVersion, String newVersion, File patchDirectoryFile, String currentPatchName) {
TinkerLog.i(TAG, "patch loadReporter onLoadPatchVersionChanged: patch version change from " + oldVersion + " to " + newVersion);
if (oldVersion == null || newVersion == null) {
return;
}
if (oldVersion.equals(newVersion)) {
return;
}
//check main process
if (!Tinker.with(context).isMainProcess()) {
return;
}
TinkerLog.i(TAG, "onLoadPatchVersionChanged, try kill all other process");
//kill all other process to ensure that all process's code is the same.
ShareTinkerInternals.killAllOtherProcess(context);
// reset retry count to 1, for interpret retry
UpgradePatchRetry.getInstance(context).onPatchResetMaxCheck(newVersion);
//delete old patch files
File[] files = patchDirectoryFile.listFiles();
if (files != null) {
for (File file : files) {
String name = file.getName();
if (file.isDirectory() && !name.equals(currentPatchName)) {
SharePatchFileUtil.deleteDir(file);
}
}
}
}
示例7: cleanPatch
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public void cleanPatch() {
if (this.patchDirectory != null) {
if (isTinkerLoaded()) {
TinkerLog.e(TAG, "it is not safety to clean patch when tinker is loaded, you " +
"should kill all your process after clean!", new Object[0]);
}
SharePatchFileUtil.deleteDir(this.patchDirectory);
}
}
示例8: cleanPatch
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public static void cleanPatch(ApplicationLike applicationLike) {
if (applicationLike == null || applicationLike.getApplication() == null) {
throw new TinkerRuntimeException("tinkerApplication is null");
}
if (isTinkerLoadSuccess(applicationLike)) {
TinkerLog.e(TAG, "it is not safety to clean patch when tinker is loaded, you should " +
"kill all your process after clean!", new Object[0]);
}
SharePatchFileUtil.deleteDir(SharePatchFileUtil.getPatchDirectory(applicationLike
.getApplication()));
}
示例9: cleanPatchByVersion
import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; //导入方法依赖的package包/类
public void cleanPatchByVersion(String versionName) {
if (this.patchDirectory != null && versionName != null) {
SharePatchFileUtil.deleteDir(this.patchDirectory.getAbsolutePath() + "/" + versionName);
}
}