Commit Graph

408 Commits

Author SHA1 Message Date
Pierre-Hugues HUSSON
2a35125441 Merge branch 'master' into fix-optical-inset 2017-05-26 10:07:29 +02:00
Connor Tumbleson
a00da345b2
code style cleanup 2017-05-25 07:02:23 -04:00
Connor Tumbleson
d2e16044bd
Merge branch 'fix-grayalpha-9patch' of https://github.com/phhusson/Apktool into phhusson-fix-grayalpha-9patch 2017-05-25 07:00:00 -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
d979247794
patches for style decoding 2017-05-23 09:27:27 -04:00
Pierre-Hugues Husson
60f32f7365 Decode OpticalInset cf #1511 2017-05-22 22:28:10 +02:00
Pierre-Hugues Husson
dd32f9414d In case of a grayscale + alpha 9patch, work-around JDK.
Original code:
https://worldwind31.arc.nasa.gov/svn/trunk/WorldWind/src/gov/nasa/worldwind/util/gdal/GDALUtils.java
/JDK-5051418
Cf Bug #1508
2017-05-20 13:49:40 +02:00
Connor Tumbleson
390ecae6c5
Handle strings with style index at end of string 2017-05-19 09:28:44 -04:00
Connor Tumbleson
e1f7ac355e
add support for preview builds (N, O) 2017-05-08 09:03:13 -04:00
Connor Tumbleson
b09dce4050
Prevent loading styles if style position is outside of string
- fixes #1453
2017-05-08 09:03:13 -04:00
Connor Tumbleson
e723e6e68f
Prevent over escaping plurals item tags 2017-05-08 08:34:17 -04:00
Connor Tumbleson
429e18ac25
Move MXSerializer to unique namespace
- prevents dependency version from loading
 - patch MXSerializer to skip duplicate namespaces at same depth
2017-05-08 08:33:49 -04:00
Connor Tumbleson
90b7d4b9b5
move common output to fine LOG level
- only visible in VERBOSE
2017-05-05 07:51:24 -04:00
Connor Tumbleson
e2f77aac18
Pass exception back to user
- check object is not null before closing
 - refs #1160
2017-05-05 07:46:56 -04:00
Connor Tumbleson
e4db1fa8d6 Prevent closing objects that may not exist. 2017-05-04 17:53:54 -04:00
Connor Tumbleson
488b9d58dd
code style changes 2017-05-02 08:16:07 -04:00
Marc Miltenberger
66c1b46865 Closing Framework and APK after use
This commit should fix https://github.com/iBotPeaches/Apktool/issues/1160
2017-05-02 08:21:09 +02:00
Connor Tumbleson
2d5337d3cb
Keep baksmali options same as previous apktool 2017-04-25 08:42:01 -04:00
Alexei Khlebnikov
0fa6418553 fix of binary xml string length encoding, now supporting long resource strings 2017-04-04 17:19:21 +02:00
Connor Tumbleson
74f76ae71d
Upgrade to smali 2.2 2017-03-27 09:16:11 -04:00
Peter M
c3fc2fe260 show message about null references 2017-01-13 16:49:58 +03:00
Connor Tumbleson
b60db0917d
Add support for 3 non-positional attributes
- fixes #1360 & fixes #1405
 - add tests
2017-01-13 07:06:38 -05:00
Connor Tumbleson
6e86fa9fcd retain backward compatibility w/ old ExtFile extended to new location 2016-12-26 07:37:54 -05:00
Connor Tumbleson
891d0d39e0 Refactor ExtFile to brut.j.dir
- move to using Paths when possible
 - adapt calls to FileDirectory to leverage Paths
2016-12-25 07:57:41 -05:00
Connor Tumbleson
166bf508e2 Add "--no-version-vectors"
- fixes #1384
 - prevents aapt versioning vectors on rebuild
2016-12-23 09:11:43 -05:00
Connor Tumbleson
31d015fe37 Add new aapt binaries for macosx 2016-12-23 07:30:46 -05:00
Connor Tumbleson
dae52d3899
Add new aapt binaries
- 32/64 unix
 - windows
