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

[BUG] Extra * added in xml files #2771

Closed
starbucks2010 opened this issue Mar 6, 2022 · 7 comments · Fixed by #2787
Closed

[BUG] Extra * added in xml files #2771

starbucks2010 opened this issue Mar 6, 2022 · 7 comments · Fixed by #2787

Comments

@starbucks2010
Copy link

Information

  1. Apktool Version (apktool -version) - 2.6.1
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - ROM

Stacktrace/Logcat

Include stacktrace here

Steps to Reproduce

  1. apktool Just decode the SystemUI.apk and look into the xml files for the extra * added on code pointing to framework resources like this: android:textSize="@*android:dimen/text_size_.....

apktool v2.6.0 : android:textSize="@android:dimen/text_size_body_2_material"
apktool v2.6.1: android:textSize="@*android:dimen/text_size_body_2_material"

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

Framework and SystemUI uploaded here: https://drive.google.com/drive/folders/114MkIArkcbQeDqO702RTI-e3hllxJtOd?usp=sharing

APK

If this APK can be freely shared, please upload/attach a link to it.

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? - Yes, same issue
  2. If you are trying to install a modified apk, did you resign it? - Just decompiling
  3. Are you using the latest apktool version? - Yes, v2.6.1

This issue seems to be related to bug reference #2650.

@iBotPeaches
Copy link
Owner

iBotPeaches commented Mar 7, 2022

So I took a look in detail on this. I attached a breakpoint and waited for the first resource to be detected as private.

example

It was

0x7f1403bd style/Theme.SystemUI

Which is a private resource specific to that application. So I'm confused why this is attaching a private resource trick when I thought that was isolated to framework references.

@MrIkso - Should the #2650 fix been applied only to non-private packageIds? Like we we ignore any on 7F, since its presumed those resources are private and internal. Or am I misunderstanding the patch?

@pashamcr
Copy link
Contributor

pashamcr commented Mar 8, 2022

@iBotPeaches delete commit d294111
compile new aapt/aapt2 from current sources, this problem will disappear by itself, besides this fixes the error #2033 (apk https://apkpure.com/contacts/com.google.android.contacts/variant/3.62.2.428100364-APK)

For example, aapt2_x64 from new sources, embed it in apktool (just an archiver) and check:

aapt2.exe.txt

@iBotPeaches
Copy link
Owner

Thanks @pashamcr, do you have a commit off hand for aapt/aapt2 that resolved this? What led aapt to handling private resources less strict than present?

@pashamcr
Copy link
Contributor

pashamcr commented Mar 8, 2022

@iBotPeaches I don’t remember what I fixed, but there seems to be all the fixes like yours

cd frameworks
patch -p0 < aapt2.patch

aapt2.patch.txt

@iBotPeaches iBotPeaches added this to the v2.6.2 milestone Mar 13, 2022
@iBotPeaches
Copy link
Owner

Okay thanks, looks like I'll investigate this and look into a revert and updating aapt2.

@starbucks2010
Copy link
Author

@iBotPeaches Let me know if you want me to test something.

@iBotPeaches
Copy link
Owner

➜  2771 apktool d SystemUI_g998b_bvb1_stock.apk -t 2771
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.6.2-6c94ca-SNAPSHOT on SystemUI_g998b_bvb1_stock.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1-2771.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜  2771

Checked for *.

➜  SystemUI_g998b_bvb1_stock grep -ir 'text_size_body_2_material' *
res/values/public.xml:    <public type="dimen" name="abc_text_size_body_2_material" id="0x7f07002b" />
res/values/styles.xml:        <item name="android:textSize">@dimen/abc_text_size_body_2_material</item>
res/values/dimens.xml:    <dimen name="abc_text_size_body_2_material">14.0sp</dimen>

Built

➜  SystemUI_g998b_bvb1_stock apktool b . --use-aapt2
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.6.2-6c94ca-SNAPSHOT
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
➜  SystemUI_g998b_bvb1_stock 

Will be resolved with #2787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants