Commit Graph

75 Commits

Author SHA1 Message Date
Tvildo
5d6c6c04d2
Fixes Facebook apk deconstruction (#2884) 2022-09-19 12:34:14 -04:00
Connor Tumbleson
a269a8e0d5
refactor: drop unused exceptions (#2746) 2022-01-18 08:18:33 -05:00
Goooler
c3e8be3e8a Reformat & Rearrange 2021-08-27 01:32:40 +08:00
Goooler
94ed86db28 Code cleanups 2021-08-27 01:16:46 +08:00
Goooler
e25c3636ff Update docs & licenses to use https 2021-08-26 07:40:32 -04:00
Connor Tumbleson
e4654e0b5f
fix: write dummy resources as items 2021-07-04 09:49:59 -04:00
Connor Tumbleson
447ba50332
refactor: drop author tags and support javadocs 2021-03-07 15:06:45 -05:00
Connor Tumbleson
734793c4bb fix: survive if referent is null (flags) 2020-11-29 09:34:43 -05:00
Connor Tumbleson
5f7630e325 fix: survive if referent is null (enum) 2020-11-29 09:34:43 -05:00
Connor Tumbleson
943b424172
fix: use proper array syntax 2020-09-13 08:45:05 -04:00
Connor Tumbleson
120c63df75
refactor: remove unused methods/variables 2020-09-13 08:44:40 -04:00
Connor Tumbleson
65eeb2fb4a
refactor: make constant values final 2020-09-13 08:44:08 -04:00
Connor Tumbleson
2720cf93a3
refactor: put same path switch on same line 2020-09-13 08:41:55 -04:00
Connor Tumbleson
35a4bd6718
style: re-org exceptions to have suffix (#2400)
* style: re-org exceptions to have suffix

* fix: add missing exception for ResResSpec
2020-09-13 08:40:03 -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
f997e0aff1 fix: patch out bools on ResBooleans, as they must be empty
- refs: #1918
2019-01-03 16:57:23 -05:00
Connor Tumbleson
9fc1ede991
License 2018 update 2018-02-16 08:26:53 -05:00
Andrei Conache
9abaa4ee30 fix potential class cast exceptions
- fixes #1444
2017-08-27 15:23:08 +02: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
Connor Tumbleson
e723e6e68f
Prevent over escaping plurals item tags 2017-05-08 08:34:17 -04:00
Connor Tumbleson
90b7d4b9b5
move common output to fine LOG level
- only visible in VERBOSE
2017-05-05 07:51:24 -04:00
Peter M
c3fc2fe260 show message about null references 2017-01-13 16:49:58 +03:00
Andrei Conache
983e0ad111 fix TYPE_DYNAMIC_ATTRIBUTE support 2016-12-20 14:09:10 +01:00
Connor Tumbleson
c1cb9425d5 Don't write out a null spec
- #1370
2016-12-02 15:32:31 -05:00
Connor Tumbleson
bdfc28c20f
add support for TYPE_DYNAMIC_ATTRIBUTE 2016-09-15 08:36:25 -04:00
Connor Tumbleson
00abedfa06
Check for null parent references to prevent crash
- fixes #745
2016-08-06 12:46:45 -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
6e509695eb
Patch newest AndroResGuard format 2016-08-06 07:56:17 -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
f3e21023ac Prefix integers only exceeding 9 digits to treat as string
- This prevents small numbers like "1" to become "\ 1"
 - added unit tests
 - fixes #1130
2016-02-10 08:05:54 -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
13b39903d2 empty or null values should not be matched 2015-12-26 06:59:57 -05:00
Connor Tumbleson
a8a9c40a7b add ResBoolValue to Style check 2015-12-26 06:58:39 -05:00
Connor Tumbleson
ba7393d705 Fixes #767
Handles large int values in AndroidManifest.xml, by prefixing
with `\ ` which aapt treats a string. This prevents truncation
from overflow.

Superseeds PR#1007 - thanks to gio73 for initial research &
MarchMil for continued investigation.
2015-12-18 11:30:28 -06:00
Connor Tumbleson
e5ac340cab [ci skip] minor spacing change 2015-12-18 09:46:28 -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
Connor Tumbleson
3dea579f66 Prevent casting Strings/Styles to Attrs
- refs #957, #1060
2015-10-15 08:58:19 -05:00
Pierre-Hugues Husson
e7b294a3ea Fix flags being defined as references 2015-09-10 18:07:00 +02: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