2016-12-22 09:06:25 -05: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
6361fa9725
Evolve Update-Framework to Empty Framework Directory
- allows emptying of framework via (empty-framework-dir)
 - checks in place to only delete files that are APKs, non recursive
2016-10-06 09:18:16 -04:00
Connor Tumbleson
daa1e1d753
Updating Framework Support 2016-10-06 07:21:10 -04:00
Connor Tumbleson
81b22df13c Merge pull request #1324 from jamestut/arscfix2
Skip additional payload data of TYPE chunk
2016-09-18 16:56:23 -04:00
Connor Tumbleson
c1b4e0d321
Merge branch 'smali-api-level' of https://github.com/benjamin-promon/Apktool into benjamin-promon-smali-api-level 2016-09-18 16:47:04 -04:00
jamestut
52a44776df Skip additional payload data of TYPE chunk
Some APKs' arsc has additional payload data (like TYPE 8 chunks and/or padding) in the TYPE chunk. After the ARSCDecoder read such kind of chunk, it acts erratically. Most of the time, it just stops parsing the ARSC, therefore, some resources are not decoded because they are not in the apktool's resources' spec table.
2016-09-18 00:13:19 +07:00
Connor Tumbleson
bdfc28c20f
add support for TYPE_DYNAMIC_ATTRIBUTE 2016-09-15 08:36:25 -04:00
Benjamin Adolphi
db35f54af6 Pass minimum api level to smali library
When apktool creates a DexBuilder class, it creates it without specifying a minimum api level. This causes the DexBuilder class to assume api level 20 by default. This is not ideal since in some cases, the concrete minimum api level is required.

One such case is in smali's DexWriter class which implements a workaround for a bug in Dalvik that was fixed in Android 4.2 (https://code.google.com/p/android/issues/detail?id=35304) that causes apps that call the Method.getParameterAnnotations api to crash in some cases (see bug report for more details). The workaround that smali implements is only triggered if the minimum api level is below 17 (Android 4.2). But since apktool effectively sets the minimum api level to 20, this code is never triggered causing apktool to create apk files that crash on devices below Android 4.2.

This change passes the minimum api level to the smali library.
2016-09-15 00:31:32 +02:00
Connor Tumbleson
7801a4bbf2
don't compress mkv/webm 2016-08-24 08:44:24 -04:00
Connor Tumbleson
67d80a133f
Ignore the unknown 4 bytes in Android N 2016-08-24 07:56:09 -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
bada6441ec
don't edit the original Manifest
- use dummy copy and restore original after build
2016-08-06 09:45:18 -04:00
Connor Tumbleson
d0baa841eb
Add support for getting literal values for references in android:scheme
- side affect of using public.xml to get constant resource ids
 - fixes #1097
2016-08-06 08:31:58 -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
Anthony Morris
e23eb9cf6b Use Guava's LittleEndianDataInputStream.
This replaces the custom LittleEndianDataInputStream with
guava's implementation. To do this, I had to fix ExtDataInput
to better handle the case where skipBytes doesn't skip all the
bytes (the tests failed without this, and succeed with it). This
appears to be the main difference between the two implementations.
Guava's implementation is preferred because it is already a
dependency and because its license is clearer (the previous
implementation had a vague "public domain" comment in the thread
which may not be legally sufficient).

Fixes #1166
2016-08-05 14:36:34 +01:00
Connor Tumbleson
2135ad3057
Prevent truncation of hex values in AndroidManifest
- fixes #972
2016-08-02 22:48:02 -04:00
Connor Tumbleson
e6faa56c96
Correctly handle ResTable_typeSpec by using unsigned bytes to prevent overflow
- fixes #1185
 - allows applications that have large typeSpec indexes to work
