Commit Graph

349 Commits

Author SHA1 Message Date
Frieder Bluemle
81ca785e02
Fix file header comment format 2020-02-29 17:37:46 -08:00
Connor Tumbleson
b05f19b80d fix: patch aapt2 to not run custom commands on passed aapt2 binary 2019-11-20 06:46:06 -05:00
Peter Retzlaff
d6f38e38cd Only attempt to use -e option when the packaged aapt binary is used. 2019-11-20 06:46:06 -05:00
Peter Retzlaff
5d488e5f22 Create file containing the do-not-compress extensions and pass it to aapt. 2019-11-20 06:46:06 -05:00
Brian Pak
31a23ba493 Fix AXML parser to handle obfuscated attribute names
This adds an additional check if the attribute namespace belongs to
Android namespace, and if so we try to decode using attribute decoder.

Fixes #1576.
2019-11-14 18:37:25 -05:00
Connor Tumbleson
197d468727
Merge pull request #2175 from danielmalmq/master
Fixes issue with decoding apk containing a zero byte 9patch
2019-10-06 05:24:04 -04:00
yangjing.yeoh
9e39755750 bugfix, fix get wrong package ResPackage for multi-pkg resources.arsc. 2019-09-23 18:39:18 +08:00
Daniel Malmqvist
dc312a5336 Fixes issue with decoding apk containing a zero byte 9patch 2019-09-19 13:34:06 +02:00
Connor Tumbleson
103aa978df
refactor: remove outdated ALLOWED_PACKAGES constant 2019-07-14 06:56:37 -04:00
Igor Eisberg
8084762274
Fix recompile of miui.apk by allowing package renaming
This old issue prevented the package to be renamed from com.miui.core to miui, making it impossible to recompile, as all attributes are refefred to as miui:*/*. This fixes it permanently.
2019-07-14 06:54:32 -04: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
Connor Tumbleson
adbde1745f fix: "qpm" can exist without 9patch, and use new "copyToDir" 2019-04-26 11:14:31 -04:00
Connor Tumbleson
73ac0d96fb
Merge pull request #2066 from iBotPeaches/issue-2045
Support for SDK_Q shorthand
2019-04-24 19:56:15 -04:00
Connor Tumbleson
f3f634f010 fix: add SDK_Q (test) value of 10,000 2019-04-24 18:46:48 -04:00
Connor Tumbleson
2e75f7b799 fix: create directory if doesn't exist, before error 2019-04-24 18:45:57 -04:00
Connor Tumbleson
8e00de38a0
Merge branch 'master' into patch-1 2019-02-27 18:26:02 -05:00
Igor Eisberg
49e55f522f
Fix APKs with SDK versions being reference values
This non-standard behavior is rare, but quite annoying.
The solution is simple - replacing the reference value with the actual value from integers.xml, just like Apktool already does for versionName.
2019-02-20 08:26:14 -05: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
IgorEisberg
1e68bb0ede
feat: Fill missing 9patch lines to fix recompile
Somehow Google manages to compile MiuiSystemUI.apk (and a few other APKs I encountered) with a misformed pip_dismiss_scrim.9.png.
Either way, every time I encountered such 9.patch images, the missing lines always indicated a single full div or padding.
Apktool already fills missing padding lines, now it can also fill missing divs.
2019-02-16 18:52:34 -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
016dc25fa9
Merge branch 'master' into master 2019-01-09 17:18:19 -05:00
Connor Tumbleson
45152c269a refactor: use specific exceptions when decoding raw xml 2019-01-09 17:11:51 -05:00
Connor Tumbleson
c1f50a2810 style: remove unused LOGGER for PullStreamDecoder 2019-01-09 17:11:32 -05:00
Connor Tumbleson
6bb73b509d fix: throw specific errors during XMLPullParser error 2019-01-09 17:10:56 -05:00
Sebastian Rasmussen
b01dce7f3a Adapt AXMLResourceParser to handle broken headers.
Fixes #1976.
2019-01-08 21:20:50 +01:00
Connor Tumbleson
7cd8946849 fix: fallback to raw decoder if xml decoder failed
- prevents injection of false value
2019-01-04 18:00:19 -05: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
e82537e340 Merge branch 'no-crunch-aapt-option' of https://github.com/Novex/Apktool 2018-12-18 16:24:27 -05:00
a-bahmani
db553ebe8d
Fix null pointer
When I am decompiling an apk, I got this exception:
Exception in thread "main" java.lang.NullPointerException
        at brut.androlib.res.data.ResResSpec.<init>(ResResSpec.java:42)
2018-12-17 23:42:28 +03:30
Connor Tumbleson
3f85dfa6c9 fix: revert change that enforced "STRINGPOOL_TYPE" on StringPool
- fixes: #1876
2018-08-23 17:14:38 -04:00
Seb Patane
b0fd764df4 feat: Expose the aapt --no-crunch option
- Add a --no-crunch/-nc flag to apktool which gets passed through to aapt
- This allows apktool to make a byte-for-byte copy of resource files
- refs: #1232
2018-07-24 13:54:37 +10:00
Connor Tumbleson
72196f3544 Revert "fix: normalize paths for uncompressed assets & unknown files"
This reverts commit ca25a26944.
2018-04-06 14:58:11 -04:00
Connor Tumbleson
46ebcb0fab Revert "fix: don't use deprecated property "doNotCompress""
This reverts commit 258fb82fe2.
2018-04-06 14:57:24 -04:00
Connor Tumbleson
db59f93e36 fix: ignore package "FFFFFFFFFFFFFFFFFFFFFF" to prevent wrong renaming
- refs: #1752 / #1471
2018-04-06 14:46:39 -04:00
Connor Tumbleson
2d190d019c fix: remove 6 year old experimental smali resource tagger
- refs: #244
 - Regular expressions are not the way to fix this. Too many situations
 in smali where patterns won't work. Correct fix would be to hook dexlib
2018-04-06 12:03:08 -04:00
Connor Tumbleson
258fb82fe2 fix: don't use deprecated property "doNotCompress" 2018-04-06 10:49:08 -04:00
Connor Tumbleson
ca25a26944 fix: normalize paths for uncompressed assets & unknown files 2018-04-06 10:31:28 -04:00
Connor Tumbleson
7621fdb79c Assume Android P will be API 28
- refs: #1742
2018-03-12 15:34:32 -04:00
Connor Tumbleson
3f8d9fa835 aapt2: patch system for decoding pkgId between 0x7f - 0xff 2018-03-05 10:28:50 -05:00
Connor Tumbleson
448d14592f aapt2: don't rebuild compile stage unless needed 2018-02-28 18:40:13 -05:00
Connor Tumbleson
d2c808dd7d aapt2: refactor loading of aapt/aapt2 binaries
- change: die out if invalid aapt path is provided
2018-02-28 11:25:56 -05:00
Connor Tumbleson
f05bd31e59 aapt2: sparse resource pulling from yaml 2018-02-28 11:05:07 -05:00
Connor Tumbleson
3c84590a1a aapt2: treat verbose output as fine 2018-02-28 10:58:38 -05:00
Connor Tumbleson
5d95b388aa aapt2: beginning use of aapt2 vs aapt1 params 2018-02-22 11:22:40 -05:00
Connor Tumbleson
0827b2b7a2 aapt2: read the type spec and infer if sparsely packed 2018-02-22 11:22:40 -05:00
Connor Tumbleson
88987e60b3 aapt2: Add a flag to determine if sparse resources or not 2018-02-22 11:22:40 -05:00
Connor Tumbleson
b7b449eaaf
We are ignoring typeIdOffset
- missing sample that experiences this
 - needs tests
 - samples requested: https://github.com/iBotPeaches/Apktool/issues/1728
 - refs: f90f2f8dc3
2018-02-16 08:38:07 -05:00
Connor Tumbleson
9fc1ede991
License 2018 update 2018-02-16 08:26:53 -05:00
Connor Tumbleson
1d485d21e9
cleanup formatting in smali-res-tagger
- experiment rewriting resIds in smali to remove need of public.xml
2018-02-16 08:25:34 -05:00