650 Commits

Author SHA1 Message Date
oSumAtrIX
fa09633c02
chore: publicate to revanced 2023-01-16 16:02:47 +01:00
oSumAtrIX
7419b19f9a
Merge remote-tracking branch 'zerny/debuginfo' 2023-01-16 16:01:28 +01:00
Michael Roberts
81bd303a80 fix DexWriter for hiddenapi section 2022-03-08 14:50:22 -06:00
Steven Arzt
85334314da Check whether we have a next element instead of accessing it and catching the exception. Exceptions are notoriously slow in Java, so we want to avoid that. 2022-03-08 14:50:22 -06:00
Ben Gruver
78a829342f Add tests for ReflectionUtils 2022-03-08 14:50:22 -06:00
NeonOrbit
b38f84838d Fix dexToJavaName() returning invalid name 2022-03-08 14:50:22 -06:00
Sriteja Sugoor
c70b71709f added support for 45cc and METHOD_PROTO 2022-03-08 14:50:18 -06:00
Andrey Galkin
3fb538f202 Fixing METHOD_PROTO and DualReferenceInstruction writing via class interning in DexPool 2022-03-08 14:49:49 -06:00
Marc Miltenberger
11f71ae481 Fix range check for character arrays with elements over 32767 2022-03-08 13:00:17 -06:00
Danny
ec5ae22888 Added greylist-max-r 2022-03-08 10:06:11 -08:00
Ian Zerny
4f4df9d54e Don't include debug info in method size.
The debug info items can be shared across methods so don't count
them as part of private method size.
2022-02-04 12:18:27 +01:00
Ian Zerny
6187d13f14 Only include debug info within the instruction range of a method. 2022-02-04 11:49:20 +01:00
Connor Tumbleson
e4746fbd75 fix: Cast java.nio.ByteBuffer to support java6-8
- affected methods
 -- position
 -- limit
 -- flip
 -- clear
2021-03-02 16:42:36 -08:00
Ben Gruver
c03e4bf7f8 Switch from the maven plugin to the maven-publish plugin 2021-03-01 17:13:38 -08:00
Ben Gruver
53b52f023d Switch from "compile" to "implementation" in gradle dependencies
compile/testCompile has been deprecated for a long time, and will be
removed in the next major version of gradle.
2021-03-01 15:36:10 -08:00
Ben Gruver
9ce00aae9c Switch out IndentingWriter for BaksmaliWriter throughout baksmali
This refactors everything using an IndentingWriter to use a BaksmaliWriter
instead, but the usages of ReferenceUtil and EncodedValue aren't refactored
yet.
2021-03-01 13:04:55 -08:00
Ben Gruver
b6a1ae3481 Add new BaksmaliWriter/BaksmaliFormatter classes
These are intended to be the centralized place for most individual items
to be formatted and converted to/written as text
2021-03-01 12:55:51 -08:00
Ben Gruver
c2ac11c693 Use DexFormatter everywhere in dexlib2
This replaces all uses of ReferenceUtil/EncodedValueUtils.writeEncodedValue.
2021-02-26 17:19:59 -08:00
Ben Gruver
e894435e9d Add new DexFormatter/DexFormattedWriter class
This will be a more unified way to get/write out human-readable strings for
individual "things" from a dex file. The goal is to replace things like
ReferenceUtil, EncodedValueUtils, etc.
2021-02-26 17:19:59 -08:00
Ben Gruver
812bf35149 Add support for the new test-api hidden api restriction in Android 11 2021-02-17 16:17:38 -08:00
Ben Gruver
c1f2da0e0b Improve the performance of the TypeRewriter.rewrite method 2020-02-03 00:09:21 -08:00
Ben Gruver
409cf27ba9 Make the new TypeRewriter.rewriteUnwrappedType protected
This method shouldn't be called from outside the class.
2020-02-02 20:52:57 -08:00
Ben Gruver
12b95235e3 Add a dex file rewriter to the rewriters module
Previously, if you needed to provide a custom dex file rewriter, you
would have to override the DexRewriter class. This provides a more
consistent interface, allowing the dex file rewriter to be specified in
the module.
2020-02-02 20:47:17 -08:00
Ben Gruver
cb37770c1c Make RewrittenArrayEncodedValue delegate rewriting sub-values to the module 2020-02-02 20:37:00 -08:00
Ben Gruver
78e92b0524 Add support for automatically rewriting array types in the rewriter
This adds a new rewriteUnwrappedType to the TypeRewriter class, which
gets called with the unwrapped type for array types, with the potentially
modified return value automatically being re-array-ified.
2020-02-02 20:34:29 -08:00
Ben Gruver
5a900e22e0 Use reference type from wrapped instruction in BaseRewrittenReferenceInstruction
Otherwise, the reference won't be rewritten correctly if the overriding
class overrides getReferenceType to return a different type.
2020-02-02 20:06:55 -08:00
Ben Gruver
49f7e26507 Set the hiddenApiRestrictionOffset in the new DexBackedDexFile constructor
This fixes the build. That's what I get for rebasing changes and not
testing.
2020-02-02 19:45:08 -08:00
Ben Gruver
210e36dc19 Update VersionMap for Android 10 2020-02-02 18:38:24 -08:00
Ben Gruver
c3bbc771f5 Add support for hidden api restrictions to smali and baksmali
The hidden api restrictions are exposed in the smali language as
additional access flags for fields and methods
2020-02-02 16:32:35 -08:00
Ben Gruver
721fffc60e Add support to dexlib2 for writing hidden api restrictions 2020-02-02 16:32:35 -08:00
Ben Gruver
36c94ad653 Add support for reading the new hidden api restrictions in dexlib2 2020-02-02 16:32:35 -08:00
Ben Gruver
1590b4a05e Use HeaderItem.ITEM_SIZE in the new DexBackedDexFile constructor 2020-01-22 16:50:28 -08:00
Huaxin Li
b7a1052c66 Add support for constructing a DexBackedDexFile from a DexBuffer 2020-01-22 16:50:20 -08:00
Ben Gruver
b3b8778ef8 Add support for Oat versions up to 173
The only relevant differences are some added/removed fields in the
OatHeader that affect the offsets of some fields we use.
2019-10-02 16:36:26 -07:00
Ben Gruver
539353a85c Use the correct path separator character when looking for classpath entries 2019-10-02 16:34:04 -07:00
Ben Gruver
751fe1ce61 Fix Preconditions.checkArrayPayloadElements
The previous implementation did not correctly handle negative numbers.
2019-09-12 11:30:27 -07:00
Ben Gruver
cf73ce28fd Fix the getters in ImmutableInstruction45cc 2019-08-28 12:15:05 -07:00
Ben Gruver
3b70c36296 Add better error messages when finding embedded dex files for oat files 2019-08-23 14:19:07 -07:00
Ben Gruver
bdbea44b98 Gracefully handle malformed array payload instructions with element width=0
These get handled as if they had element width=1 and element count=0
2019-08-23 14:04:40 -07:00
Ben Gruver
225a00c768 Use DexBacked* classes for the various sections in DexBackedDexFile 2019-08-23 11:22:13 -07:00
Alex Melkonyan
b044a00353 Fix bug #709 2019-08-23 11:16:30 -07:00
Ben Gruver
a29a420d2f Update the version map to reflect the released version of api 28 2019-08-07 14:49:31 -07:00
Ben Gruver
1ac14a1082 Add a workaround for the sym linked vdex files in api 28
In api 28, the vdex files in, e.g. the framework/arm directory are actually
just sym links to a shared vdex file in the framework directory. However,
the sym links use an absolute path, and so they don't resolve correctly in
the loop mounted system image.

