sky201503 / android-apktool2

Automatically exported from code.google.com/p/android-apktool
0 stars 0 forks source link

feature request for automated remapping of resource id in smali files. #133

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
so the problem I'm trying to solve with this is to replace the apps
that come with proprietary ROM's with apps from the SDK or other OEM's
what have you. usually all the resources are in framework-res.apk
just the id's have changed and I find myself with 3 instances of
notepad++ remapping the resource id's to the target ROM by copy and
pasting id's in one search box too get the resource name then pasting
the resource name into another search box the get the resource id on 
the target ROM to then finely paste that id back into the smail file

so today I prototyped some code to remap the resource id's and thought 
that it would make a great addition to apktool. how it works is you
pass it the source public.xml the target public.xml and the smali file
you wish to "port" to the target device and it does all the work and
writes out the file with the remapped resource id's.

I have attached the java source for your consideration.

Original issue reported on code.google.com by AdamRosa...@gmail.com on 6 Feb 2011 at 4:30

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by AdamRosa...@gmail.com on 6 Feb 2011 at 5:32

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm... interesting. Thanks :-)

I have some ideas that requires me to remap resIds, but smali files are the 
worst - I'm afraid simple pattern matching isn't reliable enough. First, you 
may remap normal literal by accident. Second, you may miss some true resIds. 
Actually, I can already say you that you miss some of them for sure, because 
literals ending with 0x0000 are set using const/high16, not const. And every 
apk has at least few of such resources. Worst thing is: you will never know 
that modified apk is screwed up, it will run and look normally, but some of its 
functionalities may fail or work differently. 

Ahh and you should group resources by type-name pair, not just name. There may 
be @string/foo, @integer/foo, @bool/foo, @id/foo, etc. - each one with 
different resId.

Original comment by Brut.alll on 3 May 2011 at 4:04

GoogleCodeExporter commented 9 years ago
I have done a little more work on this since I made the feature request,
and have added alerting the user if a possible short resource id is encountered
and support for resource arrays, the new version also adds a comment to the 
modified
line for later review if a problem is encountered, good point about the 
value/type
issue and I have attached an updated version that takes data type in to account.

Original comment by AdamRosa...@gmail.com on 4 May 2011 at 5:40

Attachments: