[Q] Custom Phone APK on HERO (CDMA) - General Questions and Answers

hi, this is my first post here on XDA. i've surfed this site for quite a while as an guest and i love the work that's been done here. I am not new to the field of reverse engineering but most of my time has been spent on the x86 world (Windbloze)
my curiosity grew in the reversing of android applications. I've modded a few apps from the Android Market but now i'm wanting to modify my Phone.apk to get rid of a feature i find 'stupid'
every time i make a call the phone vibrates when it connects, and for me that's annoying because i have all features of my phone set to vibrate and i find myself looking at the phone to see if it was a text or something lol.
I am not asking for someone to do this for me, i will post below what i have done and what i've tried to do to get it working and hope someone can guide me along my way.
Pulled Phone.apk from /system/app
Pulled HTC Framework (com.htc.resources.apk) from /system/resources
Installed framework with apktool
decompiled phone.apk
found offending code that causes the vibrate on connect, deleted it
recompiled APK with apktool
resigned it with testsign.jar
pushed to phone using
adb shell stop
adb push
adb shell start
Click to expand...
Click to collapse
Phone.apk crashes and i get no service
now as far as troubleshooting goes i've done a few logcats on startup to see where it's failing
this line appeared intersting to me:
Package com.android.phone has no signatures that match those in shared user android.uid.phone; ignoring!
Click to expand...
Click to collapse
as suggested by another thread (over on modaco) i removed the following bolded portions of the androidmanifest.xml file
android:sharedUserId="(Text removed to obey outside link filter)"
android:sharedUserLabel="(Text removed to obey outside link filter)"
Click to expand...
Click to collapse
trying yet again with the above pushing method i then shutdown the phone and started another logcat... this time i noticed that it changed the Phone.apk's UID from 1001 to some other number and later on in the logcat i see that the package manager is refusing to give the requested permissions to Phone.apk
so starting all over i tried again with the original AndroidManifest.xml I found a thread here on XDA that states that FieldTest.apk and Telephony.apk might need to be signed with the same cert as Phone.apk so I pulled and resigned with testsign (i'm assuming it uses the same key to sign all apks) the TelephonyProvider.apk and FieldTest.apk files along with Phone.apk, pushed them all to the phone and now i'm getting all kinds of FC's...
So here I am, after hours of fighting with my phone asking for some help... if anyone could guide me to the correct way of modifying my Phone.apk file and still maintain service i would be very appreciative.
EDIT: I've also read somewhere that the framework might need to be resigned, but frankly i'm not sure how that could fix the problem, sounds to me it would cause a lot more problems...also i'm aware that there is a cutom Phone.apk v30.x but it specifically states it's not compatible with the HTC Hero

Related

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] Change Service Provider Name in Notification Bar

I was wondering if anyone knew how to change the name of the service provider from "Virgin Mobile" to whatever i want. (Like my name for instance.) I have already tried changing the build.prop file and it didn't work. The app "Carrier Name" doesn't work. I tried extracting the framework.apk and going deeper to the eri.xml and changing the provider name to something else but "Virgin Mobile" wasn't even there. Also in cdma workshop changing the banner doesn't do anything and the banner isn't even "Virgin Mobile" which it should be. I have tried other forums with no success and i'm hoping a dev can help. Yes i am rooted.
x2 would also like to know how to change that name to something else..
Self-bump for hope
QPST didn't work.
Ya i forgot to mention I also tried QPST with no luck.
under CDMA carriers I believe if you edit the framework-res.apk/values/strings.xml you can change something like zz_nationalRoaming_Carrier=Virgin Mobile
i know it sounds weird, roaming, but check it out....
I've been trying to accomplish this on GSM phones but they pull the variable from the sim card.... if you can simply change the txt value in framework-res.apk/layout/keyguard_screen_lock.xml then maybe that would work?
You need to change it from something like android:id="@id/carrier" whatever it says;
to android:text="custom" or whatever that is... (Open up eclipse and check out a basic text fields layout.xml so that you can use that as a guide if you need to...)
I'll check it out soon; it's something I intended to do for a guy.. I just don't personally own the triumph this worked great on Samsung Moment... but it was android 2.1 ....
I was so excited when I saw your post! But then I became bummed again as I saw that I don't have a "values" folder on my triumph's framework-res.apk. The three folders that I have as I open the .apk are "assets", "META-INF",and "res." I have attached a picture to show you what I mean. Thanks for the effort. Keep me updated.
Don't extract it... use apktool,
it needs decompiled... (if you use root explorer or something you can't see the correct text either)
-- Please be ready to recover your rom before trying this you may have a bootloop if you forget to fix permissions etc... ---
Windows instructions
Place framework-res.apk in your c:\ in a new folder called frame (or wherever);
example will use c:\frame\
Put apktool and aapt in \frame; (I will try to find something to attatch sorry i'm on my lunch break @ work)
C:\frame\framework-res.apk
C:\frame\aapt.exe
C:\frame\apktool.bat
C:\frame\apktool.jar
Open command prompt as administrator (open start menu type cmd right click it hit run as administrator)
In this prompt type cd\frame (Or wherever you put those files)
Run this;
apktool d framework-res.apk
this will extract all files to C:\frame\framework-res\
Check then for your values folder, you should see tons... just worry about Values. the rest are locales... (languages,, if it fails maybe try values-EN?)
Once you're done you can run apktool b framework-res and it will build the contents of the c:\frame\framework-res\ folder into C:\framework-res\dist\framework-res.apk
now you have to put this file in your /system/
you can get it there via the phone if you have issues I will try to help for now here are adb instructions:
adb remount
adb push c:\frame\framework-res\dist\framework-res.apk /system/framework-res.apk
adb shell chmod 644 /system/framework-res.apk
This may or may not work again I'm on my lunch sorry...
report back i'll stay active here;
I don't own a triumph but my buddy does so I can't test much
I am learning this stuff too but I have spent some time with it so i'd be more than happy to share; likewise i'd love anyones help learning aswell.... that's actually what brought my attention to this triumph; =D
edit; btw i'll see if i can't test this realtime tonight I had heard that 7zip is fine for framework-res but I think that was for the GFX themeing not for the xml editing? I dont' know, I apologize if you got stuck on my guide however I will work with you to make it through it
Thanks man. I appreciate your write up. I will try it today after school and get back to you on the results.
You may have an issue in adb, i noticed that I was unable to get the device to pick up in ADB ... I rebooted the phone and noticed that the device manager picks up the Android ADB Interface for a minute, but as it finalizes boot it drops it...
Perhaps I just have driver issues but it seems like a start up script is runing the command stop adbd
Anyway if that's the case we need to remove the stop adbd command from the startup scripts;
Anyways; if you can't get ADB USB drivers maybe w/ your root access you can set it up on wifi? connect to wifi and run
(From phone terminal)
setprop service.adb.tcp.port 5555
stop adbd
start adbd
(From PC)
adb tcpip 5555
adb connect IPADDRESS:5555 -Note that i mean the ip address to the phone on wifi)
then if it's successful you should be able to adb remount adb push framework etc...
remember to chmod or you WILL bootloop.
I was able to successfully follow your guide up until when i (try to) compile with the apktool b framework-res command I get this:
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathN
otExist: apktool.yml
at brut.androlib.Androlib.readMetaFile(Androlib.java:142)
at brut.androlib.Androlib.build(Androlib.java:159)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
Caused by: brut.directory.PathNotExist: apktool.yml
at brut.directory.AbstractDirectory.getFileInput(AbstractDirectory.java:
103)
at brut.androlib.Androlib.readMetaFile(Androlib.java:138)
... 4 more
The new and improved .apk never gets made because of this error. I google searched and tried to find a solution for at least an hour with no luck. I would just like to thank you in advance for all of your help.
I was able to successfully follow your guide up until when i (try to) compile with the apktool b framework-res command I get this:
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathN
otExist: apktool.yml
at brut.androlib.Androlib.readMetaFile(Androlib.java:142)
at brut.androlib.Androlib.build(Androlib.java:159)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
Caused by: brut.directory.PathNotExist: apktool.yml
at brut.directory.AbstractDirectory.getFileInput(AbstractDirectory.java:
103)
at brut.androlib.Androlib.readMetaFile(Androlib.java:138)
... 4 more
The new and improved .apk never gets made because of this error. I google searched and tried to find a solution for at least an hour with no luck. I would just like to thank you in advance for all of your help.
EDIT: It posted twice for some reason!? Weird
i'll take a look i believe it it's entirely because of what version of APKtool I submitted (perhaps a bad one, sry...) I'll get the framework from the system dump in the other thread and try it out
Ok thanks a lot man.
Wow I joined in 2008 and got my first thanks; yet I went to reply and thanked you for saying thanks!
Hahahah, no but for real it's cool cause thanks for trying; fyi i was able to compile okay...
I found apktool.yml or whatever, but it's supposed to be in the decompiled folder... when you recompiled are you doing it like this?
apktool d framework-res.apk
apktool b framework-res (NO .apk it is the FOLDER you are targetting)
I will test my rebuilt framework, this is what I changed;
<string name="roamingText1">Virgin Mobile</string>
to
<string name="roamingText1">Ryan S.</string> (The guys name.)
You guys what you have to edit is the line "zz-roaming text 1" just editing this one will change them all. (Lockscreen and notification bar) as for the tool to decompile the framework-Res.apk I recommend apk manager. It is the easiest to use. (Note to newbs) with apk manager you don't have to remember command prompt codes
Sent from my MOTWX435KT using XDA App
I found no zz in it, was the problem... several zzz but no zz roaming
anyway i should forwarn that my framework-res.apk broke the guys phone i restored it and we're good but looking at the files they're 700kb differences so perhaps apk manager alone will recompile more successfully?
I appreciate the reocmmendation most of the tools I have found so far havn't allowed access to the xml files just the pngs, or not all of the contents of the apk (not decoding them)
I'll try apk manager and report back soon.
I've never tried apk tool, I may try this once someone does it successfully so I'll be watching. I don't know how to backup my phone so I'm wary of tinkering.
using apk tool
From my own experience I find that apk manager can sometimes be tricky to use. And sometimes when you recompile the first time it doesn't work properly. If it doesn't work the first time try it again. Ill try doing this when I can get to my computer. BTW make sure you import the old files and delete whichever one you changed. That's where it can get tricky
the current issue i'm having is that the apk file made is like 6-800kb smaller and all i didwas remove ascii,
i'll test it when i can though sorry

[Q] Guide Request-- How to Implement Krylon's CIQ Removal

Hello. I would like to know if anyone has an actual beginner's guide to CIQ removal. For a minute, there was a guide that didn't quite have all the bugs worked out of it, but it was removed. I've been trying to follow Krylon's thread on rootzwiki, but it seems to stop short of telling people how to actually recompile everything and push it back to the phone. It would be helpful and informative to be walked through this process once the CIQ files have been deleted from the decompressed classes.dex files and .xml manifest.
Thanks
Note: So far, I have figured out that autosmali can be used to smali the files back into a classes.dex file, which can be reincorporated into the associated .jar files using 7zip. Seems simple enough. However, the process of getting framework-res updated seems to be more complicated, and requires answering some questions about. Specifically: 1. Option 11 asks (a) Is this a system apk? (b) Aside from the signature, would you like to copy over any additional files that you didn't modify from the original apk in order to ensure least # of errors? I have answered "yes" to 1.(a) and "yes" to 1.(b), which told me to delete the .xml and the resources.arcs file from a temp directory before completing the compile. This whole process has left me with three modified files (framework.jar, android.policy.jar, and framework-res.apk (unsigned)). Now what do I do with them?
Note 2: Looks like I can sign the framework-res.apk file using option 12.
Once you are done modifying the files you need to either put them in an update.zip and flash or push them with adb to their respective folders.
As for someone giving a step by step I doubt that will happen. It seems like the ones that do know how to do alot of the modifications to roms, are pretty vague when they post how to's. Most of the time it seems like they just don't want to share the information. Why I don't know, but that is just my opinion. I am sure I will probably get flamed for saying this but again this is just my opinion.
You can search the forums and find most of the information here and there. Then you need to put it all together and hope it works.
My thought's would be to have a seperate area in the forum to post just Tips, Techniques and How To's. Then alot of the people that want to learn how to theme and build roms would have an better source to find their answers than having to search all the forums. Again just my .02 cents worth...
Hope no one is offended by this as that is not my intention.... XDA is a great source for information...
quick steps..
Decompile Framework.jar, delete the entire carrieriq dir and all it's contents, recompile.
delete /system/xbin/iqbridger
DONE
Makes the rest dead code.
tablador said:
Hello. I would like to know if anyone has an actual beginner's guide to CIQ removal. For a minute, there was a guide that didn't quite have all the bugs worked out of it, but it was removed. I've been trying to follow Krylon's thread on rootzwiki, but it seems to stop short of telling people how to actually recompile everything and push it back to the phone. It would be helpful and informative to be walked through this process once the CIQ files have been deleted from the decompressed classes.dex files and .xml manifest.
Thanks
Note: So far, I have figured out that autosmali can be used to smali the files back into a classes.dex file, which can be reincorporated into the associated .jar files using 7zip. Seems simple enough. However, the process of getting framework-res updated seems to be more complicated, and requires answering some questions about. Specifically: 1. Option 11 asks (a) Is this a system apk? (b) Aside from the signature, would you like to copy over any additional files that you didn't modify from the original apk in order to ensure least # of errors? I have answered "yes" to 1.(a) and "yes" to 1.(b), which told me to delete the .xml and the resources.arcs file from a temp directory before completing the compile. This whole process has left me with three modified files (framework.jar, android.policy.jar, and framework-res.apk (unsigned)). Now what do I do with them?
Note 2: Looks like I can sign the framework-res.apk file using option 12.
Click to expand...
Click to collapse
Don't use option 12.
NEVER SIGN A SYSTEM APK
krylon360 said:
Don't use option 12.
NEVER SIGN A SYSTEM APK
Click to expand...
Click to collapse
Thanks krylon for the quick fix.
If, for completeness, I wanted to put all of these modified files on my phone (unsigned), how would I do it? Last time I tried, I used a root file explorer and my phone started bootlooping immediately after placing framework-res.apk on the phone. Adb was not available, so I had to reflash in order to put the file back the way it was. I was thinking maybe to adp push the file instead of copying it with the explorer.
adb push then reboot.
but, it's best to do it as a fresh install.
Thanks, I will give that a try.
Followed these directions 3x, but when I boot up my phone with these changes, the Android System process stops responding every time i boot my phone. I can bypass the error message fine, though.
edit: Well, after reflashing it 2 more times with the exact same rom, it doesn't happen anymore. MEH, who knows?
One of Raver's ROMs did that too. I think it is a dependency to something you removed. It was fine on the ROM. One FC when you boot ROM and that was it.

[Q] Modded Camera.apk hardkeys

Got the modded Camera.apk from Here. I changed my hardkey Search button to function like a Menu key (my menu hardkey won't work properly). I liked the search key as a snapshot key for the camera but now with me changing 217 "SEARCH" to MENU" it doesn't work.
I downloaded APKTool and decompiled modded .apk. Now the only problem is I can't find where to change the key to take a snapshot with "MENU" pressed. I have been looking through the .smali files and not having any luck. Menu key as far as I have seen has no function in the camera app anyways so this shouldn't be a problem.
Last question I would have (which I could probably search) would be how to take the decompiled .apk and compile it back to .apk.
Is the code for the menu button 217 or is that independent of the button?
Sent from my SCH-I510 using xda premium
Within /system/usr/keylayout/qwerty.kl "key 217 SEARCH" I changed to "key 217 MENU" also I changed /system/usr/keylayout/s3c-keypad.kl "key 217 SEARCH" to "key 217 MENU".
That is how I got Search button to open Menu.
I'll take a look for you. It probably won't take too long.
Yeah it should just be changing the key event code from the search key to the menu key in a few places.
dwitherell said:
Yeah it should just be changing the key event code from the search key to the menu key in a few places.
Click to expand...
Click to collapse
The problem for me is I can't find those few places. lol Searching through all these .smali files I think I'm gonna need my search button back lol.
Edit: I opened all of the files in NotePad++ and did a search for "search" and found several items but I don't know what to change or leave.
I think what I need to change is in AbstractCameraActivity.smali
Enlightened_Rogue said:
The problem for me is I can't find those few places. lol Searching through all these .smali files I think I'm gonna need my search button back lol.
Click to expand...
Click to collapse
I'm sure substanceD will get it for ya, but camera.smali and camcorder.smali are 2 at least. It'll be in the onkeyup and onkeydown event methods (just looked at this, but memory is a bit sketchy...)
dwitherell said:
I'm sure substanceD will get it for ya
Click to expand...
Click to collapse
As you see I don't mind doing the leg work, I'm not one of these beggers out there that just want someone to build a app just for me. Thanks for giving me some pointers. I'm just trying to learn as I go. New to modding phones (trying to get better).
Enlightened_Rogue said:
As you see I don't mind doing the leg work, I'm not one of these beggers out there that just want someone to build a app just for me. Thanks for giving me some pointers. I'm just trying to learn as I go. New to modding phones (trying to get better).
Click to expand...
Click to collapse
All right, let's see if I can be helpful without doing the work for you. The Android key codes are published here: http://developer.android.com/reference/android/view/KeyEvent.html. The smali files have the hex values for these key events without the extraneous zeros. For example, you'll notice that KEYCODE_POWER is sprinkled throughout the code as 0x1a. Try to find a block of code that refers to the common keys (power, search, menu, etc.) and see how it delegates them.
OK I replaced 0x54(Search) with 0x52(Menu) [14 instances] and then Compiled with APKTool. Moved Camera.apk to /system/app/ and now phone doesn't recognize Camera.apk. I restarted, tryed setting permissions to rw-r--r-- then restarting as well and still not being recognized.
Edit: Noticed when I moved your modded the permissions where rwxrwxrw- and it still showed up without restarting.
Enlightened_Rogue said:
OK I replaced 0x54(Search) with 0x52(Menu) [14 instances] and then Compiled with APKTool. Moved Camera.apk to /system/app/ and now phone doesn't recognize Camera.apk. I restarted, tryed setting permissions to rw-r--r-- then restarting as well and still not being recognized.
Edit: Noticed when I moved your modded the permissions where rwxrwxrw- and it still showed up without restarting.
Click to expand...
Click to collapse
Did you sign it (don't)? Also, there are some sound files in /res/raw that need to stay UNcompressed for things to work properly.
All I did to compile was from Here.
Code:
apktool b <directory of decoded apk>
Never compiled any apk before. How do you not sign it and not compress some of the resource files?
Edit: Just seen this at the bottem, but I'm using APKTool 1.4.3
idroid84 said:
Issues;
I noticed that while the new version 1.2 works great on the framework-res.apk file, it seems to have issues with other System/app files like Settings.apk,Phone.apk, etc. For these files use version 1.1.1.
Click to expand...
Click to collapse
Enlightened_Rogue said:
All I did to compile was from Here.
Code:
apktool b <directory of decoded apk>
Never compiled any apk before. How do you not sign it and not compress some of the resource files?
Edit: Just seen this at the bottem, but I'm using APKTool 1.4.3
Click to expand...
Click to collapse
Well the first part shouldn't be an issue I don't think. For the second - an apk is similar to a zip file. I would use something like jzip or winrar to extract out those sound files, delete them from the apk, then drop them back in using store or storage (i.e. no) compression. Though I am doubtful not doing this would cause the phone to not recognize the apk to be honest.
I opened the Original Modded .apk with 7zip moved the res files over just playing around waiting for a response and still no luck. Also I noticed while doing that the Modded on had a META-INF folder which I moved over to my Mod and after all that moved to phone /system/app and restarted phone still no Camera in App Drawer.
Original Mod I decompile: Camera 5-14-12
My Decomipled and editied:Camera - Menu Button
I was messing around with my phone and decided to install PBJ Kernel 0524. After installing that now Root Manager won't allow Mount R/W so now I can't change system files. I guess I'm stuck with what I got for now.
Edit: Complete noob moment... Went into CWM -> Mounted System -> Installed SU again. Now works. Back to working on Camera
Enlightened_Rogue said:
I was messing around with my phone and decided to install PBJ Kernel 0524. After installing that now Root Manager won't allow Mount R/W so now I can't change system files. I guess I'm stuck with what I got for now.
Edit: Complete noob moment... Went into CWM -> Mounted System -> Installed SU again. Now works. Back to working on Camera
Click to expand...
Click to collapse
Yeah the lost root is just a permissions thing - a number of ways to fix it, and installing su is definitely one of them. Glad you got that figured out.
I looked into this more - you changed too many 0x54s... not all of those were relevant to what you wanted (only 6 were). On top of that, only two of them were changing 0x54 to 0x52 (CamcorderRecordingMenu.smali) - the other 4 (2 in Camcorder.smali and 2 in Camera.smali) were simply changing the :sswitch_ value associated w/ 0x52 to that associated w/ 0x54.
Anyhoo - end result should now be power, menu, and search take pics/start video. Here's the apk - just rename to Camera.apk and push. If it doesnt show up right away and a reboot doesnt fix it, you could try to push in recovery, or dump it in a cwm-flashable zip and flash it. Hope it works for ya!
Thank you. I figured I probably changed too many. I just opened notepad++ and find/replaced in files. I was looking through but was having a difficult time tracing what was needed and was not. How did you compile just like I posted earlier? And how did you get META-INF and not compressing resources?
Enlightened_Rogue said:
Thank you. I figured I probably changed too many. I just opened notepad++ and find/replaced in files. I was looking through but was having a difficult time tracing what was needed and was not. How did you compile just like I posted earlier? And how did you get META-INF and not compressing resources?
Click to expand...
Click to collapse
I was lazy and used one of the gui-ized apktool approaches (apkmultitool). It took care of keeping things in order. After recompiling, I opened the apk in jzip, pulled out the oggs in /res/raw, deleted them from the apk, then put them back in and set compression to store. It should be noted that you could go about things without dealing with any of this - just pull out the classes.dex from the apk, use baksmali to decompile and smali to recompile, and place new classes.dex into the apk.
I take it the apk worked for you then?
Yes it worked perfectly! Thank you. Instead of just getting what I want then not saying anything I was decompiling yours and seeing what needed to be changed. Hopefully soon I will be able to to much much more. Just a little time devotion patients and people like you to help. Thank you so much!

[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