As a simple workaround, we'll just search upward one directory in the path
if the vdex file can't be resolved.
2019-08-07 14:12:19 -07:00
Ben Gruver
c639d229c6 Add support for the new debug offset table for cdex files 2019-08-07 14:12:19 -07:00
Ben Gruver
8e4391262d Some dex files are listed in the oat file, but aren't present in the oat/vdex
Oat version 138 introduced the concept of an "uncompressed" dex file, where
the dex file is listed in the oat file, but it's not actually present in
the oat or vdex files, instead, it's in the apk as per usual.

This change makes dexlib2 ignore these files, treating them as if they are
not a part of the oat file.
2019-08-07 14:12:19 -07:00
Ben Gruver
6c110c1d96 Allow '!' as a separator char in embedded dex file names
Newer versions of art seem to use ! instead of : to separate the
inner dex filename from the name of the container containing it.

e.g.
/system/framework/framework.jar!classes2.dex
instead of
/system/framework/framework.jar:classes2.dex
2019-08-07 14:12:19 -07:00
Ben Gruver
732fe07403 Add initial support for cdex files
Loading cdex files is mostly supported, except for the new debug info
structures.

Dumping is somewhat supported, but only when there's a single cdex file
in the vdex.
2019-08-07 14:12:19 -07:00
Ben Gruver
eb3ab41fb1 Refactor CodeItem in preparation for cdex implementation
This extracts out the SectionAnnotator implementation into a named class,
which can be overridden by the cdex implementation
2019-08-07 14:05:34 -07:00
Ben Gruver
927a8b3c7c Refactor DexBackedDexFile in preparation for cdex implementation
This pulls out some of the functionality into protected methods that can
be overrided by the cdex implementation
2019-08-07 14:05:34 -07:00
Ben Gruver
dc79917ece Refactor DexBackedMethodImplementation in preparation for the cdex implementation
This pulls out some of the operations into protected methods, to be
overridden in the cdex implementation.
2019-08-07 14:05:34 -07:00