[Q] Launcher Theme, APK Tool, and Signing - LG Optimus 3D

So I'm trying to learn how to create a launcher theme that works with P920/925 etc.
I took an existing theme, decompiled/decoded it, modded the drawables in an image editor, and rebuilt the apk with APK Tool.
It won't install or the launcher doesn't see it if I push it (actually the theme I modded was found in the 'uninstallable' folder of apk files, in the android system folder).
So will it not install because it's not signed? I've tried building as debug, but that doesn't work either.
Do I really, really have to go through the trouble of installing a unix/linux environment (i.e. Cygwin, etc) to sign it just for testing, or my own use?
I'd rather have something closer to final before I do all that...but maybe its just a necessary thing?
Or perhaps I should be doing this in Eclipse?
Thanks!

drastic00 said:
So I'm trying to learn how to create a launcher theme that works with P920/925 etc.
I took an existing theme, decompiled/decoded it, modded the drawables in an image editor, and rebuilt the apk with APK Tool.
It won't install or the launcher doesn't see it if I push it (actually the theme I modded was found in the 'uninstallable' folder of apk files, in the android system folder).
So will it not install because it's not signed? I've tried building as debug, but that doesn't work either.
Do I really, really have to go through the trouble of installing a unix/linux environment (i.e. Cygwin, etc) to sign it just for testing, or my own use?
I'd rather have something closer to final before I do all that...but maybe its just a necessary thing?
Or perhaps I should be doing this in Eclipse?
Thanks!
Click to expand...
Click to collapse
If I'm correct the themes are in the system folder and not have to be signed because is a system app.

Hmm. I'll look more into that. All I know is the one I decoded installs. The same one after modding doesn't. I did change color mode on a few images from indexed to RGB. Maybe it doesn't allow that without changing the code.

Related

[Q] Advice on motoblur

hello guys
through sbfrecalc I managed to open a original ROM 2.1 of droidx
I would like to try different type apk on my milestone: blurhome, blur service, blurcalendar, blurupdater etc etc..With rootexplorer installing them, after write me "apk not installed"
is a test without success, or do I have to change any library?
any advice is welcome!
thanks
any ideas?
1. do a test-key sign of apk.
2. copy appropiate jar files associated with apk
3. copy the libs needed
4. make sure framework support the blur functionality
5. update init.rc to load the required jar files at the end.
you're up for a little challenge. My mod of Motoblur is the closest you get to using it.
Dexter_nlb said:
1. do a test-key sign of apk.
2. copy appropiate jar files associated with apk
3. copy the libs needed
4. make sure framework support the blur functionality
5. update init.rc to load the required jar files at the end.
you're up for a little challenge. My mod of Motoblur is the closest you get to using it.
Click to expand...
Click to collapse
thank's dexter!
your motoblur its base froyo, but my idea was to prove eclair, and how do I know which are the correct libraries?
at your 5 answer im not sure to understand!
thanks for the reply and thanks for your work!

[How To] Basic Themeing

