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

Recompiled APK Not Containing Some *.PIO Files #1366

Closed
Ticklefish opened this issue Nov 18, 2016 · 4 comments
Closed

Recompiled APK Not Containing Some *.PIO Files #1366

Ticklefish opened this issue Nov 18, 2016 · 4 comments

Comments

@Ticklefish
Copy link

Ticklefish commented Nov 18, 2016

This is using apktool 2.2.1.

When this APK is recompiled, 7 files in the res folder aren't put into the new APK. There's no mention of them in either the decompile or recompile logs - they just aren't included.
5 of these files are .PIO files from the drawable folder: "stat_sys_wifi_captive_0.pio","stat_sys_wifi_captive_1.pio","stat_sys_wifi_captive_2.pio","stat_sys_wifi_captive_3.pio" and "stat_sys_wifi_captive_4.pio".
Unfortunately I haven't been able to track down the other 2 yet.

When the original res folder is used in the new APK it installs and runs without any trouble (once the usual signature and permission stuff is sorted out). Without these 7 files the file FC's.

This seems to be yet another format that Samsung have started using. I've not attached the twframework-res.apk as, apparently, the APK runs with just framework-res.apk being installed during the de/recompiling. I'm not sure how true that is but these 7 files are still ignored during recompiling.

I've uploaded the framework-res.apk, original SystemUI.apk and recompiled SystemUI.apk to here:

https://www.mediafire.com/?chaacdpsxfqikeg

(The recompiled APK was made by creating a copy of the original, deleting the res folder from that original and copying over the res folder from the build folder.)

Hopefully this all makes sense...

@iBotPeaches
Copy link
Owner

pio

Confirmed a ton of .pio files are missing in compiled form. In the decoded state the stat_sys_wifi_captive_#.pio ones are the ones missing, they must have a corresponding asset that is making the decoder think it already exists. Not sure whats happening yet.

@mikeymopar
Copy link

mikeymopar commented Nov 19, 2016

Don't know if you noticed it also drops .xml files too (in same drawable folder: stat_sys_roaming_cdma_flash_ctc.xml along with some other pio files in drawable-xxxhdpi-v4)

@iBotPeaches
Copy link
Owner

Okay this is what is happening. The resources I've been studying are those 5 pio resources in res/drawables.

We can see them in the zip

-rw----     2.0 fat     1700 bl     1278 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_0.pio
-rw----     2.0 fat     1761 bl     1304 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_1.pio
-rw----     2.0 fat     1795 bl     1317 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_2.pio
-rw----     2.0 fat     1884 bl     1357 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_3.pio
-rw----     2.0 fat     1948 bl     1373 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_4.pio

This is great, but apktool actually doesn't care about the file system inside /res. The resources determine the files to load, so we can leverage aapt to cross check these.

A little basic expression and atom, we search for stat_sys_wifi_captive_[0-5].pio. We get 5 results.

        resource 0x7f0206db com.android.systemui:drawable/stat_sys_wifi_captive_0: t=0x03 d=0x00000566 (s=0x0008 r=0x00)
          (string8) "res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_0.pio"
        resource 0x7f0206dc com.android.systemui:drawable/stat_sys_wifi_captive_1: t=0x03 d=0x00000567 (s=0x0008 r=0x00)
          (string8) "res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_1.pio"
        resource 0x7f0206dd com.android.systemui:drawable/stat_sys_wifi_captive_2: t=0x03 d=0x00000568 (s=0x0008 r=0x00)
          (string8) "res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_2.pio"
        resource 0x7f0206de com.android.systemui:drawable/stat_sys_wifi_captive_3: t=0x03 d=0x00000569 (s=0x0008 r=0x00)
          (string8) "res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_3.pio"
        resource 0x7f0206df com.android.systemui:drawable/stat_sys_wifi_captive_4: t=0x03 d=0x0000056a (s=0x0008 r=0x00)
          (string8) "res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_4.pio"

Uh oh. This is the drawable-xxxhdpi-v4 configuration. There is no resources for those 5 named resources in res/drawable in the resources.arsc file. Lets check if these res/drawable-xxxhdpi-v4 actually exist in file system.

➜  Bug1366 zipinfo -l SystemUI_ORIGINAL.apk | grep 'stat_sys_wifi_captive'    
-rw----     2.0 fat     1700 bl     1278 defN 11-Jun-22 22:25 res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_0.pio
-rw----     2.0 fat     1761 bl     1304 defN 11-Jun-22 22:25 res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_1.pio
-rw----     2.0 fat     1795 bl     1317 defN 11-Jun-22 22:25 res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_2.pio
-rw----     2.0 fat     1884 bl     1357 defN 11-Jun-22 22:25 res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_3.pio
-rw----     2.0 fat     1948 bl     1373 defN 11-Jun-22 22:25 res/drawable-xxxhdpi-v4/stat_sys_wifi_captive_4.pio
-rw----     2.0 fat     1700 bl     1278 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_0.pio
-rw----     2.0 fat     1761 bl     1304 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_1.pio
-rw----     2.0 fat     1795 bl     1317 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_2.pio
-rw----     2.0 fat     1884 bl     1357 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_3.pio
-rw----     2.0 fat     1948 bl     1373 defN 11-Jun-22 22:25 res/drawable/stat_sys_wifi_captive_4.pio

They do. So those resources are put in res/drawable filesystem, but have no corresponding reference to them in the Android resource system. They may be used outside of the resource engine (via custom asset loading, etc), but apktool is doing exactly what it should. There is no support currently for apktool to emulate the /res filesystem for files that were never referenced.

@iBotPeaches
Copy link
Owner

iBotPeaches commented Nov 29, 2020

Putting this into ROADMAP. I don't see anything happening till we think about this plan with files in /res, but never referenced. Apktool was not built to handle that.

7558505

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

No branches or pull requests

3 participants