rovo89 / XposedBridge

The Java part of the Xposed framework.
3.91k stars 1.1k forks source link

Cannot Get into a Package #54

Closed StevenStanleyBayes closed 9 years ago

StevenStanleyBayes commented 9 years ago

I think and I may be wrong, XposedBridge cannot get into a package. I use exactly the same code for com.android.systemui and for android.hardware. When I test with sytemui, everything is OK and I get the message which I write into the log. When I try with android.hardware as well as many other packages, no message is displayed, which means the code does not get to the point I write into the log.

A successful write into the log, as with systemui, writes the string in th e XposedBridge.log into error.log and not into debug.log but the real issue is why systemui can be loaded while hardware, sensor, sensormanager and others cannot. I find these packages in https://android.googlesource.com

Here is the standard code until the log write :

public class ProximitySensorXposed implements IXposedHookLoadPackage {

public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {

    if (!lpparam.packageName.equals("android.hardware")) return;

    XposedBridge.log("NOW IN THE PACKAGE, IMMEDIATELY AFTER THE PACKAGE HAS BEEN LOADED. ");
rovo89 commented 9 years ago

"package" is ambigous. What's meant here is the Android package name, i.e. the technical name of an app that you find in its AndroidManifest.xml. Not to be confused with Java packages, which can have the same name sometimes, but not always.

It seems that you want to hook into system services, which aren't really an app. However, you can check for the dummy package name "android" and then you should be able to place your hooks there.

StevenStanleyBayes commented 9 years ago

Thanks. I learned this the hard way : the hole night no sleep just trying to hook functions. Some packages which were accessible because of the same name said there was no such a method although there was as per the documentation. Maybe the documentation is also for their manifest package names and not for their real ones and the names matched but not the content, not 100%. I have sent a request to programming4ife on Skype. Still waiting for a reply. Will check again.