Can't change navigation bar buttons icons with my Xposed module - Xposed Framework Development

Hello friends!
I"m trying to build xposed module for educational purposes.
I want the module to:
1. Change the navigation bar color to green - this one works OK.
2. Change the navigation bar icons to custom icons i provide from my drawable resources - this one partially works, as described below.
The "home" button is changed, but the "recent apps" and "back" buttons didn't. Please see picture attached.
Can some one tell me why i can change the "home" button but not the "recent apps" and "back" buttons?
Any suggestion how to fix this?
module code:
Code:
import android.content.Context;
import android.content.res.XModuleResources;
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.InitPackageResourcesParam;
import de.robv.android.xposed.callbacks.XC_LayoutInflated;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class TweakNavigationBar implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.android.systemui"))
return;
resparam.res.hookLayout("com.android.systemui", "layout", "navigation_bar", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, liparam.res);
LinearLayout NavigationButtonsLayout = (LinearLayout) liparam.view.findViewById(
liparam.res.getIdentifier("nav_buttons", "id", "com.android.systemui"));
NavigationButtonsLayout.setBackgroundColor(Color.GREEN);
Context mContext = NavigationButtonsLayout.getContext();
ImageView backButton = (ImageView) liparam.view.findViewById(liparam.res.getIdentifier("back", "id", "com.android.systemui"));
ImageView homeButton = (ImageView) liparam.view.findViewById(liparam.res.getIdentifier("home", "id", "com.android.systemui"));
ImageView recentButton = (ImageView) liparam.view.findViewById(liparam.res.getIdentifier("recent_apps", "id", "com.android.systemui"));
//this also didn't work
//ImageView backButton = (ImageView) NavigationButtonsLayout.getChildAt(2);
//ImageView homeButton = (ImageView) NavigationButtonsLayout.getChildAt(3);
//ImageView recentButton = (ImageView) NavigationButtonsLayout.getChildAt(4);
recentButton.setImageDrawable(modRes.getDrawable(R.drawable.blue_button,null)); // didn't work!
homeButton.setImageDrawable(modRes.getDrawable(R.drawable.red_button,null)); // WORKS!
backButton.setImageDrawable(modRes.getDrawable(R.drawable,yellow_button,null)); // didn't work!
XposedBridge.log("start scan:");
for(int i=0; i< NavigationButtonsLayout.getChildCount() ; i++) {
View viewChild = (View) NavigationButtonsLayout.getChildAt(i);
XposedBridge.log(viewChild.toString());
if(viewChild instanceof ImageView)
XposedBridge.log("Child At " + i + " is instanceof ImageView" ) ;
}
}
});
}
}

Use this:
resparam.res.setReplacement(SYSTEM_UI, "drawable", "ic_sysbar_back_ime", modRes.fwd(R.drawable.n_back_down));
resparam.res.setReplacement(SYSTEM_UI, "drawable", "ic_sysbar_recent", modRes.fwd(R.drawable.n_recents));
resparam.res.setReplacement(SYSTEM_UI, "drawable", "ic_sysbar_back", modRes.fwd(R.drawable.n_back));
Note: SYSTEM_UI="com.android.systemui"
Using my method, i wasnt able to change the home button. But using your method, it did!
Thanks man!

Related

[Help] Loading image to replace camera buffer

