forked from ReVanced/revanced-cli
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove extra zipalign step (ReVanced#106)
* feat: remove extra zipalign step * remove zipfs * remove use * reduce compression * put back misc.xml * revert stupid autofix
- Loading branch information
Showing
8 changed files
with
121 additions
and
154 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt
This file was deleted.
Oops, something went wrong.
23 changes: 3 additions & 20 deletions
23
src/main/kotlin/app/revanced/utils/signing/align/ZipAligner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,11 @@ | ||
package app.revanced.utils.signing.align | ||
|
||
import app.revanced.utils.signing.align.zip.ZipFile | ||
import java.io.File | ||
import app.revanced.utils.signing.align.zip.structures.ZipEntry | ||
|
||
internal object ZipAligner { | ||
private const val DEFAULT_ALIGNMENT = 4 | ||
private const val LIBRARY_ALIGNMENT = 4096 | ||
|
||
fun align(input: File, output: File) { | ||
val inputZip = ZipFile(input) | ||
val outputZip = ZipFile(output) | ||
|
||
for (entry in inputZip.entries) { | ||
val data = inputZip.getDataForEntry(entry) | ||
|
||
if (entry.compression == 0.toUShort()) { | ||
val alignment = if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT | ||
|
||
outputZip.addEntryAligned(entry, data, alignment) | ||
} else { | ||
outputZip.addEntry(entry, data) | ||
} | ||
} | ||
|
||
outputZip.finish() | ||
} | ||
fun getEntryAlignment(entry: ZipEntry): Int? = | ||
if (entry.compression.toUInt() != 0u) null else if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.