[Xposed General] Mjuksel:
Trying to hook the layout where the notification_bg.xml is called as background.

Following the "Modifying Layouts" on the Github Tutorial i came up to this:

package mjxl.xposed.cm11;

import android.widget.TextView;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
import de.robv.android.xposed.callbacks.XC_LayoutInflated;

public class CM11notifications implements IXposedHookInitPackageResources {

public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {

resparam.res.hookLayout("android", "layout", "notification_template_base", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.notification_bg);
XposedBridge.log("hey Ho");
}
});
resparam.res.hookLayout("android", "layout", "notification_template_big_base", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.notification_bg);
XposedBridge.log("hey Ho");
}
});
resparam.res.hookLayout("android", "layout", "notification_template_big_text", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.notification_bg);
XposedBridge.log("hey Ho");
}
});
resparam.res.hookLayout("android", "layout", "notification_template_inbox", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.notification_bg);
XposedBridge.log("hey Ho");
}
});
resparam.res.hookLayout("android", "layout", "notification_template_big_picture", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.notification_bg);
XposedBridge.log("hey Ho");
}
});
}
}

Am i making any mistakes here ? i don't see it :/ i've tried setBackground instead of BackgroundResource, but that doesn't get accepted.. Neither does setBackgroundDrawable

edit: in initZygote with systemwideLayout

package mjxl.xposed.cm11;

import android.content.res.XResources;
import android.widget.TextView;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LayoutInflated;

public class not implements IXposedHookZygoteInit {

@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {

XResources.hookSystemWideLayout("android", "layout", "notification_template_base", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.mjxl_bg);

XposedBridge.log("hey Ho");
}
});
XResources.hookSystemWideLayout("android", "layout", "notification_template_big_picture", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.mjxl_bg);

XposedBridge.log("hey Ho");
}
});
XResources.hookSystemWideLayout("android", "layout", "notification_template_big_base", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.mjxl_bg);

XposedBridge.log("hey Ho");
}
});
XResources.hookSystemWideLayout("android", "layout", "notification_template_big_text", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.mjxl_bg);

XposedBridge.log("hey Ho");
}
});
XResources.hookSystemWideLayout("android", "layout", "notification_template_inbox", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
TextView notif = (TextView) liparam.view.findViewById(
liparam.res.getIdentifier("status_bar_latest_event_content", "id", "android"));
notif.setBackgroundResource(R.drawable.mjxl_bg);

XposedBridge.log("hey Ho");
}
});
}
}