[Q] Replacing an XML resource of a package - Xposed Framework Development

Hi guys.
I'm trying to do something really simple - replace the file res/xml/rowkeys_qwerty1.xml of the Google Keyboard app (com.android.inputmethod.latin) with an altered one using an xposed module.
I did this:
1. I altered the XML file and put it under res/xml of my module project.
2. I created a class that implements IXposedHookZygoteInit, IXposedHookInitPackageResources with the following code:
Code:
resparam.res.setReplacement("com.google.android.inputmethod.latin", "xml", "rowkeys_qwerty1", modRes.fwd(R.xml.rowkeys_qwerty1));
The problem is - "R.xml" doesn't know what rowkeys_qwerty1 is.
Furthermore, the content of the altered XML file is:
Code:
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Key latin:keySpec="A" />
</merge>
And when I try to build the project I get the message:
Code:
error: No resource identifier found for attribute 'keySpec' in package 'com.android.inputmethod.latin'
I guess I'm doing something wrong. Can anyone point me in the right direction to fix this?
Again, all I really want to do is make sure the Google Keyboard apps loads my altered XML (that I'm including in my module resources) instead of the one that's built into the app's apk.
Thanks!

Anyone?...

Add a superlint for keySpec: app will be compiled without error
Wysłane z mojego ALE-L21 przy użyciu Tapatalka

Related

[APP]reg/rgu-2-provxml translator v3!!!

Hi all, for who knows my rgu-2-xml, there is a new version solved little bug translating multilines hex values (in previous release only a part of a intere hex string was inserted into provxml!)
for who doesn't know my little apps, this app can translate rgu/reg files into provxml files, advantages???
you can insert into packages also provxml, so you can be shure that the instrunctions on it will be executed and not maybe overwritted by similiar registry keys when .hv files are created during buildosing rom!
or if you want create instructions into provxml for my sdconfig.exe or sdautorun.exe
bye!!!
version 3, added some code to "eliminate" regkey and regvalue!!!!!
here:
http://www.4shared.com/file/nDAeeIdB/rgu-2-xml-v3.html
Thanks again ervius.
Thanks ervius !
Will be more usefull than creating a cab and extracting xml inside it
Thanks! again ervius. Your kitchen and tools are really useful for us.
Best regards from Spanish Cookers
Thank you so much!! Keep it up!
XML => RGU
Ervius, can you make the same tool but XML => RGU ?
MickyMax said:
Ervius, can you make the same tool but XML => RGU ?
Click to expand...
Click to collapse
yes, but in provxml, there are also other commands that work with files and folders,(fileoperation), and others also....
if you translate a provxml into a reg/rgu, you can lost a lot of informations, but, yes, shurelly, I can create a viceversa translator (xml-rgu)!
bye!
If you can figure out how to put a multi line item into an XML I would appreciate it. I haven't been able to yet. I even tried the output from your tool and it didn't work. I even put " instead of " but that didn't work either.
Basically, a certain reg key needs to be a multistring (multi line, multi_SZ) with the following data: (line breaks are intentional, it must be placed in the registry like that)
Code:
Call History.lnk
Messaging.lnk
Calculator.lnk
Any ideas?
Thanks for the tool!
It works great at making XMLs for UC, but I had to fix some things in my XML:
-Quotation marks needed to be changed to " for certain entries like Today items
-0xFFFFFFFE hex values showed up as 4294967295 dec value, but that dec value is unsigned and it will not load when the XML installs so I had to use "-2" as my dec value (which gave me my correct hex value of FFFFFFFE)
-Binary values had to be manually translated with RapiConfig
I was pretty stumped when my XML didn't install properly but after isolating these minor mistakes I was able to fix my problem. Hope this helps any other users!
Cheers
mrnamster said:
Thanks for the tool!
It works great at making XMLs for UC, but I had to fix some things in my XML:
-Quotation marks needed to be changed to " for certain entries like Today items
-0xFFFFFFFE hex values showed up as 4294967295 dec value, but that dec value is unsigned and it will not load when the XML installs so I had to use "-2" as my dec value (which gave me my correct hex value of FFFFFFFE)
-Binary values had to be manually translated with RapiConfig
I was pretty stumped when my XML didn't install properly but after isolating these minor mistakes I was able to fix my problem. Hope this helps any other users!
Cheers
Click to expand...
Click to collapse
well, I'll try to solve.... never tryed with negative values...
try this v3 version if works...
Signed/unsigned integer conversion seems to work:
Code:
REGEDIT4
[HKEY_LOCAL_MACHINE\this\is\a\"quotation"\test]
"item1"=dword:7fffffff
"item2"=dword:80000000
"item3"=dword:fffffffe
"item4"=dword:ffffffff
results in:
Code:
<wap-provisioningdoc>
<!-- *** COMMENTO *** -->
<characteristic type="Registry">
<characteristic type="HKLM\this\is\a\"quotation"\test" translation="filesystem">
<parm name="item1" datatype="integer" value="2147483647"/>
<parm name="item2" datatype="integer" value="-2147483648"/>
<parm name="item3" datatype="integer" value="-2"/>
<parm name="item4" datatype="integer" value="-1"/>
</characteristic>
</characteristic>
</wap-provisioningdoc>
but should be
Code:
<characteristic type="HKLM\this\is\a\"quotation"\test" translation="filesystem">
as mentioned here at the bottom by Sleuth255
thx for your work
Greate tool!
But there are unhandled situation:
1, for [HKEY_LOCAL_MACHINE\xxx\yyy]
it means to REMOVE the key HKEY_LOCAL_MACHINE\xxx\yyy
in provxml, it should be <nocharacteristic type="HKLM\xxx\yyy" translation="filesystem" />
2, for "name"=-
it means to DELETE the item "name"
in provxml, it should be <noparm name="name" />
How are you guys converting binary values in the reg to provxml. I know its base64 in provxml.. Can someone give me a hand with this?
I have noticed this program does not take @="value" and convert it to "Default"="value"
My current fix is to use find and replace in reg file and change @ to "Default" before running rgu-2-xml.
Also ""\file path\file name"" is still getting turned into \\file path\file name\".
After I run rgu-2-xml I use find and replace in the xml file to change all \\ to "\ and all \" to "".
Hi!
I am a newbie in all these subjects, and I am attempting to make my own provxml file for UC.
he case is that I've found this thread and now I have a tool to convert reg/rgu files to XML, but ... when I export my registry I get a rgk file, that the tool doesn't admit ...
How should I export the registry to get reg/rgu files?
thanks!
elMoco said:
when I export my registry I get a rgk file, that the tool doesn't admit ...
How should I export the registry to get reg/rgu files?
thanks!
Click to expand...
Click to collapse
what did you use to export?
Did you try edt file name to end in .reg?
RoryB said:
what did you use to export?
Did you try edt file name to end in .reg?
Click to expand...
Click to collapse
I use the windows registry backup tool, and yes, I've tried to change the file extension, but the the tool report an error.
I use CERegedit and save as a .reg file.
Great!
I used CERegedit and I got it ...
now I need a tool that can mannage well the binary data ... I guess it must be codified with base64 ...

Questions About spn-conf.xml and Framework-res.apk, I'm Totally Frustrated....

Hi guys... I have couple questions and I'm totally frustrated because of them...
About spn-conf.xml:
I've examed every possible way to modify the file.. as author HTC Shawn Ku said:
Code:
<spnOverrides
numeric="MCC+MNC"
spn="SPN Name"/>
so I modify the file and it looks like following now:
Code:
<?xml version="1.0" encoding="utf-8"?>
<spnOverrides>
<spnOverride
numeric="46000" <!--chinese spn code-->
spn="Yanzi"/>
</spnOverrides>
I tried but did not work at all..
so I tried to delete tags <spnOverrides> and </spnOverrides>, or
Code:
<spnOverrides
numeric="46000" <!--chinese spn code-->
spn="Yanzi"/>
but they did not work at all...
So how can I modify the spn name?
About Framework-res.apk (from MoDaCo r3.1):
I want to modify framework-res.apk and I read a lot of posts talking about it.. However, I still do not know why every time after I flashed a modified framework-res.apk, my desire storage reduced 10mb-20mb.. right now only 30mb remains...
Also, when I use APKTool 1.3.1 to decompile and recompile immediately, the 2.7mb apk turned into 5.0mb... get bigger! That's weired...

[T-Mobile Theme Chooser] App-Icon List

Hello themers,
here is a list of "app icon paths" (sorry i can't explain it better with school english).
What i mean with "app icon paths":
You create a theme for CM/AOKP/etc. and you want to change an app's icon.
Then you need the string from where the app gets the icon graphic (and the Package (e.g. com.example.pictures))
And this is a list with "App Name, Package, Icon Path".
Sry for my bad english, i hope it's in the right section [and i hope i can help you]
(moved to Google Docs)
Link to google docs:
http://tslink.tk/iconpaths-applist
Click to expand...
Click to collapse
How to use it?
Create a new XML file at res/xml/ and name it like the package, but replace "." with "_", e.g.
Code:
com.google.googlesearch => com_google_googlesearch.xml
com.foo.bar => com_foo_bar.xml
Insert the following code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resource-redirections>
</resource-redirections>
Now add redirections between "<resource-redirections>" and "</resource-redirections>" like this:
Code:
<item name="(Icon Path)">(Location of new Icon)</item>
Complete Code (Example):
Code:
<?xml version="1.0" encoding="utf-8"?>
<resource-redirections>
<item name="mipmap/ic_launcher">@mipmap/new_icon</item>
</resource-redirections>
Cheers, Xorg.

roomservice.xml for Nexus 5 (bullhead)?

hi, i'm requesting devs who build cm 13 for bullhead to kindly share their roomservice.xml. i'm trying to build cm from source and the system generated roomservice.xml is as follows:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_lge_bullhead" path="device/lge/bullhead" remote="github" />
<project name="CyanogenMod/android_kernel_lge_bullhead" path="kernel/lge/bullhead" remote="github" />
</manifest>
i think this does not contain bolbs, which are also required for building from source. i tried building without them and i get the following error:
Code:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/home/gururoop/android/cm13/out/target/product/bullhead/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/LINKED/libsurfaceflinger.so] Error 1
make: Leaving directory `/home/gururoop/android/cm13'
Can anyone help me with these errors?
gururoop said:
hi, i'm requesting devs who build cm 13 for bullhead to kindly share their roomservice.xml. i'm trying to build cm from source and the system generated roomservice.xml is as follows:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_lge_bullhead" path="device/lge/bullhead" remote="github" />
<project name="CyanogenMod/android_kernel_lge_bullhead" path="kernel/lge/bullhead" remote="github" />
</manifest>
i think this does not contain bolbs, which are also required for building from source. i tried building without them and i get the following error:
Code:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/home/gururoop/android/cm13/out/target/product/bullhead/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/LINKED/libsurfaceflinger.so] Error 1
make: Leaving directory `/home/gururoop/android/cm13'
Can anyone help me with these errors?
Click to expand...
Click to collapse
Vendor files? https://github.com/TheMuppets/proprietary_vendor_lge/tree/cm-13.0
I know the vendor stuff is different from everything else I've used/built for and I only had to "brunch bullhead" to build a different rom I tried.
Keithn said:
Vendor files? https://github.com/TheMuppets/proprietary_vendor_lge/tree/cm-13.0
I know the vendor stuff is different from everything else I've used/built for and I only had to "brunch bullhead" to build a different rom I tried.
Click to expand...
Click to collapse
did you extract blobs using extract-files.sh script? can you please share the roomservice.xml of the ROM that built successfully and booted?
gururoop said:
did you extract blobs using extract-files.sh script? can you please share the roomservice.xml of the ROM that built successfully and booted?
Click to expand...
Click to collapse
Nope I never had to do it that way and I usually just add the vendor files from the muppets git (linked above) instead.
What commands are you using to build?
Try just using ". build/envsetup.sh" then use "brunch bullhead". Downloaded everything I needed to build omni last I tried. My server/PC I use for building isn't connected or running right now so I can't directly pull the XML I used. I probably could later though.
Another thing is that you can add your own XML into the local manifests to sync files so you don't have to touch the room service.XML. Here is one I was using for an example https://github.com/Keith-N/local_manifests/blob/master/local_manifests.xml
Keithn said:
Nope I never had to do it that way and I usually just add the vendor files from the muppets git (linked above) instead.
What commands are you using to build?
Try just using ". build/envsetup.sh" then use "brunch bullhead". Downloaded everything I needed to build omni last I tried. My server/PC I use for building isn't connected or running right now so I can't directly pull the XML I used. I probably could later though.
Another thing is that you can add your own XML into the local manifests to sync files so you don't have to touch the room service.XML. Here is one I was using for an example https://github.com/Keith-N/local_manifests/blob/master/local_manifests.xml
Click to expand...
Click to collapse
I would really appreciate if you could share your roomservice.xml whenever possible. I did try to give commands as per your post and got the error mentioned in the OP. I'm trying to start with building CM and expand the base if I succeed.
I tried it out and it's missing the vendor files. You'll notice no vendor/lge in your cm13 directory. The way I talked about in the previous post will work. You need to get those vendor files. I could give you my roomservice.xml but it shouldn't look any different because I never touched it. I used an addition xml to add aditional files which is why my roomservice.xml was never changed. The easy way is to add this line into whatever xml you are planning on using to sync the files.
Code:
<project name="TheMuppets/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="cm-13.0" />
It grabs the files from https://github.com/TheMuppets/proprietary_vendor_lge and syncs them into vendor/lge
If you have troubles then let me know, but that is all I needed to do.

Replacing Facebook Messenger resources

I am trying to change the emojies inside of Facebook Messenger by the ones from EmojiOne.
In the first place, I decompiled through dex2jar the messenger APK and did quite a bit of search but no luck, it is obfuscated and pretty hard to read.
So my second guess was to replace each emoji in the resources. To do that, I used aapt to get one and try it:
HTML:
> aapt dump resources msg.apk | grep 1f60f
resource 0x7f020eca com.facebook.orca:drawable/messenger_emoji_1f60f_32: t=0x03 d=0x000017b3 (s=0x0008 r=0x00)
resource 0x7f020ecb com.facebook.orca:drawable/messenger_emoji_1f60f_64: t=0x03 d=0x000017b2 (s=0x0008 r=0x00)
resource 0x7f0c2086 com.facebook.orca:string/emoji_1f60f: t=0x03 d=0x00003439 (s=0x0008 r=0x00)
I tried this :
HTML:
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.facebook.orca"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.facebook.orca", "drawable", "messenger_emoji_1f60f_32", modRes.fwd(R.drawable.emojione_emoji_1f60f_32));
resparam.res.setReplacement("com.facebook.orca", "drawable", "messenger_emoji_1f60f_64", modRes.fwd(R.drawable.emojione_emoji_1f60f_64));
}
and quite a few other things, but nothing seems to work. My drawable is working since I tried it in an Activity.
Even though I can get this working, would this be a proper solution to my original problem ?
Will I need to replace EACH emoji one by one in the two sizes ?
Thanks in advance
Bump please, no one?
Up for this thanks
This doesn't solve your problem, but I recently decompiled a proguarded apk too, and couldn't find the right resources easily. I found a method too do so though.
First, install xinstaller, then under misc enable debugging apps (allows debugging any app).
Next, connect your phone, make sure adb is on and connected, open Facebook and go to a conversation. Send some emoji too.
In Android studio, go into Android device monitor (ddms), tools -> Android -> Android device monitor. MAKE SURE YOU SET DDMS UP first
Now, find the button in the toolbar that says something like ui automator dump . This will take a layout dump of your displayed screen and give you a screenshot that you can use to click on various layout objects. You will be able to select the emoji and see what resource id is associated with it.
Or at least, it will give you a method to start looking for the resource id's. Combined with a tool like grep for windows, checking out public.xml for the ID's (they're in hex, but if you want to search in code for the ID, convert it to decimal). And you can pretty much find where the code and resource ID's are now !

Categories

Resources