Apktool: @empty item considered @null

Created on 10 Jun 2016  路  5Comments  路  Source: iBotPeaches/Apktool

This happens on apktool 2.1.1 running on Linux, APK coming from a Mediatek 6.0 ROM, but is most probably not MTK specific.

For instance this line:
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles_material.xml#846
This contains a @empty
Current apktool decodes it to @null which is wrong, the behaviour is different.
For instance https://android.googlesource.com/platform/frameworks/base.git/+/master/core/java/android/widget/PopupWindow.java#231
The hasValueOrEmpty will return false for @null, but true for @empty, so apktool d/b will change the behaviour of the matching firmware.
Namely, the CTS android.widget.cts.ListPopupWindowTest#testAccessAnimationStyle fails without this change.

Bug

Most helpful comment

All 5 comments

Very nice catch. This seems to be the underlying issue (I think) affecting #1116

My check for empty vs null must be wrong - https://github.com/iBotPeaches/Apktool/blob/master/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java#L36

Thanks! Looks good. I'll whip up some tests when I get a chance and get this merged in.

@phhusson could you post your built apktool with that fix?

Was this page helpful?
0 / 5 - 0 ratings