Commit Graph

33 Commits

Author SHA1 Message Date
Tvildo 5d6c6c04d2
Fixes Facebook apk deconstruction (#2884) 2022-09-19 12:34:14 -04:00
Goooler e25c3636ff Update docs & licenses to use https 2021-08-26 07:40:32 -04:00
Connor Tumbleson 447ba50332
refactor: drop author tags and support javadocs 2021-03-07 15:06:45 -05:00
Connor Tumbleson 2720cf93a3
refactor: put same path switch on same line 2020-09-13 08:41:55 -04:00
Connor Tumbleson 3f831c8221
refactor: copyright year should be year started, not current year 2020-04-11 06:33:05 -04:00
Frieder Bluemle 81ca785e02
Fix file header comment format 2020-02-29 17:37:46 -08:00
Connor Tumbleson 25a1cb02ef
fix: License 2019 update 2019-07-13 12:19:41 -04:00
Shaheen Gandhi 2bc8feb549 Add attr resource type handling 2019-07-02 19:23:33 -04:00
Igor Eisberg be1aea76fe
Fix reference values not being resolved against frameworks
This Apktool issue has existed for a long time and is especially prevalent with ROMs with multiple frameworks.
The issue happens because Apktool treats reference values inside XMLs (like layouts) as raw text values, and doesn't resolve them during decompile time. This causes some values to be misformed, but more importantly, this causes values referencing to secondary frameworks to not be resolved with their source frameworks, which also means the framework ID won't be added to usesFramework.ids in apktool.yml, and that breaks recompiling.
The interesting thing is that reference values are actually being resolved when they are located in value resources, like styles, thus presenting an inconsistent behavior.
This simple mod eliminates the "rawValue" for reference values, and that forces the "value" (resource ID) to resolve against the respective frameworks, fixing misformed values in the process.

BEFORE:
I: Using Apktool 2.4.0-896569-SNAPSHOT on Notes.apk
I: Loading resource table...
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (miui.system), pkgId: 18
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: bin\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Loading resource table from file: bin\framework\16.apk
I: Decoding Shared Library (androidhwext), pkgId: 15
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

Some comparisons before and after the fix:
https://i.imgur.com/2gTllT0.png
https://i.imgur.com/KzJUeQt.png

AFTER:
I: Using Apktool 2.4.0-896569-SNAPSHOT on Notes.apk
I: Loading resource table...
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (miui.system), pkgId: 18
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: bin\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Loading resource table from file: bin\framework\16.apk
I: Decoding Shared Library (androidhwext), pkgId: 15
I: Loading resource table from file: bin\framework\18.apk
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (android.miui), pkgId: 17
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
2019-02-18 06:47:09 -05:00
Vincent Barthelemy 13e356f2ef fix: use the res type spec name to create res bag value
Starting with the version 28.0.3 of the Android SDK build tools,
the internal ids of the items of an array bag seems to have changed.

Because of those changes, array resources were no longer decoded correctly.
They were decoded as style resources.

Instead of using the id of the first item within a resource bag,
the name of the res type spec is now used to choose the correct
resource bag value to create.

Note: a list of "legal names" for resource types  can be found in the source code of aapt2.
2019-01-29 10:07:40 +01:00
Connor Tumbleson 9fc1ede991
License 2018 update 2018-02-16 08:26:53 -05:00
Connor Tumbleson 15bc16c6bd
Survive decoder if malformed string is encountered
- fixes #1564
2017-07-27 06:55:18 -04:00
Connor Tumbleson 1597c12472 changed all license files 2017-07-05 12:05:52 -04:00
Connor Tumbleson 15c4f333a5
Correctly decode arrays.xml
- #1453
 - temporarily cast unknown enum (0) to ResArray
2017-05-24 08:09:05 -04:00
Andrei Conache 983e0ad111 fix TYPE_DYNAMIC_ATTRIBUTE support 2016-12-20 14:09:10 +01:00
Connor Tumbleson bdfc28c20f
add support for TYPE_DYNAMIC_ATTRIBUTE 2016-09-15 08:36:25 -04:00
Connor Tumbleson 567907b187
Create fake names to prevent abuse from duplicate key names
- fixes #894
2016-08-06 07:57:19 -04:00
Connor Tumbleson a684bae43a
Fixes improper decoding of @empty value
- fixes #1270
 - references #1116
2016-06-13 08:40:00 -04:00
Pierre-Hugues Husson 606e47bf55
Add @empty type 2016-06-13 08:23:08 -04:00
Connor Tumbleson ea2c821fa5 Add support for AndResGuard
- fixes #1170
2016-03-10 09:29:49 -05:00
Connor Tumbleson d5ca4c12a1 fix #1123
- correctly handles @null in xml
 - added unit test
2016-01-22 06:07:49 -06:00
Connor Tumbleson b2d50bec5f [skip] code style cleanup 2015-12-14 07:10:14 -06:00
Connor Tumbleson be4bdf1d75 Adds support for DATA_NULL_EMPTY 2015-12-14 07:00:12 -06:00
Matt Mastracci 4249dde7cc Propagate the raw int values to callers 2015-07-07 15:39:22 -06:00
Connor Tumbleson 8254764c6c More robust ResFileValue detection
Previously in 4882396163, strings that
resembled a filepath (ie res/foo/file), would be assigned to a
ResFileValue, which when attempted to be casted to ResScalarValue would
error out.

Attempting to check the filesystem for such files, slowed apktool's
execution majorly. In order to prevent this, the ClassCastException
and other checks related to checking ResFileValue when type is string
was added.

This allows bogus strings such as (res/foo/file) to be added, but the
exception is caught and allows decoding to continues. Fixes #921.
2015-05-14 13:27:22 -05:00
Connor Tumbleson 2db8828efb add support for TYPE_NULL 2015-03-12 17:43:17 -05:00
Connor Tumbleson bbc6023068 gracefully handle apks that have strings that resemble filepaths
- ex string res/foo tries to map to resource res/foo
 - looks for dot now, ie res/foo.xml
2015-03-06 17:04:43 -06:00
Connor Tumbleson 4882396163 Prevent casting strings that resemble filepaths to ResFileValues
- add testcase
 - adapt changes
 - introduce decodeManifestWithResources which uses attr decoding w/ resources
2014-12-26 08:08:50 -06:00
Connor Tumbleson 554591a339 added support for TYPE_DYNAMIC_REFERENCE 2014-11-21 11:26:17 -06:00
Connor Tumbleson 9031c22365 [skip] update all copyrights to 2014 2014-10-23 18:14:48 -05:00
Connor Tumbleson 086139a037 code cleanup of 2014 2014-02-09 19:01:57 -06:00
Connor Tumbleson e82c0754de Code cleanup of 2013
Signed-off-by: Connor Tumbleson <connor.tumbleson@gmail.com>
2013-02-12 21:12:17 -06:00
Connor Tumbleson 4db49ab347 Adding brut.apktool :/ 2012-09-19 20:27:35 -05:00