From a9c90718d61cc5f245917fb2752a71559d271e94 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 2 Apr 2019 01:50:25 -0400 Subject: [PATCH] Update some dependencies --- app/build.gradle | 2 +- .../topjohnwu/magisk/container/TarEntry.java | 64 ------------------- .../magisk/tasks/MagiskInstaller.java | 4 +- build.gradle | 2 +- 4 files changed, 4 insertions(+), 68 deletions(-) delete mode 100644 app/src/main/java/com/topjohnwu/magisk/container/TarEntry.java diff --git a/app/build.gradle b/app/build.gradle index 8f81ca357..6679e4efa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,7 +27,7 @@ dependencies { implementation project(':signing') implementation 'ru.noties:markwon:2.0.1' implementation 'com.caverock:androidsvg-aar:1.3' - implementation 'org.kamranzafar:jtar:2.3' + implementation 'com.github.topjohnwu:jtar:1.0.0' implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.0' implementation 'com.github.sevar83:indeterminate-checkbox:1.0.5' diff --git a/app/src/main/java/com/topjohnwu/magisk/container/TarEntry.java b/app/src/main/java/com/topjohnwu/magisk/container/TarEntry.java deleted file mode 100644 index 2a09ddd39..000000000 --- a/app/src/main/java/com/topjohnwu/magisk/container/TarEntry.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.topjohnwu.magisk.container; - -import org.kamranzafar.jtar.TarHeader; - -import java.io.File; -import java.util.Arrays; - -public class TarEntry extends org.kamranzafar.jtar.TarEntry { - - public TarEntry(File file, String entryName) { - super(file, entryName); - } - - /* - * Workaround missing java.nio.file.attribute.PosixFilePermission - * Simply just assign a default permission to the file - * */ - - @Override - public void extractTarHeader(String entryName) { - int permissions = file.isDirectory() ? 000755 : 000644; - header = TarHeader.createHeader(entryName, file.length(), file.lastModified() / 1000, file.isDirectory(), permissions); - header.userName = new StringBuffer(""); - header.groupName = header.userName; - } - - /* - * Rewrite the header to GNU format - * */ - - @Override - public void writeEntryHeader(byte[] outbuf) { - super.writeEntryHeader(outbuf); - - System.arraycopy("ustar \0".getBytes(), 0, outbuf, 257, TarHeader.USTAR_MAGICLEN); - getOctalBytes(header.mode, outbuf, 100, TarHeader.MODELEN); - getOctalBytes(header.userId, outbuf, 108, TarHeader.UIDLEN); - getOctalBytes(header.groupId, outbuf, 116, TarHeader.GIDLEN); - getOctalBytes(header.size, outbuf, 124, TarHeader.SIZELEN); - getOctalBytes(header.modTime, outbuf, 136, TarHeader.MODTIMELEN); - Arrays.fill(outbuf, 148, 148 + TarHeader.CHKSUMLEN, (byte) ' '); - Arrays.fill(outbuf, 329, 329 + TarHeader.USTAR_DEVLEN, (byte) '\0'); - Arrays.fill(outbuf, 337, 337 + TarHeader.USTAR_DEVLEN, (byte) '\0'); - - // Recalculate checksum - getOctalBytes(computeCheckSum(outbuf), outbuf, 148, TarHeader.CHKSUMLEN); - } - - /* - * Proper octal to ASCII conversion - * */ - - private void getOctalBytes(long value, byte[] buf, int offset, int length) { - int idx = length - 1; - - buf[offset + idx] = 0; - --idx; - - for (long val = value; idx >= 0; --idx) { - buf[offset + idx] = (byte) ((byte) '0' + (byte) (val & 7)); - val = val >> 3; - } - } -} diff --git a/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java b/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java index beaadd3df..bc0339cab 100644 --- a/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java +++ b/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java @@ -10,7 +10,6 @@ import androidx.annotation.WorkerThread; import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.container.TarEntry; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.net.DownloadProgressListener; import com.topjohnwu.net.Networking; @@ -23,6 +22,7 @@ import com.topjohnwu.superuser.io.SuFile; import com.topjohnwu.superuser.io.SuFileInputStream; import com.topjohnwu.superuser.io.SuFileOutputStream; +import org.kamranzafar.jtar.TarEntry; import org.kamranzafar.jtar.TarInputStream; import org.kamranzafar.jtar.TarOutputStream; @@ -182,7 +182,7 @@ public abstract class MagiskInstaller { if (Utils.getNameFromUri(App.self, bootUri).endsWith(".tar")) { // Extract boot.img from tar TarInputStream tar = new TarInputStream(new BufferedInputStream(in)); - org.kamranzafar.jtar.TarEntry entry; + TarEntry entry; while ((entry = tar.getNextEntry()) != null) { if (entry.getName().equals("boot.img")) break; diff --git a/build.gradle b/build.gradle index d468be969..b4d4e3758 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools:r8:1.4.72' + classpath 'com.android.tools:r8:1.4.79' classpath 'com.android.tools.build:gradle:3.5.0-alpha09'