-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline decoding AndroidManifest.xml #3171
Streamline decoding AndroidManifest.xml #3171
Conversation
Failure looks odd. Looks related to some changes I did yesterday here: 3fdc06a, but they passed? |
Sorry appears all builds, even old ones are busted at the moment. I've opened #3174 and will have to fix that before any new PRs. |
No problem |
brut.apktool/apktool-lib/src/main/java/brut/androlib/res/ResourcesDecoder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both methods: decodeManifest decodeManifestWithResources in fact initializes decoder in the same way.
I don't think this is true. decodeManifest
calls getManifestFileDecoder(false)
and decodeManifestWithResources
calls getManifestFileDecoder(true)
Gotta find the ticket that led to the introduction of this, so people could force decode the manifest without parsing the resource table.
At first glance its true but in reality initialization the same. decodeManifest(...)
// Duo<ResFileDecoder, AXmlResourceParser> duo = getManifestFileDecoder(false);
ResStreamDecoderContainer decoders = new ResStreamDecoderContainer();
AXmlResourceParser axmlParser = new AndroidManifestResourceParser();
decoders.setDecoder("xml", new XmlPullStreamDecoder(axmlParser, getResXmlSerializer()));
Duo<ResFileDecoder, AXmlResourceParser> duo = new Duo<>(new ResFileDecoder(decoders), axmlParser);
ResFileDecoder fileDecoder = duo.m1;
// Set ResAttrDecoder
duo.m2.setAttrDecoder(new ResAttrDecoder());
ResAttrDecoder attrDecoder = duo.m2.getAttrDecoder();
attrDecoder.setResTable(resTable);
...
decodeManifestWithResources(...)
// Duo<ResFileDecoder, AXmlResourceParser> duo = getManifestFileDecoder(true);
ResStreamDecoderContainer decoders = new ResStreamDecoderContainer();
AXmlResourceParser axmlParser = new AndroidManifestResourceParser();
// Set ResAttrDecoder
axmlParser.setAttrDecoder(new ResAttrDecoder());
decoders.setDecoder("xml", new XmlPullStreamDecoder(axmlParser, getResXmlSerializer()));
Duo<ResFileDecoder, AXmlResourceParser> duo = new Duo<>(new ResFileDecoder(decoders), axmlParser);
ResFileDecoder fileDecoder = duo.m1;
ResAttrDecoder attrDecoder = duo.m2.getAttrDecoder();
attrDecoder.setResTable(resTable);
...
All tests worked. If resources dont parsed we have empty resource table initialized in the function |
049c49e
to
0a8a463
Compare
PR rebased |
I've been learning the past few days that the test suite wasn't as robust as I hoped :) Thanks for the update, I'll take another look. |
82155c8
to
55e2977
Compare
Rebased and removed local variable. |
Thanks for update. I understand now that the main difference is having a blank/empty resource table if we force it. Just going to find an old ticket that added this feature and hope the sample app still exists. Want to be sure that isn't regressed. |
This is independent from decoding process. I think need first decode resources - they are not dependent from manifest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but holding on merge till after I cut 2.8.1. Which should be Sat/Sun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran some tests today and I noticed a regression that we always print
➜ Optimized apktool d -r --force-manifest app-debug.apk -f
I: Using Apktool 2.8.1 on app-debug.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with only framework resources...
➜ Optimized apktool d app-debug.apk -f
I: Using Apktool 2.8.1 on app-debug.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with only framework resources...
➜ Optimized apktool d -r app-debug.apk -f
I: Using Apktool 2.8.1 on app-debug.apk
I: Copying raw manifest...
I: Copying raw resources...
As you can see it doesn't matter what mode we do. It still prints "decoding AndroidManifest.xml with only framework resources..."
ef9dabe
to
6d21ecc
Compare
Different logger message added |
6d21ecc
to
3549650
Compare
3549650
to
7564bc4
Compare
rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to fix a typo post merge, but otherwise looks good now.
Streamline decoding AndroidManifest.xml.
Decoding AndroidManifest.xml without using ResStreamDecoderContainer.
Both methods: decodeManifest decodeManifestWithResources in fact initializes decoder in the same way.