[Q] Problem: Xposed hook OpenGL ES ? - Xposed General

I'm trying to hook GLES API with Xposed. But met some problems. Xposed can work well when i use it for some other things except the GLES API.
The module:
...
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (lpparam.packageName.equals("android"))
{
XposedBridge.log("Mark !");
findAndHookMethod("android.opengl.GLES20", lpparam.classLoader, "glFinish", new XC_MethodHook() {
@override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("glFinish GLES20");
}
@override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("glFinish GLES20");
}
});
}
...​
And i wrote an app with some glFinish() calls in it. When i run the app, i can't get "glFinish GLES20" at the log file.
I can get "Mark !", and no error in the log file.
Can any one help me? Thanks!

Related

[Q] Hook android.util.Log methods

Hi, I followed the tutorial on github and tried to hook android.util.Log.i(String tag, String msg) method, but I always get a ClassNotFoundError.
I don't know what I did wrong, my code seems so simple.
Edit: I found the solution. The code below works correctly, the problem was in another part of my code.
Here is the code:
Code:
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable
{
XposedBridge.log("Package name: " + lpparam.packageName);
try
{
findAndHookMethod("android.util.Log", lpparam.classLoader, "i", String.class, String.class, new XC_MethodHook()
{
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable
{
//do something before
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable
{
//do something after
}
});
}
catch (XposedHelpers.ClassNotFoundError e)
{
XposedBridge.log("ClassNotFoundError");
}
catch (NoSuchMethodError e)
{
XposedBridge.log("NoSuchMethodError");
}
}
}
}

How to hook static method

I want to modify some static field in android.os.Build, such as android.os.Build.BOARD, android.os.Build.DEVICE, android.os.Build.DISPLAY.
Then I tried to hook the static method 'getString(String s)' in android.os.Build .
Code:
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
XposedBridge.log(loadPackageParam.packageName + " -> load ");
Class build = XposedHelpers.findClass(Build.class.getName(), loadPackageParam.classLoader);
XposedHelpers.findAndHookMethod(build, "getString", String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("before ->" + param.args[0]);
super.beforeHookedMethod(param);
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("after ->" + param.args[0]);
super.afterHookedMethod(param);
}
});
I wrote
Code:
txvTxt = (TextView) findViewById(R.id.txvTxt);
txvTxt.setText(Build.DISPLAY);
in my activity, I could not see any before or after hook message.
Waiting online for any solution. 3Q

[Q] Hooking to nfc tranceive methods doesn't work

I'am trying to create an Xposed module which hooks into the tranceive methods of nfc to find out what is transfered. But sadly the hook doesn't seam to work. I've created a sample app which sends data over the tranceive method but the logs are not written. Here is my code:
Code:
if (!lpparam.packageName.equals("android"))
return;
findAndHookMethod("android.nfc.tech.BasicTagTechnology", lpparam.classLoader, "transceive", "byte[]", "boolean", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("before");
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("after");
}
});
I've also tried to hook into the service, but no logs either:
Code:
if (!lpparam.packageName.equals("com.android.nfc"))
return;
findAndHookMethod("com.android.nfc.NfcService", lpparam.classLoader, "doTransceiveNoLock", "int", "byte[]", new XC_MethodHook() {
.....
Am I doing something wrong or is it simply not possible to hook into these methods?
I found a solution for my problem. I have to hook the transceive method of com.android.nfc.NfcService$TagService to get access to every tag transmission.

Disabling notifications from other apps using Xposed

I'm trying to create an app that allows the user to disable notifications from other apps.
I have been through the Xposed module development tutorial and it is my understanding that I should be able to hook onto some sort of notification method using Xposed in order to inject code either before or after the method call that should let me stop the notification from displaying on the phone.
I have been through the grepcode link from the tutorial and identified the "notify" method which should be useful and have written the following code:
Code:
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Handling package: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.app"))
return;
XposedHelpers.findAndHookMethod("com.android.app.NotificationManager", lpparam.classLoader, "notify", String.class, int.class, Notification.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("before params: "+ param.args[0] + ", " + param.args[1].toString());
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("after params: "+ param.args[0] + ", " + param.args[1].toString());
}
});
}
However this doesn't display anything when I receive notifications from for instance the facebook messenger app.
Am I approaching this the correct way?

Hooking a method with a custom class array as argument

The code:
Code:
updateNotifications([Lcom/samsung/android/uniform/widget/notification/NotificationItem;)V
As you can see, I need an array of "NotificationItem"
But when I do this:
Code:
XposedHelpers.findAndHookMethod(NotiContainer, "updateNotifications", NotiItem[].class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});
I get "unknown class NotiItem"
so yeah.. kinda confused.
I tried this too:
Code:
XposedHelpers.findAndHookMethod(NotiContainer, "updateNotifications", "[com.samsung.android.uniform.widget.notification.NotificationItem", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});
But I get "ClassNotFound Exception: Invalid Name"
How the heck can I do this...
Solved using "com.samsung.android.uniform.widget.notification.NotificationItem[]" instead of "[com.samsung.android.uniform.widget.notification.NotificationItem" as the class name.

Categories

Resources