Search in sources :

Example 31 with TinkerRuntimeException

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) {
            ShareTinkerLog.i(TAG, "releaseInfoLock error", e);
        }
    }
    return rewriteSuccess;
}
Also used : TinkerRuntimeException(com.tencent.tinker.loader.TinkerRuntimeException) IOException(java.io.IOException) File(java.io.File) IOException(java.io.IOException) TinkerRuntimeException(com.tencent.tinker.loader.TinkerRuntimeException)

Aggregations

TinkerRuntimeException (com.tencent.tinker.loader.TinkerRuntimeException)31 File (java.io.File)14 Tinker (com.tencent.tinker.lib.tinker.Tinker)10 ZipFile (java.util.zip.ZipFile)9 IOException (java.io.IOException)7 Intent (android.content.Intent)6 ZipEntry (java.util.zip.ZipEntry)5 ApplicationInfo (android.content.pm.ApplicationInfo)3 InputStream (java.io.InputStream)3 SuppressLint (android.annotation.SuppressLint)2 ShareElfFile (com.tencent.tinker.loader.shareutil.ShareElfFile)2 ShareResPatchInfo (com.tencent.tinker.loader.shareutil.ShareResPatchInfo)2 TinkerZipEntry (com.tencent.tinker.ziputils.ziputil.TinkerZipEntry)2 TinkerZipFile (com.tencent.tinker.ziputils.ziputil.TinkerZipFile)2 BufferedOutputStream (java.io.BufferedOutputStream)2 FileOutputStream (java.io.FileOutputStream)2 Field (java.lang.reflect.Field)2 ArrayList (java.util.ArrayList)2 JarFile (java.util.jar.JarFile)2 Instrumentation (android.app.Instrumentation)1