I'm trying to find a way to reload my module's settings when they're changed. I'm using initZygote so using, for example, a (dynamic) broadcast receiver there and reloading the preferences using XSharedPreferences.reload() isn't an option from what I understand (can't run a thread in zygote.)
Another option would be to reload the settings from hookLoadPackage, also using a broadcast receiver, in a process that's always there (android?) I gave it a quick shot, didn't work, searched a bit in this thread and saw an explanation by rovo about why that's not possible (different processes.)
Is there something I've missed that might allow me to do what I want?
Right, a thread running in the Zygote process will prevent the system from starting for some reason.
If you need those settings in every process (which is probably why you have hooked the method in initZygote), that would mean that you would have to set up a broadcast receiver in every thread. Not very efficient either.
How often are those settings needed? If it's not too often, you could simply reload everytime. There is a check for file modification time and size, which is likely cached, so it shouldn't be too much overhead. I haven't done any performance tests though. If the method is called too often, you could remember when you have last reloaded the settings. So you could reload only once every few seconds (which is almost as good as instant updates).
I decided I was done fighting with such messed up code and discontinued the module, but I still don't understand what I was doing wrong? What's wrong with this snippet?
Code:
XResources res = (XResources) toastContext.getResources();
int icon = res.addResource(toastContext.getResources(), R.drawable.ic_notif);
final Notification n = new Notification.Builder(toastContext)
.setContentText(toastTextView.getText())
.setLargeIcon(toastBD.getBitmap())
.setSmallIcon(icon)
The notiication is sent to the SystemUI process and displayed there. So the SystemUI loads the resources of the app that sent the notification - but it can't know about the replacement which was implecitly added with addResource(). That's why it can't resolve the fake resource ID. And that's why you should make sure to do that replacement in handleInitPackageResources(), which will be called for the app's resources even if they are loaded in other processes.
Hello. Given that i don't know the exact name of the buttons in English (i don't know them neither in Italian), and given that my phone continues correcting my text as if it were italian, i post my problem with some screenshots:
Sometimes the lower bar(the one with the 3 buttons back, home and "the other button") does not disappear, but if i press "the other button" and then click on the app i was using, the lower bar disappears, ad it is supposed to do.
Is it a problem of Immerse Me or it's a problem of mine?
It's the best way i can explain this..
Again, I don't see how this is related to the Xposed.
I'm not certain if I'll be able to get to the base activity; I'll do some research into that?
He means that you could hook onActivityResult() in Activity.class. That's indeed probably the only choice you have, you can't add methods.