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

Missing optical insets in 9Patch #1511

Closed
phhusson opened this issue May 22, 2017 · 2 comments · Fixed by #1512
Closed

Missing optical insets in 9Patch #1511

phhusson opened this issue May 22, 2017 · 2 comments · Fixed by #1512
Assignees
Milestone

Comments

@phhusson
Copy link
Contributor

aapt supports npLb PNG tags, which are then used by the framework, which will assume its value is 0 if it is not here.
In my understanding, this is simply a pre-processing done in aapt, which would just need to be (re?)enabled in apktool's aapt, though I'm not sure how/why is it disabled in apktool's aapt.

This leads to some graphical differences, with buttons being offset-ted from its actual position:
https://drive.google.com/file/d/0B5fQwPNvh3h0OVltb2N2eE90Smc/view?usp=sharing
(left is expected, center is actual result, right is the delta)
I can confirm that doing unzip framework-res-origina.apk res/drawable-hdpi-v4/btn_switch_to_o'*'
fixes the issue for the related resource (and the previously-mentioned delta-test)

I'm currently working on understanding why this code is not triggered in apktool's aapt, so hopefully I'll have a PR.

@phhusson
Copy link
Contributor Author

Ok, so this isn't a simple pre-processing, that information is stored as red pixel in the outling frame, so it would just need to reconstruct it

@iBotPeaches
Copy link
Owner

Thanks for the research. So it seems like reconstructing the black border for the 9patch format itself, we need to additionally support optical inserts by reconstructing red pixels.

Will have to dig into the internals of 9patch more, some recent changes include

iBotPeaches/platform_frameworks_base@6381dd4 - LP64: Make 9 patches architecture agnostic.

iBotPeaches/platform_frameworks_base@a730ef3 - Handle bad ninepatch data.

phhusson pushed a commit to phhusson/Apktool that referenced this issue May 22, 2017
@iBotPeaches iBotPeaches added this to the 2.2.3 milestone May 25, 2017
@iBotPeaches iBotPeaches self-assigned this May 25, 2017
iBotPeaches added a commit that referenced this issue Jun 8, 2017
iBotPeaches added a commit that referenced this issue Jun 8, 2017
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 a pull request may close this issue.

2 participants