Signing APK (HTCSetupWizard.apk) - EVO 4G Android Development

I keep having issues with the actual signatures when I edit certain system files.
Package com.htc.android.htcsetupwizrd has no signatures that match those in shared use android.uid.system; ignoring!
So basically, I can sign them and they work, but anything that accesses system settings and uses android.uid.system wont work.
Can anyone help me, possibly even provide me with a signature file or instructions on making this work with other signatures?

This is for a custom ROM so even if anyone knows how to add signatures to the system, that would work too.

Don't resign them, leave them as signed by HTC.

SteelH said:
Don't resign them, leave them as signed by HTC.
Click to expand...
Click to collapse
apktool is breaking the APK signatures...I gave up on that file and now I'm trying HTCAlbum.apk to no avail.

Neotelos_com said:
apktool is breaking the APK signatures...I gave up on that file and now I'm trying HTCAlbum.apk to no avail.
Click to expand...
Click to collapse
I don't know anything about dev-ing, but can you edit what you need straight in 7-zip?

awesomecomb said:
I don't know anything about dev-ing, but can you edit what you need straight in 7-zip?
Click to expand...
Click to collapse
No, that definitely breaks signatures.

Neotelos_com said:
No, that definitely breaks signatures.
Click to expand...
Click to collapse
Actually I believe editing without decompiling is what maintains the signature. Except you can only change pngs and replace xmls. To edit xmls you have to decompile the apks though, unless you know hex editing. I've been struggling with apktool trying to modify Rosie.apk from Z roms with absolutely no success (cannot recompile). Although it may have something to do with my resource table...

You can use dsixda's kitchen to sign all the apks so they match, I believe all system apks and one of the framework files (cant think of the exact one atm) all need to be signed the same.

Related

styles.xml

I have created a custom styles.xml I got from decompiling framework-res in CM6rc3, but am unable to recompile it. Apktool is unable to do this, from what I've heard. Anyone here able to do it? I'd appreciate any help.
xvenom89 said:
I have created a custom styles.xml I got from decompiling framework-res in CM6rc3, but am unable to recompile it. Apktool is unable to do this, from what I've heard. Anyone here able to do it? I'd appreciate any help.
Click to expand...
Click to collapse
Yeah sure I do!
-deleted post-
you may end up having to hex edit the file, using the decompiled version as a guide. unless there is some way to compile it separately from the entire apk
this is what had i do to modify progress_horizontal.xml to change the progress bar color
EDIT: or from what ive seen, start with a non-themed framework-res.apk, or one that has been properly recompiled, make sure to decompile it and recompile when you are done
invisiblek said:
you may end up having to hex edit the file, using the decompiled version as a guide. unless there is some way to compile it separately from the entire apk
this is what had i do to modify progress_horizontal.xml to change the progress bar color
EDIT: or from what ive seen, start with a non-themed framework-res.apk, or one that has been properly recompiled, make sure to decompile it and recompile when you are done
Click to expand...
Click to collapse
You see, the ONLY way to access this xml IS to decompile, as it's hidden in /res/values/styles.xml, which is invisible until you decompile the apk. Hex editing isn't necessary, as it is decompiled into plain english. I already edited it- I just need someone to compile the two for me, since apktool gives me errors.
xvenom89 said:
You see, the ONLY way to access this xml IS to decompile, as it's hidden in /res/values/styles.xml, which is invisible until you decompile the apk. Hex editing isn't necessary, as it is decompiled into plain english. I already edited it- I just need someone to compile the two for me, since apktool gives me errors.
Click to expand...
Click to collapse
which is why you need to hex edit it, because you cannot compile it when you get errors like that.
one thing you could try, is to decompile the ORIGINAL framework-res.apk from the rom you are running, replace the styles.xml with yours, then recompile it. after it is recompiled, grab the compiled styles.xml out of it and put it into the framework-res that you are building
a modified framework-res cant be decompiled unless it was properly recompiled to begin with. which most themers do not do, or probably dont know about
just a thought, may or may not work. but you are kinda stuck with this because i dont think its possible to just compile one or two files out of the apk, i think its all or nothing
invisiblek said:
which is why you need to hex edit it, because you cannot compile it when you get errors like that.
one thing you could try, is to decompile the ORIGINAL framework-res.apk from the rom you are running, replace the styles.xml with yours, then recompile it. after it is recompiled, grab the compiled styles.xml out of it and put it into the framework-res that you are building
a modified framework-res cant be decompiled unless it was properly recompiled to begin with. which most themers do not do, or probably dont know about
just a thought, may or may not work. but you are kinda stuck with this because i dont think its possible to just compile one or two files out of the apk, i think its all or nothing
Click to expand...
Click to collapse
I wasn't saying to compile one file from the apk- that's why I posted the entire thing, so you can decompile it, add my modified styles.xml to /res/values/ and then recompile.
Anyway, Thanks for the tip about recompiling an improperly compiled, themed apk. I'll test it on the original one shipped with rc3 and report back.
dam im looking to compile my styles.xml too, any tips?
SiL3nTKiLL said:
dam im looking to compile my styles.xml too, any tips?
Click to expand...
Click to collapse
doesn't anyone read a thread before posting anymore? especially one that is less than one page long?
</rant>
invisiblek said:
doesn't anyone read a thread before posting anymore? especially one that is less than one page long?
</rant>
Click to expand...
Click to collapse
Unnecessary rant. He probably just phrased it wrong; like me, he wanted to add a customized styles.xml into framework-res by means of compiling.
invisiblek said:
...decompile the ORIGINAL framework-res.apk from the rom you are running, replace the styles.xml with yours, then recompile it. after it is recompiled, grab the compiled styles.xml out of it and put it into the framework-res that you are building
a modified framework-res cant be decompiled unless it was properly recompiled to begin with. which most themers do not do, or probably dont know about
Click to expand...
Click to collapse
i can verify my theory here, it worked fine with progress_horizontal.xml, which means it should work with any xml

