Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,752 Members 39,434 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Inject Meta-Data from Manifest possible?

Tip us?
 
nefior
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Feb 2011
Default [Q] Inject Meta-Data from Manifest possible?

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.
 
theknut
Old
#2  
theknut's Avatar
Senior Member
Thanks Meter 3,111
Posts: 834
Join Date: May 2009

 
DONATE TO ME
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.
[MOD][XPOSED] Xposed GEL Settings - Customize your Google Now Launcher
[MOD][XPOSED] Suggestions Toggle - Quickly toggle keyboard suggestions on/off
[MOD][XPOSED] No Wireless Charging Sound - Disables the "Wireless charging started" sound
 
nefior
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Feb 2011
Quote:
Originally Posted by theknut View Post
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");
		}
});
 
Jarmezrocks
Old
#4  
Jarmezrocks's Avatar
Senior Member
Thanks Meter 452
Posts: 925
Join Date: Mar 2011
Location: Gold Coast

 
DONATE TO ME
Subbed!

This sounds interesting
"Hey! What is this?" \_(ツ)_/

help find a cure for Narcolepsy
donations to this cause do not come directly to me, they are
anonymous but please tell me so I can give you thanks
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes