Hello, I'm developing my first Xposed Module, and made a text that says if Module is active or not.
What I'm facing that the Xposed Module is enabled from the installed, but the Xposed Module itself not active, what i'm changing are drawble, and color from SystemUI .
Here's my Xposed Activity code :
So, what's the problem in my code ? why it's not active ?
HTML:
package com.abohani.xsystemui;
import android.content.res.XModuleResources;
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class XposedActivity {
public class CustomHeaderImage implements IXposedHookZygoteInit,IXposedHookInitPackageResources {
public String MODULE_PATH = null;
public static final String TAG = "xSystemUI";
public static final boolean DEBUG = false;
public final String PACKAGE_MODULE = XposedActivity.class.getPackage().getName();
public void log(String message) {
XposedBridge.log(TAG + ": " + message);
}
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
// module package
if (lpparam.packageName.equals(PACKAGE_MODULE)) {
try {
if (DEBUG) log("Hooking isModuleActive method");
XposedHelpers.findAndHookMethod(Settings.PlaceholderFragment.class.getName(),
lpparam.classLoader, "isModuleActive",
XC_MethodReplacement.returnConstant(Boolean.valueOf(true)));
} catch (Throwable t) {
XposedBridge.log(t);
}
}
}
[user=439709]@override[/user]
public void initZygote(StartupParam startupParam) throws Throwable {
String MODULE_PATH = startupParam.modulePath;
}
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.android.systemui"))
return;
if (resparam.packageName.equals("com.android.systemui")) {
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
XResources.setSystemWideReplacement("com.android.systemui", "drawable", "notification_header_bg", modRes.fwd(R.drawable.notification_header_bg));
XResources.setSystemWideReplacement("com.android.systemui", "color", "system_primary_color",
modRes.fwd(R.integer.color));
}
}
//
}
}
abo hani said:
Hello, I'm developing my first Xposed Module, and made a text that says if Module is active or not.
What I'm facing that the Xposed Module is enabled from the installed, but the Xposed Module itself not active, what i'm changing are drawble, and color from SystemUI .
Here's my Xposed Activity code :
So, what's the problem in my code ? why it's not active ?
HTML:
package com.abohani.xsystemui;
import android.content.res.XModuleResources;
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class XposedActivity {
public class CustomHeaderImage implements IXposedHookZygoteInit,IXposedHookInitPackageResources {
public String MODULE_PATH = null;
public static final String TAG = "xSystemUI";
public static final boolean DEBUG = false;
public final String PACKAGE_MODULE = XposedActivity.class.getPackage().getName();
public void log(String message) {
XposedBridge.log(TAG + ": " + message);
}
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
// module package
if (lpparam.packageName.equals(PACKAGE_MODULE)) {
try {
if (DEBUG) log("Hooking isModuleActive method");
XposedHelpers.findAndHookMethod(Settings.PlaceholderFragment.class.getName(),
lpparam.classLoader, "isModuleActive",
XC_MethodReplacement.returnConstant(Boolean.valueOf(true)));
} catch (Throwable t) {
XposedBridge.log(t);
}
}
}
[user=439709]@override[/user]
public void initZygote(StartupParam startupParam) throws Throwable {
String MODULE_PATH = startupParam.modulePath;
}
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.android.systemui"))
return;
if (resparam.packageName.equals("com.android.systemui")) {
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
XResources.setSystemWideReplacement("com.android.systemui", "drawable", "notification_header_bg", modRes.fwd(R.drawable.notification_header_bg));
XResources.setSystemWideReplacement("com.android.systemui", "color", "system_primary_color",
modRes.fwd(R.integer.color));
}
}
//
}
}
Click to expand...
Click to collapse
Does your xposed_init file (\assets folder) contain the correct class path (below)?
Code:
com.abohani.xsystemui.XposedActivity
Also you can hardcode ur package instead of playing with java:
PHP:
public static final String PACKAGE_MODULE = "com.abohani.xsystemui";
serajr said:
Does your xposed_init file (\assets folder) contain the correct class path (below)?
Code:
com.abohani.xsystemui.XposedActivity
Also you can hardcode ur package instead of playing with java:
PHP:
public static final String PACKAGE_MODULE = "com.abohani.xsystemui";
Click to expand...
Click to collapse
Yes, the xposed_init file contains the code you mentioned.
Sorry, I'm new and didn't know about that , edited .
If xposed_init is set correct, what left to be related to this problem ?
abo hani said:
Yes, the xposed_init file contains the code you mentioned.
Sorry, I'm new and didn't know about that , edited .
If xposed_init is set correct, what left to be related to this problem ?
Click to expand...
Click to collapse
That's a good question buddy! you can head onto my Blurred System UI (LP) module's source code and take a look at on its bowels!
serajr said:
That's a good question buddy! you can head onto my Blurred System UI (LP) module's source code and take a look at on its bowels!
Click to expand...
Click to collapse
Downloaded and compared, only difference that you are using hooks in different activities ( which i don't find it as a problem ) .
Download another Xposed Module sample, from Github, compared, nothing is different .
Gonna make a sample without Preference Screen, and feedback, maybe it's my problem from my MainActivity, not from my XposedActivity, right ?
serajr said:
That's a good question buddy! you can head onto my Blurred System UI (LP) module's source code and take a look at on its bowels!
Click to expand...
Click to collapse
Ok then, i've tried to make a sample, and shrinked my Xposed Code, but still the same, nothing changed, I've made a blank activity with Resource forwarding, so when it's enabled it will change the SystemUI header directly .
Here the code :
XposedActivity
HTML:
package com.abohani.xsystemui;
import android.content.res.XModuleResources;
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
public class XposedActivity implements IXposedHookZygoteInit,IXposedHookInitPackageResources{
public String MODULE_PATH = null;
public static final String TAG = "xSystemUI";
public void log(String message) {
XposedBridge.log(TAG + ": " + message);
}
[user=439709]@override[/user]
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.android.systemui")) {
return;
}
if (resparam.packageName.equals("com.android.systemui")) {
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
XResources.setSystemWideReplacement("com.android.systemui", "drawable", "notification_header_bg", modRes.fwd(R.drawable.notification_header_bg));
}
}
}
assets/xposed_init
com.abohani.xsystemui.XposedActivity
So, what's the problem ?
abo hani said:
Ok then, i've tried to make a sample, and shrinked my Xposed Code, but still the same, nothing changed, I've made a blank activity with Resource forwarding, so when it's enabled it will change the SystemUI header directly .
Here the code :
XposedActivity
HTML:
package com.abohani.xsystemui;
import android.content.res.XModuleResources;
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
public class XposedActivity implements IXposedHookZygoteInit,IXposedHookInitPackageResources{
public String MODULE_PATH = null;
public static final String TAG = "xSystemUI";
public void log(String message) {
XposedBridge.log(TAG + ": " + message);
}
[user=439709]@override[/user]
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.android.systemui")) {
return;
}
if (resparam.packageName.equals("com.android.systemui")) {
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
XResources.setSystemWideReplacement("com.android.systemui", "drawable", "notification_header_bg", modRes.fwd(R.drawable.notification_header_bg));
}
}
}
assets/xposed_init
com.abohani.xsystemui.XposedActivity
So, what's the problem ?
Click to expand...
Click to collapse
Bro... Attached you can find a fully working xposed module (Eclipse) just for that purpose (see the screenshot)!
Feel free to change it as much as you want/need.
Hope that helps you!!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Hello, I get the following exception in logcat
Code:
E/Xposed (10014): java.lang.NoSuchMethodError: com.android.keyguard.KeyguardSecurityContainer#updateSecurityView(android.view.View,java.lang.Boolean)#exact
and my code is
Code:
public class XposedMod implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) && (lpparam.packageName.contains("android.keyguard") || lpparam.packageName.contains("com.android.systemui")))
{
Class<?> KeyguardHostView = XposedHelpers.findClass("com.android.keyguard.KeyguardSecurityContainer", lpparam.classLoader);
findAndHookMethod(KeyguardHostView, "updateSecurityView", View.class, Boolean.class, mUpdateSecurityViewHook);
}
}
The method exists here https://github.com/android/platform.../keyguard/KeyguardSecurityContainer.java#L139
What should I do? Thanks for your help!
Code:
findAndHookMethod(KeyguardHostView, "updateSecurityView", View.class, boolean.class, mUpdateSecurityViewHook);
The primitive boolean was to be used instead of the boxed Boolean
Rijul.A said:
Hello, I get the following exception in logcat
Code:
E/Xposed (10014): java.lang.NoSuchMethodError: com.android.keyguard.KeyguardSecurityContainer#updateSecurityView(android.view.View,java.lang.Boolean)#exact
and my code is
Code:
public class XposedMod implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) && (lpparam.packageName.contains("android.keyguard") || lpparam.packageName.contains("com.android.systemui")))
{
Class<?> KeyguardHostView = XposedHelpers.findClass("com.android.keyguard.KeyguardSecurityContainer", lpparam.classLoader);
findAndHookMethod(KeyguardHostView, "updateSecurityView", View.class, Boolean.class, mUpdateSecurityViewHook);
}
}
The method exists here https://github.com/android/platform.../keyguard/KeyguardSecurityContainer.java#L139
What should I do? Thanks for your help!
Click to expand...
Click to collapse
Make class and paste this content
PHP:
import java.lang.reflect.Method;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
public class XposedWrapper {
public static XC_MethodHook.Unhook hookMethod(Class<?> sClass,String method_Name,Object... parameterTypesAndCallback) {
Method method = XposedHelpers.findMethodBestMatch(sClass,method_Name,removeCallback(parameterTypesAndCallback));
XC_MethodHook callback = (XC_MethodHook) parameterTypesAndCallback[parameterTypesAndCallback.length-1];
return XposedBridge.hookMethod(method,callback);
}
private static Object[] removeCallback(Object... args) {
Object[] list = new Object[args.length-1];
for (int i = 0 ; i < args.length ; i++) {
if (!(args[i] instanceof XC_MethodHook)) {
list[i] = args[i];
}
}
return list;
}
}
Now in the xposed class
do like this
PHP:
XposedWrapper.hookMethod(KeyguardHostView, "updateSecurityView", View.class, Boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("Hooked");
}
});
Hello!
I'm trying to make Xposed module from this patch: https://github.com/CyanogenMod/android_frameworks_base/commit/19e458f4a26fe7c8b6419cadba81a0c46dc79dad
My code looks like this:
Code:
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals(PACKAGE_NAME))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
mFakeIdScrimview = resparam.res.addResource(modRes, R.id.scrimview);
mFakeIdVisView = resparam.res.addResource(modRes, R.id.visualizerview);
}
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals(PACKAGE_NAME))
return;
findAndHookMethod("com.android.systemui.statusbar.phone.PhoneStatusBar", lpparam.classLoader,
"makeStatusBarView", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
FrameLayout lStatusBarWindow = (FrameLayout) XposedHelpers.getObjectField(param.thisObject, "mStatusBarWindow");
FrameLayout scrimView = (FrameLayout) lStatusBarWindow.findViewById(mFakeIdScrimview);
if (scrimView != null) {
mVisualizerView = (VisualizerView) scrimView.findViewById(mFakeIdVisView);
} else {
XposedBridge.log("scrimView = null !!!!");
}
if (mVisualizerView != null){
mVisualizerView.setKeyguardMonitor(mKeyguardMonitor);
} else {
XposedBridge.log("mVisualizerView = null !!!!! ");
}
}
});
The problem is that scrimView is always null and I can't get this piece of code working.
Anybody has any idea?
Untested, but could you try to replace your scrimView assignment line with this
Code:
FrameLayout scrimView = (FrameLayout) XposedHelpers.callMethod(lStatusBarWindow, "findViewById", mFakeIdScrimview);
Rijul.A said:
Untested, but could you try to replace your scrimView assignment line with this
Code:
FrameLayout scrimView = (FrameLayout) XposedHelpers.callMethod(lStatusBarWindow, "findViewById", mFakeIdScrimview);
Click to expand...
Click to collapse
Unfortunately scrimView is still null.
How can you guys capture long press notification?
I found this method on SystemUI:
Code:
Code:
protected SwipeHelper.LongPressListener getNotificatioLongnClicker() {
return new SwipeHelper.LongPressListener() {
[user=439709]@override[/user]
public boolean onLongPress(View v, int x, int y) {...
But I can't do afterHookedMethod or beforeHookedMethod.
Code:
Code:
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.BaseStatusBar", lpparam.classLoader, "getNotificationLongClicker", new XC_MethodHook() {
[user=439709]@override[/user]
protected void afterHookedMethod (MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
return new View.OnLongClickListener() {
[user=439709]@override[/user]
public boolean onLongClick(final View v) {
XposedBridge.log("long press notification action");
return true;
}
}
});
}
}
}
How I can call the method from another class "SwipeHelper" and access "LongPressListener" public interface and "onLongPress" method which return boolean value?
I tried with object and method "View.OnLongClickListener" without success. Anyway, if I can't do it there is another way because I see system long press notification working on xNotification module.
PS.: I'm noobie: http://stackoverflow.com/questions/3...ing-xposed-mod
@pixeltech.dev
lukakas said:
How can you guys capture long press notification?
I found this method on SystemUI:
Code:
Code:
protected SwipeHelper.LongPressListener getNotificatioLongnClicker() {
return new SwipeHelper.LongPressListener() {
[user=439709]@override[/user]
public boolean onLongPress(View v, int x, int y) {...
But I can't do afterHookedMethod or beforeHookedMethod.
Code:
Code:
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.BaseStatusBar", lpparam.classLoader, "getNotificationLongClicker", new XC_MethodHook() {
[user=439709]@override[/user]
protected void afterHookedMethod (MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
return new View.OnLongClickListener() {
[user=439709]@override[/user]
public boolean onLongClick(final View v) {
XposedBridge.log("long press notification action");
return true;
}
}
});
}
}
}
How I can call the method from another class "SwipeHelper" and access "LongPressListener" public interface and "onLongPress" method which return boolean value?
I tried with object and method "View.OnLongClickListener" without success. Anyway, if I can't do it there is another way because I see system long press notification working on xNotification module.
PS.: I'm noobie: http://stackoverflow.com/questions/3...ing-xposed-mod
@pixeltech.dev
Click to expand...
Click to collapse
Hi, View.OnLongClickListener is not a method, it's an interface. Basically what you need to do is get the method result in your hook (it would be either SwipeHelper or OnClickListener based on your Andorid version) and use it based on its methods and your needs
pixeltech.dev said:
Hi, View.OnLongClickListener is not a method, it's an interface. Basically what you need to do is get the method result in your hook (it would be either SwipeHelper or OnClickListener based on your Andorid version) and use it based on its methods and your needs
Click to expand...
Click to collapse
I tried to do this without success:
Code:
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.SwipeHelper$LongPressListener", lpparam.classLoader, "onLongPress",View.class, Integer.TYPE, Integer.TYPE, new XC_MethodHook() {
@Override
protected void afterHookedMethod (MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
XposedBridge.log("long press notification action");
}
});
}
}
Logcat:
Code:
05-30 22:35:13.580 18201-18201/com.android.systemui E/Xposed: java.lang.IllegalArgumentException: Cannot hook interfaces: public abstract boolean com.android.systemui.SwipeHelper$LongPressListener.onLongPress(android.view.View,int,int)
Hello,
Iam working on a XposedModule and I need to get a variable from an other class. I have access to this class and I can access the global variables from this class but I can not access a variable which is only available in a method.
using:
Code:
Class<?> ProfileInfoClass = XposedHelpers.findClass("com.hi",lpparam.classLoader);
XposedBridge.hookAllMethods(ProfileInfoClass,"hie",new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
String s = (String)XposedHelpers.getObjectField(param.thisObject,"hello2"); //not found
}
});
with this class:
Code:
public class hi(){
String hello = "hello"; //This variable I can get
public void hie(){
String hello2 = "hi"; //This Variable I can not get using XposedHelpers.getObjectField(param.thisObject,"hello2");
}
}
Is there an other way to access variables inner Mehtods?
Thanks. Jojii
Nope, you can't.