Themeing and CWM FLashable File

Hey guys/girls. I'm creating a theme for Andromeda 3 and one thing I cannot fifure out is how to make my theme CWM flashable to test it.
I opened the zip from a different flashable theme, replaced the framework-res.apk and twframework-res.apk with the modified ones from Andromeda and repackaged them using Winrar. I have followed the guides to resign the APK's and ZIP but no mater what I do, after a reboot I get a solid black screen and the phone vibrates.
Im not sure what I am doing wrong because I thought that was all that went into creating a CWM file.
Thanks in advance......
7 posts under this one
http://forum.xda-developers.com/showthread.php?t=1037842
the meta info is alot more specific than just swap any other files...
Thanks, I found that one about 5 mins ago but couldn't seem to find it when I searched the forum before posting. Must have missed it
Should also point out that if you're decompiling the framework apks with apktool, modifying any of the xml's or code, and recompiling, you'll need to sign the resulting apk or you'll end up with a boot loop.
modest_mandroid said:
Should also point out that if you're decompiling the framework apks with apktool, modifying any of the xml's or code, and recompiling, you'll need to sign the resulting apk or you'll end up with a boot loop.
Click to expand...
Click to collapse
Actually, I'm just opening the apk's with winrar. I make the changes to the folders/files and rezip them with Winrar with Store mode (no compression?) Then I resign them with testsign.jar.
I have read the themeing guides but they are really lacking in the small details dept.
modest_mandroid said:
Should also point out that if you're decompiling the framework apks with apktool, modifying any of the xml's or code, and recompiling, you'll need to sign the resulting apk or you'll end up with a boot loop.
Click to expand...
Click to collapse
Wrong.
Never resign system apks such as framework-res or twframework-res. His problem has nothing to do with the signature.
If you are simply copying over files inside the apk and getting this error, then you are adding more files than was originally inside the apk. I repeat, DO NOT ADD FILES THAT ARE NOT ALREADY INSIDE UNLESS YOU KNOW HOW TO RE-COMPILE THE RESOURCES.ASRC!
Also, use 7-zip to edit apks when you just want to overwrite files. Never unzip, or re-zip. Just right-click > 7-zip > Open Archive > Drag and drop files > close the window > you're done
Edit: Also, this goes in Q&A not General.
ryude said:
Wrong.
Never resign system apks such as framework-res or twframework-res. His problem has nothing to do with the signature.
If you are simply copying over files inside the apk and getting this error, then you are adding more files than was originally inside the apk. I repeat, DO NOT ADD FILES THAT ARE NOT ALREADY INSIDE UNLESS YOU KNOW HOW TO RE-COMPILE THE RESOURCES.ASRC!
Also, use 7-zip to edit apks when you just want to overwrite files. Never unzip, or re-zip. Just right-click > 7-zip > Open Archive > Drag and drop files > close the window > you're done
Edit: Also, this goes in Q&A not General.
Click to expand...
Click to collapse
Ok, thanks man.
Will I need to resign the final theme.zip before flashing it?
Also, can't I just grab the updater-script from another theme.zip and us it in my mine?
ryude said:
Wrong.
Never resign system apks such as framework-res or twframework-res. His problem has nothing to do with the signature.
Click to expand...
Click to collapse
I didn't say anything about resigning? Apktool creates an entirely new, unsigned apk, which unless I'm extremely mistaken you'll need to use if you intend to modify certain resources.
modest_mandroid said:
I didn't say anything about resigning? Apktool creates an entirely new, unsigned apk, which unless I'm extremely mistaken you'll need to use if you intend to modify certain resources.
Click to expand...
Click to collapse
He doesn't need to use apktool, because he isn't edited any code.
timbrendelaz said:
Ok, thanks man.
Will I need to resign the final theme.zip before flashing it?
Also, can't I just grab the updater-script from another theme.zip and us it in my mine?
Click to expand...
Click to collapse
No, you don't have to sign CWM zips because Clockwork doesn't check for a signature.
You could use another updater-script, but the problem with that is if it tries to perform an action on a file or folder that isn't inside your zip it will crash while flashing. You'll be left with a bricked phone and have to ODIN back to restore.
ryude said:
He doesn't need to use apktool, because he isn't edited any code.
Click to expand...
Click to collapse
But what if he is lol? Cause that's what im trying to do and having some issues. Know of a good thread on this? Editing xml that is
Sent from my SGH-T959 using XDA Premium App
TXLunchbox said:
But what if he is lol? Cause that's what im trying to do and having some issues. Know of a good thread on this? Editing xml that is
Sent from my SGH-T959 using XDA Premium App
Click to expand...
Click to collapse
If you're editing code, I recommend using apk manager since it will automatically recompile the resources.asrc for you. Just make sure to downgrade the apktool that comes with it to 1.3.1, 1.3.2 is known to cause problems with xml edits.
1. Set new project apk.
2. Decompile apk, if it's a system apk use the option for dependency apk and use twframework-res.apk as the dependency apk.
3. Edit your xml files.
4. Recompile, when asked use yes twice. It will tell you to delete files in the Keep folder.
5. Delete the resources.asrc if you edited any xml/added new files. Delete the files that you added/edited.
6. Once you're done it will automatically copy over the signature and use the compression that you set (default level 9, I recommend level 0).
Don't worry that it says "unsignedFramework-res.apk", it will work since it's a system apk because system apk signatures get copied over to the new file. Just rename it to Framework-res.apk or whatever you need it to be called.
ryude said:
He doesn't need to use apktool, because he isn't edited any code.
Click to expand...
Click to collapse
Hence the 'if' in my original statement, you know, 'if' he ever chose to in the future.

[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...

Need someone to compile an APK for me

Alright, so I decompiled the apk, edited the XML files I needed to. And now it won't compile. Keeps throwing java errors. Would someone be so kind to compile this for me?
This is a System APK so it needs to be compiled and signed. If you're curious or it needs extra files pulled from somewhere, it's the SystemUI.apk in the CM7 Droid nightly build 88.
Thanks!!
Here's what I need compiled:
http://mikelierman.com/SystemUI.apk.zip
0vermind said:
Alright, so I decompiled the apk, edited the XML files I needed to. And now it won't compile. Keeps throwing java errors. Would someone be so kind to compile this for me?
This is a System APK so it needs to be compiled and signed. If you're curious or it needs extra files pulled from somewhere, it's the SystemUI.apk in the CM7 Droid nightly build 88.
Thanks!!
Here's what I need compiled:
http://mikelierman.com/SystemUI.apk.zip
Click to expand...
Click to collapse
What did you use to decompile it? APK Manager from this thread?
http://forum.xda-developers.com/showthread.php?t=695701
Oh and once you compile it, you don't have to sign it because is a system app and not a regular app.
0vermind said:
Alright, so I decompiled the apk, edited the XML files I needed to. And now it won't compile. Keeps throwing java errors. Would someone be so kind to compile this for me?
This is a System APK so it needs to be compiled and signed. If you're curious or it needs extra files pulled from somewhere, it's the SystemUI.apk in the CM7 Droid nightly build 88.
Click to expand...
Click to collapse
What errors are you getting from apktool? It's going to be hard for someone else to compile an apk that has not been decoded by them and not knowing what files have been changed. Letting us know at least what .png or .xml files were modified would be a start but will work best if we could just figure out why you aren't able to build with your modifications.
The first thing I noticed from the zip you attached is that it's missing the apktool.yml file that should get created a package is decoded. Second, make sure to pull /system/framework/framework-res.apk so resources can be decoded/built properly. If you are using APK Manager, use option 10 to decode with framework-res.apk. If you are just using apktool run the command "apktool if framework-res.apk" before decoding.
mazdarider23 said:
Oh and once you compile it, you don't have to sign it because is a system app and not a regular app.
Click to expand...
Click to collapse
SystemUI.apk actually does get signed using the platform key. The easiest way to do so in my opinion is to use ZipSigner 2 on your phone. Also, once you've placed the modified SystemUI.apk into /system/app make sure it's permissions are rw-r--r--(chmod 644 /system/app/SystemUI.apk) and it's owner:group is root:root(chown 0:0 /system/app/SystemUI.apk). Next reboot to recovery, wipe dalvik-cache and cache, then reboot.
MongooseHelix said:
What errors are you getting from apktool? It's going to be hard for someone else to compile an apk that has not been decoded by them and not knowing what files have been changed. Letting us know at least what .png or .xml files were modified would be a start but will work best if we could just figure out why you aren't able to build with your modifications.
The first thing I noticed from the zip you attached is that it's missing the apktool.yml file that should get created a package is decoded. Second, make sure to pull /system/framework/framework-res.apk so resources can be decoded/built properly. If you are using APK Manager, use option 10 to decode with framework-res.apk. If you are just using apktool run the command "apktool if framework-res.apk" before decoding.
SystemUI.apk actually does get signed using the platform key. The easiest way to do so in my opinion is to use ZipSigner 2 on your phone. Also, once you've placed the modified SystemUI.apk into /system/app make sure it's permissions are rw-r--r--(chmod 644 /system/app/SystemUI.apk) and it's owner:group is root:root(chown 0:0 /system/app/SystemUI.apk). Next reboot to recovery, wipe dalvik-cache and cache, then reboot.
Click to expand...
Click to collapse
Well I'm glad you told me because little old me has been modifying system apps since the days of the nexus one and I've yet to sign one....I think is all depends on who's doing the modification...hahahaha....Good luck 0vermind on finding someone to compiling your systemui.apk!
mazdarider23 said:
Well I'm glad you told me because little old me has been modifying system apps since the days of the nexus one and I've yet to sign one....I think is all depends on who's doing the modification...hahahaha....Good luck 0vermind on finding someone to compiling your systemui.apk!
Click to expand...
Click to collapse
I'm not quite sure what to make of that comment...I certainly wasn't trying to step on your toes so I apologize if it came across that way. Just wanted to help avoid and rule out any issues that might come up. With APK Manager or by using 7zip, you can move the manifest and/or META-INF folder containing the signature from the original but to imply that system apps are not signed is incorrect.
I also think it is important that those messing with system apps understand that there are different keys used to sign apps. For anybody reading this that wants to figure out how certain packages are signed, here's a bit of an explanation. If we extract SystemUI.apk, we see a directory called META-INF. This holds the key/signature info. The key's serial number can be determined with the following command:
Code:
keytool -printcert -v -file SystemUI/META-INF/CERT.RSA | grep SerialNumber
You can check other apks/jars and noticing which have matching serial numbers, meaning they are signed with the same key...
platform key - SystemUI.apk, Settings.apk, Phone.apk, etc
shared key - Contacts.apk, UserDictionaryProvider.apk, etc
test key - Calendar.apk, DeskClock.apk, etc
google proprietary key - Vending.apk, Talk.apk, etc (including some market user apps like Maps, VoiceSearch, Docs)
MongooseHelix said:
I'm not quite sure what to make of that comment...I certainly wasn't trying to step on your toes so I apologize if it came across that way. Just wanted to help avoid and rule out any issues that might come up. With APK Manager or by using 7zip, you can move the manifest and/or META-INF folder containing the signature from the original but to imply that system apps are not signed is incorrect.
I also think it is important that those messing with system apps understand that there are different keys used to sign apps. For anybody reading this that wants to figure out how certain packages are signed, here's a bit of an explanation. If we extract SystemUI.apk, we see a directory called META-INF. This holds the key/signature info. The key's serial number can be determined with the following command:
Code:
keytool -printcert -v -file SystemUI/META-INF/CERT.RSA | grep SerialNumber
You can check other apks/jars and noticing which have matching serial numbers, meaning they are signed with the same key...
platform key - SystemUI.apk, Settings.apk, Phone.apk, etc
shared key - Contacts.apk, UserDictionaryProvider.apk, etc
test key - Calendar.apk, DeskClock.apk, etc
google proprietary key - Vending.apk, Talk.apk, etc (including some market user apps like Maps, VoiceSearch, Docs)
Click to expand...
Click to collapse
Thanks, I didn't know this! I'm glad there's people like you and mazdarider23 on this forum that know **** like this!!!

[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.

Categories

Resources