So I've created module to hijack an app's onPictureTaken callback method to manipulate the image-data that is returned from the Camera (android.hardware.Camera.PictureCallback).
I have succeeded to manipulate the image to return a Grayscale of it which was my first goal.
Now I want to replace the entire image with an image loaded from the filesystem which I'm unsuccessful in doing. I've tried different methods, paths etc. but haven't managed to do it. I've never been able to find the file which I want to load.
The full path of the image file I want to load is according to Solid Explorer
Code:
/storage/emulated/0/input.png
What code should I use to load the filesystem image into a Bitmap?
Do I need to take any extra Camera parameters into account that says stuff about the image?
Do I need take file permissions into account?
I'm running an OPO on Lollipop 5.0.2 / Cyanogen OS 12.0 / Xposed 67
This is the code I've used to create the Grayscale example:
Code:
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.os.Environment;
import java.io.ByteArrayOutputStream;
import java.io.File;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
public class CamHook implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("somepackage.somewhere.app"))
return;
XposedBridge.log("CamHook: We're here!");
findAndHookMethod("somepackage.somewhere.app.NewPhotoFragment$3$1", lpparam.classLoader, "onPictureTaken", "byte[]", "android.hardware.Camera", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("CamHook: before picture taken");
XposedBridge.log("CamHook: byteLength " + ((byte[]) (param.args)[0]).length);
byte[] bitmapdata = ((byte[]) (param.args)[0]);
Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata, 0, bitmapdata.length);
XposedBridge.log("CamHook: StorageState: " + Environment.getExternalStorageState());
XposedBridge.log("CamHook: StoragePath: " + Environment.getExternalStorageDirectory().getAbsolutePath());
XposedBridge.log("CamHook: StoragePathEnv: " + System.getenv("EXTERNAL_STORAGE"));
//Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getAbsolutePath() + "/input.jpg");
XposedBridge.log("CamHook: Bitmap is null: " + (bitmap == null));
bitmap = toGrayscale(bitmap);
ByteArrayOutputStream blob = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 0, blob);
param.args[0] = blob.toByteArray();
}
/*@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
// this will be called after the clock was updated by the original method
}*/
});
}
public Bitmap toGrayscale(Bitmap bmpOriginal)
{
int width, height;
height = bmpOriginal.getHeight();
width = bmpOriginal.getWidth();
Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bmpGrayscale);
Paint paint = new Paint();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
paint.setColorFilter(f);
c.drawBitmap(bmpOriginal, 0, 0, paint);
return bmpGrayscale;
}
}
Does this mean it's working? App settings and YouTube adaway seem to work. But I know app settings can work without xposed
Did you get this to work?
Hi,
I found your thread. Did you ever get this to work?
Kind regards!
Hello did it work out for you? I am also looking into similar thing.
سلام

Module Is Enabled, But not really Active | Devs Help ASAP

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"
}

Help Xposed Connection

Hi, I'm new to the subject of modules for Xposed, I hope you can help.
1) I have managed to make a change in the status bar of android, with a few lines.
Code:
String methodeStatusBar = "com.android.systemui.statusbar.phone.PhoneStatusBar";
XposedHelpers.findAndHookMethod(methodeStatusBar, lpparam.classLoader, "makeStatusBarView", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
XposedBridge.log("Hola Mundo-> Xposed: " + param);
Context mContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
LinearLayout mStatusBarContents = (LinearLayout)XposedHelpers.getObjectField(param.thisObject, "mStatusBarContents");
mStatusBarContents.setBackgroundColor(Color.rgb(100, 100, 255));
XposedBridge.log("findAndHookMethod-> Xposed: " + mContext);
XposedBridge.log("findAndHookMethod-> Xposed: " + mStatusBarContents);
}
});
2) I manage to identify activity that has focus.
Code:
XposedHelpers.findAndHookMethod(Activity.class, "onWindowFocusChanged", boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Activity activity = (Activity) param.thisObject;
}
});
3) but I can not connect "StatusBar" with "Activity", to extract the color of the "activity" and then set the "setBackgroundColor" the statusbar.
my question is: How can I connect "StatusBar" with "Activity"?
you can help me !!!!
translation "translate.google.com.do/".

Getting LongPress on Back/Volume Keys (Hooked, But Cant't Get LongPress)

Hello, I've hooked a method to get KeysEvent, but I've ran into 2 problems :
1. Can't get long press.
2. Getting up to 7 events when it's only 1 event, Explain ? I've added a log.i in "if(blabla == VOLUME_DOWN ), When i press that key i get the log 7 times.
Here's the code :
HTML:
public static void init() {
final Class localClass = XposedHelpers.findClass("com.android.internal.policy.impl.PhoneWindowManager", Xposed.CLASS_LOADER);
XposedBridge.hookAllConstructors(localClass, new XC_MethodHook() {
protected void afterHookedMethod(final XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam)
throws Throwable {
}
});
XposedHelpers.findAndHookMethod(localClass, "interceptKeyBeforeQueueing", KeyEvent.class, Integer.TYPE, new XC_MethodHook() {
[user=439709]@override[/user]
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
KeyEvent event = (KeyEvent) param.args[0];
int code = event.getKeyCode();
if (code == KeyEvent.KEYCODE_BACK) {
Log.i(Xposed.TAG, "Back Pressed");
}
}
});

Hook long press notification

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)

Categories

Resources