2016-08-01 23:26:00 -04:00
Connor Tumbleson
3a982948ea
Adds full filepath for STORED files in case of multiple extensions
- fixes #1244
 - prevents greedy extension check STORE`ing too many files
2016-07-29 09:21:52 -04:00
Connor Tumbleson
475178605c
dump header size during failure 2016-07-21 08:29:06 -04:00
Connor Tumbleson
ed7b094b02
move default framework location on windows/unix
- unix - $HOME/.local/share/apktool
 - windows - $HOME/AppData/Local/apktool
 - #1277
2016-06-21 08:03:00 -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
c389139434
Handles APKs with missing versionCode/versionName properties
- fixes #1264
2016-06-08 07:24:27 -04:00
Connor Tumbleson
d932c70cbe
Forces extensions to lowercase to prevent collisions
- references #1258
2016-05-31 07:34:46 -04:00
Connor Tumbleson
47dd120b38 Prevents package renaming of Adobe AIR applications
- fixes #1240
2016-05-04 08:04:28 -04:00
Connor Tumbleson
ba62238843 Skips unknown bytes if mismatch occurs after reading Configurations
- fixes #1131
2016-04-30 09:02:23 -04:00
Sunil Shivanand
7c1ce8bb6e Issue 1234 - Use literal value of versionName when used
When reference string is used for versionName in AndroidManifest.xml,
fetch the literal value of the referened string in the output apk.

This patch doesnt modify the original apk.
2016-04-28 16:25:42 +02:00
Connor Tumbleson
87315af36e Remove previous android:debuggable value to allow changing
- adds unit test
 - normalizeNewlines moved to TestUtils
2016-04-28 08:31:36 -04:00
Benjamin Dobell
032a3e5e25 Reinstate minimalistic debug option to inject android:debuggable with aapt 2016-04-28 08:21:21 -04:00
Connor Tumbleson
8689991626 clear /apktool/framework/1.apk in between tests 2016-04-27 07:37:14 -04:00
Andrei Zhukouski
513e4b752b Copy AndroidManifest.xml
Copy AndroidManifest.xml along with resources.arsc from the framework apk file instead of creating the fake entry.
2016-04-22 08:32:42 +03:00
Andrei Zhukouski
2ec2fe817a Fix typo 2016-04-17 15:02:38 +03:00
Andrei Zhukouski
6e065f15a0 Support of official aapt
Create fake AndroidManifest.xml file inside each installed framework file to support official aapt from Google.
2016-04-17 14:48:51 +03:00
Connor Tumbleson
639ac84edb Dont fallback to HighestResSpec Package if only 1 main package
- fixes #1220
2016-04-11 07:05:00 -04:00
Connor Tumbleson
f2f099a97b Merge branch 'master' of https://github.com/mattsarett/Apktool into mattsarett-master 2016-03-24 08:14:32 -04:00
Chirayu Desai
26b60364fb Replace little endian data input stream implementation
* Drop LEDataInputStream (which had a restrictive license)
  with LittleEndianDataInputStream, which is public domain.

A minor change has been made to the new class, removing
the interitance of InputStream.
This makes it's behaviour indentical to the previous implementation,
and unit tests pass.

Fixes #1166
Source: http://www.peterfranza.com/2008/09/26/little-endian-input-stream/
2016-03-23 19:58:16 +05:30
Connor Tumbleson
ea2c821fa5 Add support for AndResGuard
- fixes #1170
2016-03-10 09:29:49 -05:00
Connor Tumbleson
ee8e9cea3d cleanup from removal of smali-debugging 2016-03-10 09:29:05 -05:00
Dave Nault
2f1326c6ca #1186 Performance: usage of String.format in ARSCDecoder.addMissingResSpecs
Reduces the time it takes to parse the Android framework by ~50%.

The synthesized name now has no leading zeroes, but this doesn't appear to matter since the numeric part of the name isn't used anywhere.
2016-03-07 11:33:07 -08:00
Matt Sarett
4f5cc1b903 Removing spaces 2016-03-04 11:27:19 -05:00
Matt Sarett
ae6f8083f1 Fix bug reencoding 9patch pngs
Fixes issue 1180.
https://github.com/iBotPeaches/Apktool/issues/1180
2016-03-03 18:17:11 -05:00
Connor Tumbleson
eabedeb211 remove unused file 2016-02-27 20:56:14 -05:00
Connor Tumbleson
cd852cd658 Removes SmaliDebugging
- fixes #1061
2016-02-27 20:20:53 -05:00
Connor Tumbleson
52e9e8a4d7 fix spacing & change warning message to use LOGGER 2016-02-16 08:18:26 -05:00
Christopher R. Palmer
4a02f5321c decoder: Extend "keep-broken-res" to also ignore duplicate resources 2016-02-15 11:13:49 -05:00
Connor Tumbleson
b29df52b87 Cleanup unclosed streams plus formatting
- run FindBugs to find problems
2016-02-14 20:34:06 -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
fd579747a8 license additions and reverting non-needed changes 2016-01-22 07:17:07 -06:00
Rover12421
123912d226 Apktool.yml file (MetaInfo) using object serialization
non-printable character more intuitive, does not affect printable
character view
2016-01-22 06:28:03 -06:00
Connor Tumbleson
81404c8904 close streams that needed closing (fixes #1143) 2016-01-22 06:27:23 -06:00
Connor Tumbleson
d5ca4c12a1 fix #1123
- correctly handles @null in xml
 - added unit test
2016-01-22 06:07:49 -06:00
Connor Tumbleson
0011498b52 [skip] rename var to match extension or file without extension 2016-01-06 12:49:55 -06:00
Andrei Zhukouski
22bd5b0acc Fixes issue #1122 2016-01-04 13:15:54 +03:00
Ira Hanson
8232ee0ea8 Consistently encode unknown filenames to prevent cast error 2016-01-02 21:40:15 -06:00
Connor Tumbleson
13b39903d2 empty or null values should not be matched 2015-12-26 06:59:57 -05:00
Connor Tumbleson
f9323943db Handle Dexguard key names
- Temporarily replace with dummy value names till research is completed
 - allows decode
2015-12-26 06:59:43 -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
831765665f Handling empty (null) values again 2015-12-14 11:35:15 -06:00
Connor Tumbleson
b2d50bec5f [skip] code style cleanup 2015-12-14 07:10:14 -06:00
Connor Tumbleson
eabb7d819b Correctly read sparse ResourceTables.
Prior to this change, APKs usually went Package -> TypeSpec -> Config (all) -> Entries.
Reading all configs under that TypeSpec. Now we have packages that go
Package -> TypeSpec -> Config (single) -> Entries.

So we have to read this correctly to make sure we can correctly decode sparse and packed
Resource tables.
2015-12-14 07:03:09 -06:00
Connor Tumbleson
7e803aeac9 Gracefully handle null values 2015-12-14 07:00:46 -06:00
Connor Tumbleson
be4bdf1d75 Adds support for DATA_NULL_EMPTY 2015-12-14 07:00:12 -06:00
Connor Tumbleson
6c4167fba4 Fixes #1099
- Moves Config --> Type
 - Moves Type -> TypeSpec
 - ResType -> ResTypeSpec
 - ResConfig -> ResType

 This is to match AOSP and ease the transitions/updates of new AOSP drops
2015-12-07 20:48:57 -06:00
Connor Tumbleson
1e5dc3006e Add headerSize & chunkSize to Header class 2015-12-07 07:34:56 -06:00
Connor Tumbleson
af2f54245b [skip] remove confusing logic 2015-12-03 07:57:12 -06:00
Connor Tumbleson
8374839427 MNC, noticed recently in API 23, is no longer 0 padded. So mnc001 is now mnc1
- Frameworks between froyo and honeycomb have mnc001, etc
 - A size check of ResConfig header for less than 32 (honeycomb) uses old decode method
 - Greater than 32 bytes moves to new decode method of mnc# vs mnc###
2015-12-01 08:48:31 -06:00
Rover12421
6f617db53f set readConfigFlags read default value to 28
fix if size == 28, remainingSize error.
2015-11-17 14:31:17 +08:00
Connor Tumbleson
5f5f50f6fd Fixes edge case where mnc = 1, with no mcc field. Fixes #1072 2015-11-01 06:17:29 -06:00
Connor Tumbleson
83f3273a48 Merge branch 'master' of github.com:iBotPeaches/Apktool 2015-10-20 06:27:09 -05:00