This is a very basic guide to beginning themeing. It is not meant to be all-inclusive, just some simple steps that can be taken to make your own custom theme fairly easily. This guide should allow anyone to be able to grab images they like from any ROM and incorporate them into their own.
I SUGGEST YOU ALWAYS MAKE A BACKUP OF ANY FILE BEFORE YOU THEME IT AND NANDROID FIRST BEFORE FLASHING
Here is a basic overview of changing images in an apk:
1. Get your base file to theme – framework-res.apk, com.htc.resources.apk, phone.apk ect.
2. “Open” apk archive with 7-zip (don’t unzip!) and drag and drop the new images into the appropriate folder.
3. Flash new file.
Now some details:
1. The first step is to obtain the file you are going to theme. The file you are themeing ( i.e. going to flash to your phone) must come from the ROM you are currently running. Always use files from your current ROM as a base, however the images you want to change can come from other ROMs, or you can edit existing ones or make your own from scratch. You can obtain your theme base through an ADB pull of the files from your phone, or simply downloading the ROM zip file and extracting the files you need.
2. Now that you have the file to theme, don’t touch it! OK, more specifically, you won’t unzip or do anything to this file except “open” it with 7-zip (unless this is a market app, but more on that later). You are going to drag and drop the new icons into this file by “opening” it and navigating to the appropriate folder. The images you want to change are stored in the apk under /res/drawable-hdpi. Once you have your new icons from other sources, open your base file and navigate to this folder and drop them in.
3. Now you can flash this new file. I have provided empty zip files that you can place your themed files into and flash in recovery. Place your framework-res.apk and/or com.htc.resources.apk into the /system/framework folder located in the zip file provided. Now highlight the META-INF and system folders and zip them up. You can now place this file on the root of your SD card and flash. System apps can be placed under /system/app in the zip file.
Some more info on common themeable files:
Framework-res.apk – this is the meat and potatoes of a theme. On an AOSP ROM it will contain almost everything you want to theme aside from individual apps themselves. Sense ROMs have another file com.htc.resources.apk, as well as framework-res.apk. Both of these files are located in a ROM under /system/framework.
System apps: These apps come packaged in a ROM under /system/apps. They can be themed in the same manner as a framework apk. Some of these apps include Gmail, browser, camera, ect. Place them in your flashable zip under the folder /system/app.
Market apps: These apps are downloaded from the market and are can be pulled from your phone from /data/app. These files require a bit more to theme. They don’t share the same signature as the system apps and you must resign them using a program such as apkmanger. Place them in your flashable zip under /data/app.
If there are any errors, or if anyone has suggestions please let me know. I may have over looked some details, ect.
Thanks to everyone on XDA who has shared their knowledge and made this a great community!
Thanks that will be helpful
Sent from my PC36100 using XDA App
so using this guide we can pull parts and what not from other elements of themes we like and create our own framework to push back? Also, based on what you have, shouldn't it be easy to put this up on bid for hire (?) website to create a program to automate that?
xlGmanlx said:
so using this guide we can pull parts and what not from other elements of themes we like and create our own framework to push back? Also, based on what you have, shouldn't it be easy to put this up on bid for hire (?) website to create a program to automate that?
Click to expand...
Click to collapse
Yes the idea of this guide was to help people pick and choose icons they like in other ROMs and add it to their own. I'm not sure what bid for hire is?
its a website where you can load your requirements and folks can bid to do your work
linky
nukedukem said:
Yes the idea of this guide was to help people pick and choose icons they like in other ROMs and add it to their own. I'm not sure what bid for hire is?
Click to expand...
Click to collapse
xlGmanlx said:
its a website where you can load your requirements and folks can bid to do your work
linky
Click to expand...
Click to collapse
Interesting. Didn't know anything like this existed.
Sent from my EVO (CM6.1) using XDA App
Thank you, thank you!!!! I've been looking for something like this for a while.
evolishesh said:
Thank you, thank you!!!! I've been looking for something like this for a while.
Click to expand...
Click to collapse
No prob. Let me know if it works for you.
I couldn't get the auto signing to work, but the manual way of doing it worked.
Hmm, I got a boot loop on first try and doing this. Does that mean something went wrong with the signing, or that what I created for the theme was wrong? I used the empty .zip folder and re-zipped it, so I don't think that is the issue.
JasonK75 said:
Hmm, I got a boot loop on first try and doing this. Does that mean something went wrong with the signing, or that what I created for the theme was wrong? I used the empty .zip folder and re-zipped it, so I don't think that is the issue.
Click to expand...
Click to collapse
The signing should be ok. If you are using Amon_ra recovery it wont let you flash an unsigned zip I believe. Are you on sense or AOSP? Are you editing images or just copying from other ROMs?
What you might want to do is just create a simple test file. Change just one image and then flash that. That should let you know that your process is correct.
I using Amon Ra and using AOSP. I was moving some items out of a sense ROM so I guess that is where I might have went wrong. I think I'll take your advice and move just a single image and see how that works for me. Thanks!
I tried again this time I ended up stuck at the EVO white screen. I'm guessing it doesn't like the sense part I'm trying to throw in there. I'll have to try again with a AOSP theme instead.
Sent from my EVO (CM6.1.1) using XDA App
A couple things to look out for when swapping sense/CM icons - some file names are slightly different between sense and AOSP. Rename any sense icons to their AOSP counterparts and vice versa. Also, double check the image size of the icon is the same in both, i.e. 70x70 pixels, ect. and make sure you are not adding images that don't exist normally in the framework. For example there wont be any 4G icons in CM framework.
Also, make sure you aren't unzipping the new framework-res.apk you want to theme and flash, or trying to resign it. Only sign the flashable zip, not the individual files inside. The only thing you want to do with the framework-res.apk you will package and flash is open (not unzip) with 7-zip and navigate to the res/drawable-hdpi folder so you can drag and drop the new icons into it, overwriting the old.
I hope that helps!
How important is it to re-sign? I have modified the Framework and Resources apks with 7zip by switching images out. I have also modified the Rosie.apk. I put everything back where it was supposed to go, backed out of 7-zip and flashed. I have never had an issue with it, nor have I re-signed it. Just wondering.
spence341 said:
How important is it to re-sign? I have modified the Framework and Resources apks with 7zip by switching images out. I have also modified the Rosie.apk. I put everything back where it was supposed to go, backed out of 7-zip and flashed. I have never had an issue with it, nor have I re-signed it. Just wondering.
Click to expand...
Click to collapse
AFAIK if you are on clockwork recovery, I don't think it checks for signatures. I think Amon_ra requires a signed file to flash. I think it's just added protection against flashing any old junk. If you can flash in amon_ra without a signature and you don't have problems then I wouldn't worry about it. It's the signature of the framework-res.apk ( or com.htc.resources.apk) that's important. That's why you don't unzip it.
I think that
1.7.0.2 = yes
1.8 = no
nukedukem said:
AFAIK if you are on clockwork recovery, I don't think it checks for signatures. I think Amon_ra requires a signed file to flash. I think it's just added protection against flashing any old junk. If you can flash in amon_ra without a signature and you don't have problems then I wouldn't worry about it. It's the signature of the framework-res.apk ( or com.htc.resources.apk) that's important. That's why you don't unzip it.
Click to expand...
Click to collapse
nukedukem said:
A couple things to look out for when swapping sense/CM icons - some file names are slightly different between sense and AOSP. Rename any sense icons to their AOSP counterparts and vice versa. Also, double check the image size of the icon is the same in both, i.e. 70x70 pixels, ect. and make sure you are not adding images that don't exist normally in the framework. For example there wont be any 4G icons in CM framework.
Also, make sure you aren't unzipping the new framework-res.apk you want to theme and flash, or trying to resign it. Only sign the flashable zip, not the individual files inside. The only thing you want to do with the framework-res.apk you will package and flash is open (not unzip) with 7-zip and navigate to the res/drawable-hdpi folder so you can drag and drop the new icons into it, overwriting the old.
I hope that helps!
Click to expand...
Click to collapse
Thanks, any advice does help.
I did make sure the the icons I was swapping out were named the same thing in the CM ROM, but I didn't check the size of it at all.
I didn't unzip the famework-res.apk but instead just went into it with 7-Zip and dragged the icons into that. Then I backed out of 7-Zip so that it would save and close everything properly - know that does work because that is how I add the Fold transistions to the ROM - and then I put the famework-res.apk into the folder and zip it up per your instructions above. Then I manually sign it (still haven't been able to get the auto-signing to work) and then flash.
I'll have to try again moving a CM theme to the CM framework-res.apk and see if it is working. What I was attempting to do was take, from the Batman Theme for sense, the drop down notification shade with the Bat Icon and put it into the CM ROM. I don't know if you have time to try it yourself to see if it works, or if you get the same issues that I had.
Either way, thanks for the help! I know I'll get this theming down at some point!
nukedukem said:
No prob. Let me know if it works for you.
Click to expand...
Click to collapse
Hey buddy.
I’m stuck. I had to download and install Eclipse with the sdk plus java. I don’t know where to go from there. Every time I open the rom that I want to theme and get the framework.apk and edit the PNG’s , how do I go about saving them? Do I just used the same name as the old ones or I have to save them with a new name.
Or pm Me.
xlGmanlx said:
I think that
1.7.0.2 = yes
1.8 = no
Click to expand...
Click to collapse
So the new amon_ra doesn't require a signed file to flash? I'll make a note off that. Thanks.
JasonK75 said:
Thanks, any advice does help.
I did make sure the the icons I was swapping out were named the same thing in the CM ROM, but I didn't check the size of it at all.
I didn't unzip the famework-res.apk but instead just went into it with 7-Zip and dragged the icons into that. Then I backed out of 7-Zip so that it would save and close everything properly - know that does work because that is how I add the Fold transistions to the ROM - and then I put the famework-res.apk into the folder and zip it up per your instructions above. Then I manually sign it (still haven't been able to get the auto-signing to work) and then flash.
I'll have to try again moving a CM theme to the CM framework-res.apk and see if it is working. What I was attempting to do was take, from the Batman Theme for sense, the drop down notification shade with the Bat Icon and put it into the CM ROM. I don't know if you have time to try it yourself to see if it works, or if you get the same issues that I had.
Either way, thanks for the help! I know I'll get this theming down at some point!
Click to expand...
Click to collapse
OK I'll try and do what you are trying to do and see if it works...
evolishesh said:
Hey buddy.
I’m stuck. I had to download and install Eclipse with the sdk plus java. I don’t know where to go from there. Every time I open the rom that I want to theme and get the framework.apk and edit the PNG’s , how do I go about saving them? Do I just used the same name as the old ones or I have to save them with a new name.
Or pm Me.
Click to expand...
Click to collapse
So now you have an unzipped framewor-res.apk with a bunch of images. This framework should be the one that you want to take icons from. If not, start over with the ROM you want to copy images from. You will want to copy the images you want to put into another ROM so that you can dump them into the new framework-res.apk. After you figure out what icons you want to bring to your new framework, get a clean version of framework/com.htc from the ROM you are actually running - i.e. if you are running myn ROM on your phone, download the myn ROM and pull out the framework-res.apk or com.resources.apk that you are going to theme.
Now with this fresh clean framework you will "open" it with 7-zip to navigate to the /res/drawable-hdpi folder so you can now drag and drop the images you want to copy over into it. Then the close the 7zip window and your framework-res.apk is all set to flash. You don't need to rename if the file names are the same, you can just drag and drop and the files will be overwritten in the new framework.

[Q] Editing more than just images in Phone / contacts apks

Howdy all,
I am wanting to kno if there is anything special about editing certain system apps, do they all need to be signed with the same keys. i think i read this somewhere.
cause when i decompile the phone.apk then recompile with no changes / or with changes, signed it with autosigner or APK-Manager, it just FC's on the phone and i cant make sence of the logs...
oh and i tried pushing the file with adb and x10 mod tool, tried in the emulator, still no joys.
been googling for hours... and i feel i am searching for the wrong things...
Thanks in advance
Pvy.
you can use 7zip to browse the apk as an archive and replace png's and .9.png's inside the drawable folders.
you wouldn't have to resign the apk this way, but i would recommend zip-aligning the apk after you replace the png's.
i would also make sure you know how to work with .9.png's before replacing them. not doing .9.png's correctly will break the app.
I have edited the pngs there is no prob there I can put all the images in.
I am editing the xmls and the manifest... I tried drag and drop but it seems to break the apk...
Thanks tho.
Sent from my X10i using XDA App
Go ahead and compile with apk manager, say yes to 'is it a system apk?'.
Then open the new apk with 7zip and pull out the xmls, etc. you changed.
After that open the original apk w/7zip and drag in the compiled xmls along with your images.
That should work.
So I did this,
compiled phone.apk chose system app when it asked.
drag and dropped the 3 pngs I modded, and a few xml files, and the modded androidmanifest.xml to the original
Pushed it to my phone, rebooted...
But it wont install.
It appears the signing breaks.
Pvy
AyDee said:
Go ahead and compile with apk manager, say yes to 'is it a system apk?'.
Then open the new apk with 7zip and pull out the xmls, etc. you changed.
After that open the original apk w/7zip and drag in the compiled xmls along with your images.
That should work.
Click to expand...
Click to collapse
Sent from my X10i using XDA App
Changing default image
I wondered if anyone could help me out with this
Many thanks
pvyParts said:
So I did this,
compiled phone.apk chose system app when it asked.
drag and dropped the 3 pngs I modded, and a few xml files, and the modded androidmanifest.xml to the original
Click to expand...
Click to collapse
My suggestion is after doing this add the now modded original .apk into a flashable.zip and use xRecovery/FreeXperiaRecovery to install the app.
If you don't know how to make a flashable.zip just use 7zip to replace the phone.apk in a theme update.zip and delete any other folders/.apks that you don't want being reinstalled (framework-res etc.).
Not sure if this will work because I haven't tried this after modding .xml files, but it works after I make any other changes, even changing .9.pngs.
Best of luck, hope this works.
nope that didn't work either... took me a while but once i figured out the update.zip i got it going. and still no joy.
thanks heaps guys for all your help, i think i must have to compile from source or something silly like that...
I'll keep at it and let you all kno how i go...

