Skip to content
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

refactor: ExtDataInput rework, source layout and formatting #3738

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

IgorEisberg
Copy link
Contributor

Refactor ExtDataInput classes: ExtDataInput is now the extended interface, ExtDataInputStream is an easy-to-use FilterInputStream implementing ExtDataInput with static creator methods for big-endian and little-endian wrappers.

Refactor AaptManager class: unify aapt-related verifications to one class.

Replace Apache Commons' deprecated CountingInputStream with Google Guava's equivalent with the same name. Apache's BoundedInputStream is an overkill for our use case and its constructors are deprecated as well.

Normalize source layout to have a common and somewhat more standard order: Static fields first, instance fields after, methods last.

Fix some formatting, like empty spaces or extra spaces and exception messages.

Renamed ResXmlPatcher to ResXmlUtils, as it has more purposes than just patching.

Renamed DirUtil to DirUtils, to match other utility classes naming convention.

Moved "properties/apktool.properties" to jar's root, to match smali/baksmali.

Moved Android Framework to "prebuilt", as it is just a prebuilt, looks out of place among .class files.

@SuppressWarnings removed from Duo as there are quite a few unsafe assignments of raw Duo[] instances to parameterized Duo<> variables in the project, this is just Java being the primitive boilerplate it is, no point in fighting it.

No end-user changes.
Tested against a full ROM decompile/recompile, no issues found.

Refactor ExtDataInput classes: ExtDataInput is now the extended interface,
ExtDataInputStream is an easy-to-use FilterInputStream implementing ExtDataInput
with static creator methods for big-endian and little-endian wrappers.

Refactor AaptManager class: unify aapt-related verifications to one class.

Replace Apache Commons' deprecated CountingInputStream with Google Guava's
equivalent with the same name. Apache's BoundedInputStream is an overkill
for our use case and its constructors are deprecated as well.

Normalize source layout to have a common and somewhat more standard order:
Static fields first, instance fields after, methods last.

Fix some formatting, like empty spaces or extra spaces and exception messages.

Renamed ResXmlPatcher to ResXmlUtils, as it has more purposes than just patching.

Renamed DirUtil to DirUtils, to match other utility classes naming convention.

Moved "properties/apktool.properties" to jar's root, to match smali/baksmali.

Moved Android Framework to "prebuilt", as it is just a prebuilt, looks out of
place among .class files.

@SuppressWarnings removed from Duo as there are quite a few unsafe assignments
of raw Duo[] instances to parameterized Duo<> variables in the project, this is
just Java being the primitive boilerplate it is, no point in fighting it.

No end-user changes.
Tested against a full ROM decompile/recompile, no issues found.
@iBotPeaches
Copy link
Owner

117 changes :o

@IgorEisberg
Copy link
Contributor Author

117 changes :o

Most of the changes are just lines moved around and some private variables renamed lmao

@0xrxL
Copy link

0xrxL commented Dec 4, 2024

Great work @IgorEisberg. I remember you from when you created Xiaomi EU ROMs 👍

@IgorEisberg
Copy link
Contributor Author

Great work @IgorEisberg. I remember you from when you created Xiaomi EU ROMs 👍

I'm still the only developer for Xiaomi.eu since 2017, besides the included Updater app.
Java ain't my cup of tea, but keeps me busy. I'd rather code C# all day than have to deal with that boilerplate of a language.

@iBotPeaches iBotPeaches merged commit 542b66c into iBotPeaches:master Dec 11, 2024
25 checks passed
@iBotPeaches
Copy link
Owner

thanks!

@iBotPeaches iBotPeaches added this to the v2.11.0 milestone Dec 11, 2024
@IgorEisberg IgorEisberg deleted the refactor branch December 11, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants