Post Reply

[Q] Inject Meta-Data from Manifest possible?

25th August 2014, 05:16 AM   |  #1  
OP Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Feb 2011
I'm trying to use Google Play Services APIs in a hooked method, but Google Play Services complains that I'm missing its version specification in the applications manifest, which makes sense since the application of which I hook the method doesn't integrate Google Play Services so its missing the meta-data tag from the manifest. Is there a way to inject the following meta-data into the hooked method's application process?

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

Or any alternative approach? Sorry if this has come up before, I'm a noob and I tried searching but didnt come up with anything.
25th August 2014, 03:40 PM   |  #2  
theknut's Avatar
Senior Member
Thanks Meter: 3,134
 
842 posts
Join Date:Joined: May 2009
Donate to Me
More
As far as I know thats not possible.
You can try to hook the PackageManager and change the returned data to fool the check which is made. Not sure about other side effects, though.
27th August 2014, 02:05 PM   |  #3  
OP Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Feb 2011
Quote:
Originally Posted by theknut

You can try to hook the PackageManager and change the returned data to fool the check which is made. Not sure about other side effects, though.

Thanks for the suggestion! I tried hooking the method from PackageManager, but I must be missing something as I cant hook it and there is no error in the xposed log.

I wrote a quick test app com.example.overridetest which uses this code to get some meta-data from the manifest, which works fine:
Code:
localApplicationInfo = getPackageManager().getApplicationInfo("com.example.overridetest", 128);
Bundle localBundle = localApplicationInfo.metaData;
localBundle.getInt("com.google.android.gms.version");
Log.w("myApp", "metadata is "+i);

now im trying to hook getApplicationInfo in order to overwrite what it returns, however Im not able to hook it and theres no error in the xposed log either:
Code:
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
    	
if (!lpparam.packageName.equals("com.example.overridetest"))
 return;

XposedHelpers.findAndHookMethod("android.content.pm.PackageManager", lpparam.classLoader, "getApplicationInfo", String.class, int.class, new XC_MethodHook() {
		@Override 
		protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
			XposedBridge.log("getApplicationInfo Hooked");
		}
});
29th August 2014, 02:03 PM   |  #4  
Jarmezrocks's Avatar
Senior Member
Flag Gold Coast
Thanks Meter: 456
 
929 posts
Join Date:Joined: Mar 2011
Donate to Me
More
Subbed!

This sounds interesting
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes


Top Threads in Xposed General by ThreadRank