[Q] Pushing modified framework-res.apk?

Hi, I'm trying to modify /system/framework/framework-res.apk (on the stock Samsung Oreo ROM), more exactly config_locationProviderPackageNames in res/values/arrays.xml so that I can add org.microg.nlp as location provider. I've used the latest apktool (2.3.4) to unpack and repack the apk. I'm replacing it from TWRP and I checked that it has the same owner and rights. And after rebooting the device never finishes booting up (stuck at Samsung logo and blue led).
If I boot back to recovery and put back the original framework-res.apk the system boots fine.
What else do I need to do to make it accept the modified framework?
hey
Are you ONLY modifying the apk?
I would say there is a lot of things to check. It could be that the apk is being rejected by your handling of it. Compare both versions by 7zip lz4 without extracting. Try and use the best tools during the process.
Also more than likely you're conflicting with a service or permission that a perfect apk can't fix.
Have you tried a search in your ROM to see if any files might be associated with the result you want?
Stuff like...
com.android.location.provider.jar
com.android.location.provider.odex
com.android.location.provider.xml
Try doing all the work from your phone without any windows apps. FX explorer and symlink the apk.
Now that everything I said was probably wrong, someone else can tell you how. I'd try fx and symlink, though. It may just align the planets for you
I'm only modifying one XML resource file, but I don't know what else apktool is doing to the apk.
I'm replacing the original framework-res.apk from TWRP, by cat-ing the modified apk over the original, and I've double checked that the ownership and permissions are unchanged.
I guess I can try using another unpack/repack tool and see if it turns out any better, but I've been told that apktool is as good as it gets.
Perhaps it's because the ROM expects the apk to be signed with a certain key? I don't suppose that the key used by Samsung is available somewhere inside the ROM is it?
​
wirespot said:
I'm only modifying one XML resource file, but I don't know what else apktool is doing to the apk.
I'm replacing the original framework-res.apk from TWRP, by cat-ing the modified apk over the original, and I've double checked that the ownership and permissions are unchanged.
I guess I can try using another unpack/repack tool and see if it turns out any better, but I've been told that apktool is as good as it gets.
Perhaps it's because the ROM expects the apk to be signed with a certain key? I don't suppose that the key used by Samsung is available somewhere inside the ROM is it?
Click to expand...
Click to collapse
@wirespot - Did you ever solve the problem you described in this thread?
Not really. My last attempt was to use Runtime Resource Overlays (RROs) to override certain framework values in order to allow org.microg.nlp to run side by side with Google's service.
I will provide them below but it ultimately didn't work. The RRO apk was installed correctly, I could access the NLP settings in the system settings but the main app still could not detect or connect to the service and none of the apps that use location would work.
If anybody else wants to build or use the RRO apk I'm attaching the relevant files as well as the apk. Please note that the built apk only has "org.microg.nlp" as service in arrays.xml (but I provide an arrays.xml with all three services).
apktool.yml is provided as txt file because it wouldn't let me upload it otherwise, remove the .txt. It's used if you build the package with apktool. Remember that you'll also have to generate your own certificate and sign the package in order to install it.
Also some links that may help:
https://forum.xda-developers.com/t/guide-how-to-make-gsis-overlay-file-for-your-phone.3878974/
https://github.com/ReinhardStrauch/framework-res-overlay-sample
https://android.stackexchange.com/questions/110927/how-to-mount-system-rewritable-or-read-only-rw-ro
https://source.android.com/devices/architecture/rros#configuring-overlays
https://source.android.com/devices/automotive/hmi/car_ui/appendix
https://source.android.com/devices/automotive/hmi/car_ui/rro#step_6_dump_the_idmap
https://dzone.com/articles/customizing-android-devices-using-the-runtime-reso
https://dzone.com/articles/android-solution-install-parse-1
https://stackoverflow.com/questions...s-not-recognized-internal-or-external-command
https://github.com/lineageos4microg/android_prebuilts_prebuiltapks/issues/22
wirespot said:
I guess I can try using another unpack/repack tool and see if it turns out any better, but I've been told that apktool is as good as it gets.
Click to expand...
Click to collapse
For decompiling and building Android Oreo, I prefer version 2.3.1 of APKTool to other versions of APKTools.
wirespot said:
I'm only modifying one XML resource file, but I don't know what else apktool is doing to the apk.
...
Perhaps it's because the ROM expects the apk to be signed with a certain key? I don't suppose that the key used by Samsung is available somewhere inside the ROM is it?
Click to expand...
Click to collapse
wirespot said:
Hi, I'm trying to modify /system/framework/framework-res.apk (on the stock Samsung Oreo ROM), more exactly config_locationProviderPackageNames in res/values/arrays.xml so that I can add org.microg.nlp as location provider.
What else do I need to do to make it accept the modified framework?
Click to expand...
Click to collapse
I have not tried modifying framework-res.apk of a Samsung Android Oreo nor have I particularly tried the location services mod you are attempting (though I might get around to trying it someday) and do not know if it is valid to to accomplish what you want with it, but believe that the process should be similar to modding the file on LG Android Oreo. I shall try to guide you to how to prepare a framework-res.apk that is proper.
To answer your question about expecting a certain key. The answer to that is that that is usually the case. The signing scheme checks on system apps; however is usually not as thorough as non-system apps. framework-res.apk is also special in that it is not a running app and is instead used as a cache of system resources and system meta information. In the past, before Android Oreo, a rebuilt framework-res.apk may be made to work simply by including original signature files (META-INF) and corresponding AndroidManfest.xml file from the original framework-res.apk into the rebuilt fraemwork-res.apk file. The system would evaluate these files, and pass a check for valid platform signature. With Android Oreo, it appears that there is an additional check that was not present in the past; my best guess is that the system is checking for the V2 signing scheme signing block within the V2 Signing Scheme APK file structure. The check does not, however, thoroughly validate the signing block information.
Your mod seems rather simple and, given your previous posts, would only involve a modification to framework-res.apk "resources.arsc" member file (which contains the compiled "res/values/arrays.xml" file). If the rebuilt "resources.arsc" can be used to update ("Update" is an actual ZIP archive operation) the original framework-res.apk's member file, the updated framework-res.apk should work (and remained zip-aligned if originally zip-aligned), so long as the packed file size of the updated member file is less than or equal to the packed size of the original member file, plus up to 4 bytes depending on proximity to the next member file data if original framework-res.apk is zip-aligned as expected. If the packed modified member file(s) are larger, the original APK file structure would likely not be preserved, and a different method might have to be used. Also note that 7-Zip is not reasonable software to use for this, despite it being included with many tools on XDA to modify APK files; the software has had a history of rearranging unnecessarily zip file table entries when a change is made to an archive. Use a different tool that does not do this, such as WinRAR (I have tested version 5.61).
For normal apps, one may not copy over "resources.arsc" or resources from two different app builds and have things work correctly when the app runs; one would also need to make corresponding changes in the *.dex APK member files. framework-res.apk, not being an app the runs, has no corresponding *.dex files, and one need not worry about corrupting the relationship between the *.dex files and the resource files because none exists to corrupt.

Framework-res.apk -- where to get?

Hi all,
I'm trying to fiddle with a Google apk file that I'm reskinning. Essentially there are multiple versions of the app in the wild already, but one has a dark grey background and I'm trying trying to make it all black.
I figure I need to change the xml file contained within the app. I guess I can just root and edit the xml file that way but I want to stay un-rooted if possible. That means editing the APK.
I downloaded Android Multitool and am trying to unpack the APK, make the necessary changes, and repack it. I'll probably run into signature issues down the road but currently I'm stil struggling with repacking. Specifically, I think I need a framework-res.apk, which I don't know how to find.
I'm assuming I need a stock Android framework-res.apk given the nature of the app, but I don't know where to find one....

Categories

Resources