Related
This is my attempt to get some more creativity, innovation, and roms here on xda. alot of people here have incredible skills but they cant be harnessed because they dont know what to do. if you are an artist we need you make icon packs. you have made 30 roms but you cant sign them. blah blah.
so no one abuse this but i attached a toolkit to do anything and everything with android on windows. im pushing this to be used for creating themes. hopefully it can help. but i thought it would be nice if everyone had this and the opensource community could start to grow even more.
i like this idea because it can help fellow Devs and even the watchers. everyone can get involved and give something to the community.
And now i present the Avabox
Any questions post them up.
OUTLINE------------------------------------------------------------
unyaffs-you have the ability to take system.img and data.img from you nandroids and get specific items from them.
Autosign- sign anything and everything. name your zip update.zip and follow the readme. roms themes, apps, anything.
Baksmali- put in apk in the folder. read readme. edit any icons wallpapers, anything. close it up and enjoy.
Perlscripts- this opens the boot.img for you.
Read the readme on all of these programs.
So this is going to be a quick tutorial Im gonna put up a video soon on how i got this to work on my computer
First things first download Avabox and unzip it in your C folder (same place you put androidsdk).
then get the java runtime from here not to be confused with the java development kit but since your there might as well grab it as well.
Install the java runtime then reboot
then open up avabox and click on autosign and place the zip you want signed in that folder and name it update.zip (dont add the .zip part it should already be a zip file).
then open up command prompt and type:cd\
cd Avabox/auto-sign
java -jar signapk.jar testkey.x509.pem testkey.pk8 update.zip update_signed.zip
After that last enter give it a second and look in your avabox/update file and you'll notice a new file called update_signed.zip
I know that this is almost word for word from the read me but a few differences can go along way expect a video shortly..... well around wednesday or whenever i can get someone to help with this
porting
im interested in learning how to port and combine different aspects of themes and other mods. will this do it or is there other software i need. I can do the work if shown the way. I read all the post everday with peopl;e asking for this and that and i do it myself. If shown I would help with requests as much as possible. HELP PLEASE
Thank you Avalaunch!!
so with this software, can i take a signed theme mod (like launcher or taskbar) and it will grab the images for me to edit, and then repack and sign to a flashable zip?
Everyone that knows how to use bak/smali, I have a question.
The modifications I made to the extracted pngs aren't getting transferred back to the original apk when I close it back up. Any Ideas? I'm getting really close to a breakthrough for 2.1. Any help would be appreciated
regaw_leinad said:
Everyone that knows how to use bak/smali, I have a question.
The modifications I made to the extracted pngs aren't getting transferred back to the original apk when I close it back up. Any Ideas? I'm getting really close to a breakthrough for 2.1. Any help would be appreciated
Click to expand...
Click to collapse
hm ill have to check into it. it should be making a new classes.dex too. i never really used it on edits.
Avalaunchmods said:
hm ill have to check into it. it should be making a new classes.dex too. i never really used it on edits.
Click to expand...
Click to collapse
It changes the classes.dex and resigns it it looks like, but doesn't copy the mods of the pngs to the apk.
regaw_leinad said:
Everyone that knows how to use bak/smali, I have a question.
The modifications I made to the extracted pngs aren't getting transferred back to the original apk when I close it back up. Any Ideas? I'm getting really close to a breakthrough for 2.1. Any help would be appreciated
Click to expand...
Click to collapse
What do you mean? Baksmali and Smali are for decompiling classes.dex and opening it up for the .smali files that are inside. Smali takes that output and recompiles it back into classes.dex for your .apk or .jar file.
You need to update the baksmali and smali .jar's. You have older versions and that will cause issues with certain .jar and .apk's when decompiling. baksmali-1.2.1.jar and smali-1.2.1.jar are the latest versions and will not require the BOOTCLASS PATH to be included...
Does the autosign work windows 7 (64 bit)? I've heard issues with other autosigns on 7. If it doesn't, no biggie I got xp in a VM... lol
obannvi said:
What do you mean? Baksmali and Smali are for decompiling classes.dex and opening it up for the .smali files that are inside. Smali takes that output and recompiles it back into classes.dex for your .apk or .jar file.
Click to expand...
Click to collapse
Yeah I get it now, after playing with it for a while.
Avalaunch, you should change the first post.
Baksmali- put in apk in the folder. read readme. edit any icons wallpapers, anything. close it up and enjoy.
Click to expand...
Click to collapse
that description is a little confusing to a person that NEVER used smali/baksmali before. It makes it seem like after you edit the unzipped files, you could just run smali and it will put al the changes in the new apk. I figured out that's not how it works lol I feel pretty stupid now looking back at my last question haha
regaw_leinad said:
Yeah I get it now, after playing with it for a while.
Avalaunch, you should change the first post.
that description is a little confusing to a person that NEVER used smali/baksmali before. It makes it seem like after you edit the unzipped files, you could just run smali and it will put al the changes in the new apk. I figured out that's not how it works lol I feel pretty stupid now looking back at my last question haha
Click to expand...
Click to collapse
What im trying to figure out is why would you even need to use baksmali/smali to edit .png's inside an .apk. All that needs to be done is opening of the .apk with 7zip, modify whats in /res/drawable etc then close...No need to sign .apks or anything. If anything, the script needs to contain something to extract /res/ * from the .apk to edit.
obannvi said:
What im trying to figure out is why would you even need to use baksmali/smali to edit .png's inside an .apk. All that needs to be done is opening of the .apk with 7zip, modify whats in /res/drawable etc then close...No need to sign .apks or anything. If anything, the script needs to contain something to extract /res/ * from the .apk to edit.
Click to expand...
Click to collapse
I'm actually doing more than that. I am changing the code to look for instead of <name of file>.jpg to <name of file>.png
While also putting the new png in the apk. Think that's possible? I changed all of the locations where that file comes up in the smali code.
regaw_leinad said:
I'm actually doing more than that. I am changing the code to look for instead of <name of file>.jpg to <name of file>.png
While also putting the new png in the apk. Think that's possible? I changed all of the locations where that file comes up in the smali code.
Click to expand...
Click to collapse
I gotcha. So you're looking in blah.smali for any reference to .jpgs and changing that reference to look for .png instead??
obannvi said:
I gotcha. So you're looking in blah.smali for any reference to .jpgs and changing that reference to look for .png instead??
Click to expand...
Click to collapse
yeah, not working too well atm, but working on it.
I think this is what I've been looking for. Downloading now.
Just noticed that ActivePerl was for 64bit. I am downloading 32bit as I have only have 32bit Vista Pro installed and not the 64bit.
regaw_leinad said:
Yeah I get it now, after playing with it for a while.
Avalaunch, you should change the first post.
that description is a little confusing to a person that NEVER used smali/baksmali before. It makes it seem like after you edit the unzipped files, you could just run smali and it will put al the changes in the new apk. I figured out that's not how it works lol I feel pretty stupid now looking back at my last question haha
Click to expand...
Click to collapse
i guess i need to explain more. i use baksmali to make apks easier to search through. for me at least. instead of changing the type and everything i just put it in the folder and baksmali then do changes and create a new archive. sign and change .apk. if you smali it back to apk then it wont save edits. sorry about that anyways has this helped people so far? i love showing that windows can be a dev platform
&RoidRage said:
I think this is what I've been looking for. Downloading now.
Just noticed that ActivePerl was for 64bit. I am downloading 32bit as I have only have 32bit Vista Pro installed and not the 64bit.
Click to expand...
Click to collapse
yes just google active perl i use win 7 64bit and when this toolbox was made, it was only made for certain people who had 64bit.
Sorry for the n00b question, but I have searched and haven't had much luck. Hopefully, this is the best place for this question. I just started editing .png's and updating some apk's files to customize some things on my phone for looks. However, I am really interested in modifying the taskbar and notification screen, but I have no clue where to start. Is there a guide somewhere I could follow to learn how to change them? What programs, if any additional ones will I need etc..?
Thanks for your help!
Figured it out on my own. framework.apk and resources.apk
Alright, last week or so, I said I was going to try working on themes and after a few days finally got the whole 9 patch PNG jargon figured out!!! It was a pain in the ass figuring out how it all worked and even after searching i was still unclear.
Software you will need:
Adobe Photoshop or equivalent to edit your PNGs, adjust transparency, add effects)
Android SDK Tools and SDK starter package
Xultimate-d9pc.exe and repsective .zip file (this converts the raw .9.png into a working .9.png)
draw9patch (included in the SDK Tools) *I am working on another way to cut this step out since it is what takes the majority of time*
Java JDK (For Android SDK Tools to work)
Android SDK: Click Me! Android SDK r12 Do all the updates for the tool packages.
Xultimate-d9pc: Click Me!! Extract this into the Android SDK Tools Folder!! VERY IMPORTANT!!!
Java JDK: Click.. for 64 bit Windows Click.. for 32 bit Windows
I have uploaded all of these to my website for your convenience. I don't have the quickest server, so be patient with the downloads!!
Sorry for no audio in the video either. I didn't have a Mic hooked up and figured a video tutorial would be enough. Below is a youtube link and the pasted instructions from the youtube video.
WARNING: the steps below look intimidating, but really are quite easy after you grasp the idea.. I created so many steps to keep the total n00b in mind.
Step 1: Send the .apk that you want to modify from your phone to your email (or transfer your way of choice)
Step 2: copy the .apk somewhere on your harddrive (I put all my android stuff including tools and SDK in an 'android' folder as you will see in the video)
Step 3: open up the .apk in 7zip and navigate to the drawable folder (in this case; res >> drawable-hdpi)
Step 4: highlight all the pngs and .9.png's you would like to modify and copy them to a folder (this is where you will make your edits outside the .apk and compile them at a later time)
Step 5: Open the .9.pngs in photoshop and have some fun! (use your creativity to add overlays, borders, glows, etc.) tip: don't get to complicated, because you will need to pick split/stretch points later for the 9 patch conversion.
Step 6: When done modifying the .9.pngs, just save and overwrite the files you would like (in the case of the MMS app, the same image is used for multiple bubble files)
Step 7: Open up ONLY the .9.png's in the draw9patch tool located in your android SDK tools folder. Add the 9 patch data as shown in the video. Tip: some people only add one middle top and middle left split point/pixel, but i find its usually easier to add TWO points for the top and left quadrant as you will be picking your EXTENTS of where you want the content to be.
Step 8: On the right and bottom quadrant, create a solid line connecting the respective pixels together. These two steps will add the information to the PNG of where to split and stretch from, while also giving constraints of where the content can go.
Step 9: After all the 9 patch images are saved in draw9patch, if you open them you will notice the black pixels you just created. Do NOT, DO NOT try and recompile the .apk at this point, thinking you are done.. the bubbles (in this case) will look like crap, because you are not finished yet.
Step 10: Copy (or move) the newly created .9.png's into the ORIGINALS folder for the xultimate.exe software.
Step 11: Run the xultimate.exe. This will take about 2 seconds or less.
Step 12: naviigate through the 'done' folder and you will notice the .9.PNGs no longer contain the black border pixels!!! CONGRATS!!!
Step 13: Copy all modified images back into the open 7zip .apk archive and overwrite all the existing.
Step 14: replace your current .apk on your phone with this 'new' .apk and enjoy!!
and finally...
Tutorial -couldn't get youtube tags to work.
*If anyone is wondering why I Copied to the REV 2 folder but did the tutorial on the REV 1 folder, I was just demonstrating how to copy the files, but was working on my theme in the Rev 1 folder. DONT BE CONFUSED!!*
Thank you kind sir!
-Sent from my Random Epic.
This could be useful enough to move to Themes and be stickied with dreams tutorial.
Only reason I didn't throw it in those forums yet was that I figured a few people could try it and review the process before it became a 'good' tutorial. I know sometimes a tutorial is easy to understand or works for some people, but others have issues or don't understand the directions as well.
I hope this works for everyone and people are less intimidated to mess with this type of stuff!!
Relating to my other thread, I will continue to work on the MMS and Swype theming, I just wanted to get this together so everyone can start theming!
Wow, this looks very "easy"
Maybe I'll finally be able to edit .9.pngs without help
/sig
Avelnan said:
Phones are going to come to life someday. Take note: LG Optimus line. ASUS Transformer. And now the Nexus Prime.
Click to expand...
Click to collapse
Why not just use apk manager to decompile, edit the .9.png's leaving the black outer border pixels alone, then recompile the apk, extract the modded png's, then copy them into the source apk?
shane6374 said:
Why not just use apk manager to decompile, edit the .9.png's leaving the black outer border pixels alone, then recompile the apk, extract the modded png's, then copy them into the source apk?
Click to expand...
Click to collapse
That's fine in some instances, but it wouldn't really allow you to create .9pngs that are of a different size....
Also...I would think editing them in say GIMP only would "corrupt" the draw9patch data? It seems to me that it's more than just having a few pixels as borders and guidlines, it's also the files data in relation to those pixels
Sent from my SPH-D700 using xda premium
squshy 7 said:
That's fine in some instances, but it wouldn't really allow you to create .9pngs that are of a different size....
Also...I would think editing them in say GIMP only would "corrupt" the draw9patch data? It seems to me that it's more than just having a few pixels as borders and guidlines, it's also the files data in relation to those pixels
Sent from my SPH-D700 using xda premium
Click to expand...
Click to collapse
Editing with gimp wouldn't and doesn't corrupt the image from what I know. That's why your able to compile the image after editing it with gimp without error.
Sent from my SPH-D700
ac16313 said:
Editing with gimp wouldn't and doesn't corrupt the image from what I know. That's why your able to compile the image after editing it with gimp without error.
Sent from my SPH-D700
Click to expand...
Click to collapse
Exactly. What I do is cut all but the 1 pixel border into a new layer, edit that layer, merge the layers and save. I understand the concept the op is stating, but all of this can be done with the method I said as well. If you want to completely change, or add png's you will need to also make xml edits to add the image there or change container sizes, which is done by decompiling with apk manager. The only thing you might have to do is run the images throught the draw9 tool, but in most cases you wouldn't even need to do that.
Sent from shane6374's Epic via Tapatalk
also, if you see the black bars, you are dealing with a previously edited rom/apk. when you build from leaks or official google aosp releases you dont have that. very nice work mr. socks
I have a question. How do you create a new 9.png to use, for example with miui lockscreen. I dont really get that. Do I have to create the 9.png as the same as the original 9.png on the lockscreen. just wondering. Any help would be appreciated
thank you
cowsquad said:
I have a question. How do you create a new 9.png to use, for example with miui lockscreen. I dont really get that. Do I have to create the 9.png as the same as the original 9.png on the lockscreen. just wondering. Any help would be appreciated
thank you
Click to expand...
Click to collapse
It really depends on what image it is and what you want it to do. Some aspects that you might think are controlled by an image might actually be controlled by a xml file.
shane6374 said:
It really depends on what image it is and what you want it to do. Some aspects that you might think are controlled by an image might actually be controlled by a xml file.
Click to expand...
Click to collapse
Is there a way to find what aspects are controlled by a xml file.
Sent from my Droid using Tapatalk
cowsquad said:
Is there a way to find what aspects are controlled by a xml file.
Sent from my Droid using Tapatalk
Click to expand...
Click to collapse
Sure, you can take the name of the image and search for it in the xml files. Very easy to do with windows explorer. I use it to fine images and color codes all the time. If you know how to read the xml file you can see how it all works.
I don't know what file you're wanting to edit, but that might help. I'd throw up some resources I've used for you but I'm at work right now.
shane6374 said:
Sure, you can take the name of the image and search for it in the xml files. Very easy to do with windows explorer. I use it to fine images and color codes all the time. If you know how to read the xml file you can see how it all works.
I don't know what file you're wanting to edit, but that might help. I'd throw up some resources I've used for you but I'm at work right now.
Click to expand...
Click to collapse
Whenever you have time, could you email me those resources. That will be appreciated. Pm and I send you my email
Sent from my Droid using Tapatalk
cowsquad said:
Whenever you have time, could you email me those resources. That will be appreciated. Pm and I send you my email
Sent from my Droid using Tapatalk
Click to expand...
Click to collapse
Start with this one here. If you have sdk and draw9patch in the tools folder, you can use this to help guide you. There was one other site I found when I was starting out themeing, but I'm not finding it right now.
http://developer.android.com/guide/developing/tools/draw9patch.html
i tried to run the ultimate.exe but i get an error, my ant/res doesnt exit. how do i fix that
cowsquad said:
i tried to run the ultimate.exe but i get an error, my ant/res doesnt exit. how do i fix that
Click to expand...
Click to collapse
I don't even know what that is. Do you have sdk installed?
Sent from shane6374's Epic via Tapatalk
shane6374 said:
I don't even know what that is. Do you have sdk installed?
Sent from shane6374's Epic via Tapatalk
Click to expand...
Click to collapse
Yes, I do. I have sdk, eclipse and java set up already. I'm gonna reinstall everything now and see the results.
Hi Folks,
Overview
There is a mechanism in Android to override the resources and resource-id values within the framework-res.apk with "Vendor" Specified values. All of this is done transparently at runtime and leaves the original framework-res.apk intact and on the device.
CAUTION - ALWAYS HAVE A BACKUP HANDY. NORMAL OPERATION SHOULD BE FINE BUT WHILE PLAYING AROUND AND SEEING WHAT WAS POSSIBLE THE DEVICE DID CLEAR THE ACCOUNTS DATABASE A COUPLE OF TIMES
Background
While doing some research into how the resources.arsc file are handled internally on Android I came across a Document in the AOSP sources ( frameworks/native/libs/utils/README )
Along with a general overview of resource management, it contained a couple of interesting sections.
The resource overlay extension
------------------------------
The resource overlay mechanism aims to (partly) shadow and extend
existing resources with new values for defined and new configurations.
Technically, this is achieved by adding resource-only packages (called
overlay packages) to existing resource namespaces
...
The use of overlay resources is completely transparent to
applications; no additional resource identifiers are introduced, only
configuration/value pairs. Any number of overlay packages may be loaded
at a time; overlay packages are agnostic to what they target -- both
system and application resources are fair game.
The package targeted by an overlay package is called the target or
original package.
Resource overlay operates on symbolic resources names. Hence, to
override the string/str1 resources in a package, the overlay package
would include a resource also named string/str1. The end user does not
have to worry about the numeric resources IDs assigned by aapt, as this
is resolved automatically by the system.
As of this writing, the use of resource overlay has not been fully
explored. Until it has, only OEMs are trusted to use resource overlay.
For this reason, overlay packages must reside in /system/overlay.
Click to expand...
Click to collapse
What this essentially means is you can create a resource only apk which you place at /vendor/overlay/framework/framework-res.apk.
This file only needs to contain the resources you want to override, the document goes on to explain how the idmap is created in the resources-cache
Note the path is different from the readme file which suggests using /system/overlay, this is not referenced by the source and will do nothing.
Resource ID mapping
~~~~~~~~~~~~~~~~~~~
Resource identifiers must be coherent within the same namespace (i.e
PackageGroup in ResourceTypes.cpp). Calling applications will refer to
resources using the IDs defined in the original package, but there is no
guarantee aapt has assigned the same ID to the corresponding resource in
an overlay package. To translate between the two, a resource ID mapping
{original ID -> overlay ID} is created during package installation
(PackageManagerService.java) and used during resource lookup. The
mapping is stored in /data/resource-cache, with a @idmap file name
suffix.
The idmap file format is documented in a separate section, below.
Creating overlay packages
-------------------------
Overlay packages should contain no code, define (some) resources with
the same type and name as in the original package, and be compiled with
the -o flag passed to aapt.
The aapt -o flag instructs aapt to create an overlay package.
Technically, this means the package will be assigned package id 0x00.
There are no restrictions on overlay packages names, though the naming
convention <original.package.name>.overlay.<name> is recommended.
Example overlay package
~~~~~~~~~~~~~~~~~~~~~~~
To overlay the resource bool/b in package com.foo.bar, to be applied
when the display is in landscape mode, create a new package with
no source code and a single .xml file under res/values-land, with
an entry for bool/b. Compile with aapt -o and place the results in
/system/overlay by adding the following to Android.mk:
LOCAL_AAPT_FLAGS := -o com.foo.bar
LOCAL_MODULE_PATH := $(TARGET_OUT)/overlay
Click to expand...
Click to collapse
All this may sound very familiar to those who have built any AOSP Rom for a device as it is the same concept as the overlay tree which is contained in the device specified directories of the tree. Only this method executes at runtime instead of compile time. There are other differences. Mainly the runtime version only handles the drawables and resources which are included in the resources.arsc of framework-res ( at the moment ) where as the device overlay will handle any file you throw at it. You cannot unfortunately update compressed resources ( i.e the ones in the xml, raw, menu etc ).
The AOSP Tree also contained a test directory for this functionality . /frameworks/base/core/tests/overlaytests and contain an example implementation in the OverlayTestOverlay directory and a runtests.sh shell scripts which highlights that symlinking packages with custom names to framework-res is valid.
Summary
I think this will help modders out and has benefits over the currently widely used method of pulling a devices full framework-res and using apktool to unpack, making the changes and then repacking and resigning ( or using 7z replace, if you're lazy like me ) It will also help with applying/merging multiple mods from different sources as the files only need the include the very basic of the patch.
I don't know how long this functionality has existed but I have never seen it used by any oem and a search of Xda Didn't seem to show any "prior art" of the behaviour. I'd be interested on people thoughts on this, especially if you have seen a rom in the wild that uses it. It's maybe something that could be extended by "us" if google don't have any major plans for it possibly applied to other apks.
KNOWN ISSUES AND WORKAROUNDS
There is a bug in the /frameworks/base/libs/androidfw/AssetManager.cpp. It appears that a umask is set incorrectly when creating the idmap file from the overlay package, as such only the system user had access to it resulting in a failure to apply the overlayed values.
I chmod'd 666 /data/resource-cache/* and reboot to fix this. You can find further details in this google groups post. There is a patch attached the Post which I don't think will apply correctly as the source tree has been Refactored since the patch was created.
See below a workaround
Well this is fascinating. I am going to read the files this afternoon .
That is quite a cool find. Thanks for the tip.
Trevd, I gotta try this. I finally had time to read it carefully. I am going to make a simple one tomorrow. Have you had time to give it a whirl?
Oh, the Google groups link is wrong, I think. It only took me to the Google groups home page.
mateorod said:
Trevd, I gotta try this. I finally had time to read it carefully. I am going to make a simple one tomorrow. Have you had time to give it a whirl?
Oh, the Google groups link is wrong, I think. It only took me to the Google groups home page.
Click to expand...
Click to collapse
Fixed That google link for you, I'll attach some examples and try and put together some more resources on this. I'm going to test it on a couple of different devices. I can however confirm that the functionality is in the ICS code tree and I'm give it a test on CM9 on my HTC Sensations to make sure it functions as expected
Hello Again.
I've done something further research into "weaponizing" this mod so it can be used in anger. The Incorrect Permission Issue highlighted in the first post is pretty much a show-stopper if you want to use this in a flashable zip update for example.
Problem: The idmap is successfully created but cannot be used as the file the world readable file permission is not set.
Solution 1: Patch the AssetManager to create the file with the correct permissions.
This would work but results in the extra overhead of changing core android libraries and would more than likely break Stock OTA Updates because the file hashes won't match.
Solution 1a: Patch the AssetManager to create the file with the correct permissions, Submit the patch to the AOSP project so it is upstream for future releases.
The Patch in the google groups post does not seem to have been submitted as the issue is still there in the latest master branch ( 4.2.1 ) of the AOSP Project. I held off submitting it myself because it is basically someone else's work, However if no-one else is going to do it I suppose someone should . Obviously this solution is still dependent on google actually accepting the patch, carriers including it future roms and numerous other unknown factors which are out of your direct control.
Solution 2: Add a empty idmap in /data/resource-cache folder with the correct permission at the same time as adding the custom overlay.
Although a work around this does solve the issue. This is not as simple as just creating a placeholder zero byte file. The asset manager will reject the file when checking for stale cache files at startup. We need to actually create an empty idmap. Referring back to the original readme file (/frameworks/native/libs/utils/README), google explain the idmap file format
The ID map (idmap) file format
------------------------------
The idmap format is designed for lookup performance. However, leading
and trailing undefined overlay values are discarded to reduce the memory
footprint.
idmap grammar
~~~~~~~~~~~~~
All atoms (names in square brackets) are uint32_t integers. The
idmap-magic constant spells "idmp" in ASCII. Offsets are given relative
to the data_header, not to the beginning of the file.
map := header data
header := idmap-magic <crc32-original-pkg> <crc32-overlay-pkg>
idmap-magic := <0x706d6469>
data := data_header type_block+
data_header := <m> header_block{m}
header_block := <0> | <type_block_offset>
type_block := <n> <id_offset> entry{n}
entry := <resource_id_in_target_package>
Click to expand...
Click to collapse
They also go on to give an example.
idmap example
~~~~~~~~~~~~~
Given a pair of target and overlay packages with CRC sums 0x216a8fe2
and 0x6b9beaec, each defining the following resources
....
the corresponding resource map is
0x706d6469 0x216a8fe2 0x6b9beaec 0x00000003 \
0x00000004 0x00000000 0x00000009 0x00000003 \
0x00000001 0x7f010000 0x00000000 0x7f010001 \
0x00000001 0x00000000 0x7f020000
or, formatted differently
0x706d6469 # magic: all idmap files begin with this constant
0x216a8fe2 # CRC32 of the resources.arsc file in the original package
0x6b9beaec # CRC32 of the resources.arsc file in the overlay package
0x00000003 # header; three types (string, bool, integer) in the target package
0x00000004 # header_block for type 0 (string) is located at offset 4
0x00000000 # no bool type exists in overlay package -> no header_block
0x00000009 # header_block for type 2 (integer) is located at offset 9
Click to expand...
Click to collapse
Further analysis of the asset manager code suggests that although aapt won't create an empty overlay apk it is possible create an idmap file which just contains the file magic along with the original and overlay resources.arsc CRC32 which can be set at zero. Assuming little endian byte ording, these are those magic twelve bytes you need in the /data/resource-cache/[email protected]@[email protected]@idmap
Code:
69 64 6d 70 00 00 00 00 00 00 00 00
The file value will then be updated rather than created when a new overlay apk is provided.
[ EXAMPLES TO FOLLOW ]
So I don't know if anyone has done any follow-up with this, but we have a situation with the Xperia V (and T, more or less the same device in many respects) that makes it impossible to flash or push a modified framework-res.apk. Specifically, the resource-id's inside resources.arsc (public.xml) are getting mangled during recompile and while apktool doesn't show any errors (this is a known, reported issue), the apk is unusable and causes bootloops.
What you've presented here seems like a light at the end of the tunnel. But while I'm confident in my ability to follow directions, I'm afraid I'm too much of a noob to foresee possible reasons for this not working, which is basically what I'm requesting feedback on. Here's what I have in mind, please feel free to point out the holes in my plan...
1. Create the overlay, with the config.xml containing the proper resource-id's as found in public-xml.
2. Push the overlay. It seems to me that with an unmodified framework-res.apk in place, the overlay will simply replace the values from resources.arsc with identical values, thereby having no effect on the system. Any problems at this stage, then, would be from errors on my part, and naturally I would rather weed them out before the next step...
3. Push a modded framework-res.apk and hope that with the overlay in place and doing its business, the corrupted resource-id's will be quarantined and unable to wreak havoc on the system.
It sounds easy, so I'm sure I've missed something. I appreciate any feedback, scathing or otherwise.
shockwaverider said:
So I don't know if anyone has done any follow-up with this, but we have a situation with the Xperia V (and T, more or less the same device in many respects) that makes it impossible to flash or push a modified framework-res.apk. Specifically, the resource-id's inside resources.arsc (public.xml) are getting mangled during recompile and while apktool doesn't show any errors (this is a known, reported issue), the apk is unusable and causes bootloops.
What you've presented here seems like a light at the end of the tunnel. But while I'm confident in my ability to follow directions, I'm afraid I'm too much of a noob to foresee possible reasons for this not working, which is basically what I'm requesting feedback on. Here's what I have in mind, please feel free to point out the holes in my plan...
1. Create the overlay, with the config.xml containing the proper resource-id's as found in public-xml.
2. Push the overlay. It seems to me that with an unmodified framework-res.apk in place, the overlay will simply replace the values from resources.arsc with identical values, thereby having no effect on the system. Any problems at this stage, then, would be from errors on my part, and naturally I would rather weed them out before the next step...
3. Push a modded framework-res.apk and hope that with the overlay in place and doing its business, the corrupted resource-id's will be quarantined and unable to wreak havoc on the system.
It sounds easy, so I'm sure I've missed something. I appreciate any feedback, scathing or otherwise.
Click to expand...
Click to collapse
Hi There.
It's sound's plausible. I will say that I was attempting to implement this "trick" on a Samsung Galaxy Note 10.1 which had a TouchWiz Rom installed without any luck. In that case it wasn't retaining the correct permissions for the resource-cache directory. I didn't go as far as patching the init binary... yet!!! I think that will probably sort it out with if you have control of the device so there is still hope on that one.
I've also not tested it with anything other than settings found in the config.xml I suppose if it gets compiled into the resources.arsc it should be alright.
Have you tried recompiling the using aapt instead? I'm afraid I'm no expert on aapt and it's many switches so I'm afraid you're are on your own as far a making the apk goes if you are trying this outside of the AOSP source tree!
Good Luck
trevd said:
Hi There.
It's sound's plausible. I will say that I was attempting to implement this "trick" on a Samsung Galaxy Note 10.1 which had a TouchWiz Rom installed without any luck. In that case it wasn't retaining the correct permissions for the resource-cache directory. I didn't go as far as patching the init binary... yet!!! I think that will probably sort it out with if you have control of the device so there is still hope on that one.
I've also not tested it with anything other than settings found in the config.xml I suppose if it gets compiled into the resources.arsc it should be alright.
Have you tried recompiling the using aapt instead? I'm afraid I'm no expert on aapt and it's many switches so I'm afraid you're are on your own as far a making the apk goes if you are trying this outside of the AOSP source tree!
Good Luck
Click to expand...
Click to collapse
Thanks for the input! I haven't tried compiling using aapt, I'm afraid that I'm working way beyond my abilities here due to a mix of frustration and determination. I ended up here after somebody pointed to barrykr's thread HERE, so I suppose the first thing to do is try out his method and see what comes of it. If it's not successful, then I'll try to sort through all the big words and smart-people talk and figure out how to get it to work.
Hey mate... just noticed this thread of yours. This is awesome... I wonder why it didn't draw more attention.
Anyway... you've probably seen my mods thread over at Rootzwiki, right? I was wondering if this "overlay" thing would actually work for SystemUI too?
shockwaverider said:
So I don't know if anyone has done any follow-up with this, but we have a situation with the Xperia V (and T, more or less the same device in many respects) that makes it impossible to flash or push a modified framework-res.apk. Specifically, the resource-id's inside resources.arsc (public.xml) are getting mangled during recompile and while apktool doesn't show any errors (this is a known, reported issue), the apk is unusable and causes bootloops.
[...]
Click to expand...
Click to collapse
Hi there! Just wanted to let you know that I have successfully made an overlay.apk which overrides the framework-res.apk default 'settings'. I have a Xperia S with the same problem with framework-res.apk. For my example I used the showNavigationBar boolean value and edited it, and the navigation bar showed after boot :victory: :victory:
@trevd I have not time to test this now, but do you know if it is possible to make an overlay.apk, only with images instead of the resource file? Thanks, I'm quite exited now
edit. Yes it is possible with images. ****. I'm in heaven right now. Everything will be soooo much easier.
skifyr123 said:
Hi there! Just wanted to let you know that I have successfully made an overlay.apk which overrides the framework-res.apk default 'settings'. I have a Xperia S with the same problem with framework-res.apk. For my example I used the showNavigationBar boolean value and edited it, and the navigation bar showed after boot :victory: :victory:
@trevd I have not time to test this now, but do you know if it is possible to make an overlay.apk, only with images instead of the resource file? Thanks, I'm quite exited now
Click to expand...
Click to collapse
@skifyr123 That's a pleasant surprise, I was under the belief that it had stopped working... maybe I was doing my own mod wrong ..
The example in the aosp includes images. http://androidxref.com/4.2_r1/xref/...ytests/OverlayTestOverlay/res/drawable-nodpi/ . I don't know whether you can exclude resources, however that shouldn't be an issue as you can "override" a resource that doesn't exist so won't effect anything. I suspect you probably can excluded them...... as we say in the trade "Try it yourself"
@Kookie_Monster : No , I'm fairly certain that it won't the code only handles framework-res... however there a comment in the code that is quite interesting http://androidxref.com/4.2_r1/xref/frameworks/base/libs/androidfw/AssetManager.cpp#198 Line 198. "apps are handled by the Java Package Manager", I'll have to look deeper into that one
Images worked Do you know if this is any different from Xposed engine (http://forum.xda-developers.com/showthread.php?t=1574401).. At least in this you don't have to install anything extra.
skifyr123 said:
Images worked Do you know if this is any different from Xposed engine (http://forum.xda-developers.com/showthread.php?t=1574401).. At least in this you don't have to install anything extra.
Click to expand...
Click to collapse
Hi
I keep hearing things about the Xposed engine, It's looks a very cool project although not something I'd ever use.
Yes this is completely different It's part of Android core platform source code and is implemented by the asset manager http://androidxref.com/4.2_r1/xref/frameworks/base/libs/androidfw/AssetManager.cpp I believe it's been in there since day 1 ( or close enough ). The main difference is Xposed will let you code where as this is limit to certain types of resources.
I'm GUESSING that this was the original method for vendor overlays but possibly not picked up by HTC ( and others ) in Android's early days so the Idea was abandoned, the way the README in the AOSP reads it was fully intended to extend much more than the framework-res. With all that in mind I also wouldn't be surprised if it suddenly disappeared one day because there's no oem's ( that I know of ) using it
skifyr123 said:
Hi there! Just wanted to let you know that I have successfully made an overlay.apk which overrides the framework-res.apk default 'settings'. I have a Xperia S with the same problem with framework-res.apk. For my example I used the showNavigationBar boolean value and edited it, and the navigation bar showed after boot :victory: :victory:
@trevd I have not time to test this now, but do you know if it is possible to make an overlay.apk, only with images instead of the resource file? Thanks, I'm quite exited now
edit. Yes it is possible with images. ****. I'm in heaven right now. Everything will be soooo much easier.
Click to expand...
Click to collapse
You, sir, are my hero!! :good: :good: :good:
Thank You.
trevd said:
Hi Folks,
Overview
There is a mechanism in Android to override the resources and resource-id values within the framework-res.apk with "Vendor" Specified values. All of this is done transparently at runtime and leaves the original framework-res.apk intact and on the device.
CAUTION - ALWAYS HAVE A BACKUP HANDY. NORMAL OPERATION SHOULD BE FINE BUT WHILE PLAYING AROUND AND SEEING WHAT WAS POSSIBLE THE DEVICE DID CLEAR THE ACCOUNTS DATABASE A COUPLE OF TIMES
Background
While doing some research into how the resources.arsc file are handled internally on Android I came across a Document in the AOSP sources ( frameworks/native/libs/utils/README )
Along with a general overview of resource management, it contained a couple of interesting sections.
What this essentially means is you can create a resource only apk which you place at /vendor/overlay/framework/framework-res.apk.
This file only needs to contain the resources you want to override, the document goes on to explain how the idmap is created in the resources-cache
Note the path is different from the readme file which suggests using /system/overlay, this is not referenced by the source and will do nothing.
All this may sound very familiar to those who have built any AOSP Rom for a device as it is the same concept as the overlay tree which is contained in the device specified directories of the tree. Only this method executes at runtime instead of compile time. There are other differences. Mainly the runtime version only handles the drawables and resources which are included in the resources.arsc of framework-res ( at the moment ) where as the device overlay will handle any file you throw at it. You cannot unfortunately update compressed resources ( i.e the ones in the xml, raw, menu etc ).
The AOSP Tree also contained a test directory for this functionality . /frameworks/base/core/tests/overlaytests and contain an example implementation in the OverlayTestOverlay directory and a runtests.sh shell scripts which highlights that symlinking packages with custom names to framework-res is valid.
Summary
I think this will help modders out and has benefits over the currently widely used method of pulling a devices full framework-res and using apktool to unpack, making the changes and then repacking and resigning ( or using 7z replace, if you're lazy like me ) It will also help with applying/merging multiple mods from different sources as the files only need the include the very basic of the patch.
I don't know how long this functionality has existed but I have never seen it used by any oem and a search of Xda Didn't seem to show any "prior art" of the behaviour. I'd be interested on people thoughts on this, especially if you have seen a rom in the wild that uses it. It's maybe something that could be extended by "us" if google don't have any major plans for it possibly applied to other apks.
KNOWN ISSUES AND WORKAROUNDS
There is a bug in the /frameworks/base/libs/androidfw/AssetManager.cpp. It appears that a umask is set incorrectly when creating the idmap file from the overlay package, as such only the system user had access to it resulting in a failure to apply the overlayed values.
I chmod'd 666 /data/resource-cache/* and reboot to fix this. You can find further details in this google groups post. There is a patch attached the Post which I don't think will apply correctly as the source tree has been Refactored since the patch was created.
See below a workaround
Click to expand...
Click to collapse
is't possible to use vendor overlay to add/ change a value in build.prop file ?
Can someone solve this? I tried to make an overlays to my rom by placing the overlays to /system/vendor/overlays. It works. But when I try to changing to other themes, my overlays gone, I tried to reapply stock theme but didn't worked. Must I try another folder like /system/overlays?
Here is a method for editing xml files directly on from your phone (as well as a fully functional Eclipse compatible IDE). I'm going to sleep so I'll post a reply I made in another thread first, and clean up in the morning. Have fun..G'night!
-------------------------------------------------------------------------------------------
Quote:
Originally Posted by Toni5830
You can extract xml but you can't see them (only strange symbols) and you can't edit them from phone.. you must use PC and decompile them.. no other possibility
Inviato con Tapatalk 2 dal telefono di casa
-------------------------------------------------------------------------------------------
No, you can edit them on your phone. Axel is one of the apps to use. The second is an IDE called AIDE which is compatible with Eclipse. You can develop, program and publish complete apps from your phone. I figured out how to edit compiled xml the other day. Ninjamorph is also useful because it unpacks the archives into a project which happens to be near where your AIDE projects are.
Begin by opening ninjamorph and choosing the apk to work on and create a project (can do this manually but keep a back up of the apk). Next, open AIDE and create a new project. As an example I'll be editing the lg_allapps_button_text.xml file in LGHome.apk (LG's launcher on G2, so files may differ for you). Choose the HelloWorld setup as that's the less,cluttered one. After creating the project, open up a file manager (you can do this from within AIDE as well) and create the same directory structure for your xml file (probably doesn't matter if a ../res/color xml file is in ../main..but it's good practice. The xml I'm editing is in /res/color, so I'll go into the project directory and create a ../res/color folder.
Now open Axel up and find the xml in the ninjamorph project that you are editing. Again in my case it'll be in /res/color. Go ahead and open it with Axel. Don't bother editing it here, we're going to just go into settings and "save as" (into our AIDE project directory) ../res/color/lg_allapps_button_text.xml. This adds it into our AIDE project and we can now go back into AIDE. In the oberflow action, choose "Goto Files" or whatever it's named (also an icon at the top for this action). It'll open a pane at the bottom with your project files. At this time you'll probably notice AIDE throwing a lot of errors (errors in your code, not app errors lol).
We have to fix every one of them before finish, so might as well start now before editing. Conversely, you could do this in Axel first once you know what kind of errors to expect and fix. In my case, I see two errors because the file is really small. Once clicking on the xml I want to edit in the files pane, I can see that it's telling me string values aren't allowed in the "color' attribute. The color is black but when Axel decompiled it, it changed it from it's ARGB form. I see this -
Code:
#xml namespace blah blah...
.....
....... android:color="1F000008/0xFF000000"
Of course there is more, I just highlighted the attribute I need to fix. You're going to need to learn how attributes need to be formatted or learn and keep a reference handy. Google has nice guides online for building android apps. In this case we change it to:
Code:
...
.... android:color="#FF000000"
Technically yes it's still a string, and yes the wrong format was hexadecimal (sort of), but now we have one less error. On large xmls, this gets annoying but you'll get fast at it. So, I've fixed,myerrors, so now for simplicity I'll just change the color on one of the attributes..to red ("#FFFF0000"). Now that edits are done and errors done, go back in the ooverflow action and scro,down and either click "Run" or "More" and then "Rebuild Project". We aren't worried about any other file, we just want our xml recompiled. Once it's done, if you want you can install your fancy Hello World app (or Tetris game app), lol but it's just as well if you choose not to.
Next, go back into your file manager and find your way back into your AIDE project directory. Locate the bin folder (where your compiled project will be) and navigate to your xml. Again, in my case, I'll be going to /res/color. Make sure you find the compiled version (the binary one with all the cool symbols). Copy this back into the same structure inside the ninjamorph project folder. If you aren't using ninjamorph and manually doing this then make sure you have a backup apk handy and akip the ninjamorph stuff.
Opem Ninjamorph back up and choose to complete your project. Once it's done repackaging it'll ask you if you want to resign the apk
Follow Steven's directions and dont sign it if its a system apk. Next he'll ask about zipaligning (i think?). I don't choose this option at all. If my mods work, then I'll redo the project and choose that option. Problem is, sometimes it can cause issues and you don't want to add more variables in until you know that all,is working or you'll be asking yourself "wonder if my edits were bad,or the zipalignment".
Ninjamorph will create a backup of the apk for you, and now you'll be given the option of installing the apk. You should know what you're doing already but...if using TWRP you can go ahead and replace the modded apk and reboot. Worst that'll happen is boot loops or force closes and you can manually go into recovery and use TWRP's file manager to copy your backup back (may need to mount /system first, and may need to chmod as well. Then try again. If you boot up and all is well, congrats! If using CWM, make sure you have a recovery plan before making the switch.
I have no clue if,there's any easier way. I'm still working on it. Granted, kf you're just going to edit a color like in my example it'd be MUCH easier just using a hex editor. AIDE is a pretty damn slick app as it also supports native mode C/C++ for developing codecs, drivers,,etc. For $8 you can purchase full version with support for larger projects and github and a few other things.
This method should work on any device that can run all those apps. I'm using a LG G2. I'm not the,developer of any of tbose apps so don't come to me if they aren't working: )
Reserved
MidnightHarvester said:
Reserved
Click to expand...
Click to collapse
Thanks sir really appreciated your work
Also please continue to post apk editing posts
A very simple guide on removing the disgusting shadow effect on the homescreen, plus changing the icons in the navbar.
EDIT: Useless guide. Every change can be made using themes. Coming from a N5 confuses me too much. Thanks @vobiscum
Since usually we would make this changes in xposed, and since xposed is not aviable (for now, I hope), we need to change some png images in the SystemUi.apk container located in #/system/priv-app/systemui folder.
This is just one way to achieve our goal, I made it supereasy for beginners.
Attention: don't extract and compress again any system apks with 7zip or similar programs: it will result in a bootloop. Just replace the needed images directly in the container. If you need to do something else, google APK-Tool.
1)Get a root explorer from googleplay. I'm using FX File Manager (it needs a plugin for root privileges);
2)Go to #/system/priv-app/systemui folder and copy systemui.apk;
3)Paste it in a pc-redeable partition or in the external sd;
4)Get the file and extract it with 7zip or winrar. Don't delete the systemui.apk imported.
5)Navigate in the excracted folder and get the files you want.
---Gradients are located in res/drawable-xxhdpi-v4, their names are: nav_background.9.png and status_background.9.png.
---Navbar Icons are located in res/drawable-xxhdpi-v4 and drawable-ldrtl-xxhdpi-v4.
6)Open the files with Photoshop or Gimp and edit them on your taste. Want a ghost navbar? Do it.
7) Drag and drop the modified files in the Systemui.apk according to their original locations;
8)Put the modified file on your sd/phone;
9)IMPORTANT: DO A BACKUP VIA TWRP
10)Copy-paste via root-explorer the SystemUi.apk back in place. It may be requested to remount the folder in r/w.
11) DONE! If you get some lag/problems, just reboot. If it bootloops, go for twrp.
nice work there, some genuinely earned thanks :good:
it will result in a bootloop
Click to expand...
Click to collapse
i guess this is to do with the odexed apk's..?
sminki said:
i guess this is to do with the odexed apk's..?
Click to expand...
Click to collapse
I think that is to do with zipaligning, but don't ask me further, I'm pretty noob about this. I know that many apks works well even after they are recompiled as a zip; but some resources need a particular procedure. This way avoids any problem due to recompiling.
For editing xml, I generally use APKtool and replace the original META-INF folder and AndroidManifest.xml, this is the proper way to recompile it (http://forum.xda-developers.com/showthread.php?t=2203166).
Smokehrbar88 said:
I think that is to do with zipaligning, but don't ask me further, I'm pretty noob about this. I know that many apks works well even after they are recompiled as a zip; but some resources need a particular procedure. This way avoids any problem due to recompiling.
For editing xml, I generally use APKtool and replace the original META-INF folder and AndroidManifest.xml, this is the proper way to recompile it (http://forum.xda-developers.com/showthread.php?t=2203166).
Click to expand...
Click to collapse
Man made a theme is too easy no need root
https://plus.google.com/+MassimoBotta/posts/27CAAv91Lth
vobiscum said:
Man made a theme is too easy no need root
https://plus.google.com/+MassimoBotta/posts/27CAAv91Lth
Click to expand...
Click to collapse
So you can change navbar icons with a theme? Well, damn me. Damn Haweii. How about other pngs in SystemUi.apk (for example the gradient?)
Not useless, and to be honest, I prefer getting my hands dirty pulling things apart rather than relying on other people, gives you a better understanding of how things work