Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

Search This thread

chrisryn

Inactive Recognized Developer
Feb 10, 2007
427
129
My biggest issue is working through the differences in VS and eclipse. I want to create a module that has variable options and getting the gui and everything setup. Just different then what is my norm when programming. Learning about sharedprefs at the moment for retaining the options.
 

daveid

Senior Member
Jan 5, 2009
1,891
356
Samsung Galaxy S21 Ultra
I dont know if this is my rom or the framework, but im guessing the framework.

Whenever i dock my phone in the original cradle my statusbar fc's

And when i wake up in the morning samsungs stupid battery full notification is stuck in the drawer. Cant clear it.

If I close the app the notification disappears and my wallpaper goes to samsung stock.

My dpi is 240dpi

Any ideas?

Sent from my GT-N7105 using Tapatalk HD

I am running JediX9 and see the same FC when docked in my smart dock. However I use ADW Launcher, and my widgets get destroyed everytime... I have not changed my system dpi.
 

Pliind

Senior Member
Jul 20, 2010
181
25
Göteborg
Re: Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

I am running JediX9 and see the same FC when docked in my smart dock. However I use ADW Launcher, and my widgets get destroyed everytime... I have not changed my system dpi.

I use Nova luncher, only fc nothing else.

Sent from my GT-N7105 using Tapatalk HD
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,434
Pliind, daveid: Could you provide a logcat the error occurs? I can't make any sense of the symptoms you describe, but maybe the stack trace from the FC gives a hint that could also solve the other behavior.
 

daveid

Senior Member
Jan 5, 2009
1,891
356
Samsung Galaxy S21 Ultra
Pliind, daveid: Could you provide a logcat the error occurs? I can't make any sense of the symptoms you describe, but maybe the stack trace from the FC gives a hint that could also solve the other behavior.

Perhaps I can get a log one of these days... will want to to a fresh nandroid so I can simply restore without having the hassle of setting my many widgets back up, again. This all occurred on my recent vacation, which was the first time I used the dock since using this framework mod, I just thought it was something wrong with my setup till I saw the previous posting. Time is limited for me right now... but will see what I can do.
 

chrisryn

Inactive Recognized Developer
Feb 10, 2007
427
129
OK so my next question i'm finally making progress. Just need one clarification I know I need to (in smali) find method .method public constructor <init> and then change const/4 v1, 0x4 to const/4 v1, 0x5(just example) is that something that can be done with xposed.
 

Pliind

Senior Member
Jul 20, 2010
181
25
Göteborg
Re: Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

Pliind, daveid: Could you provide a logcat the error occurs? I can't make any sense of the symptoms you describe, but maybe the stack trace from the FC gives a hint that could also solve the other behavior.

What app do you want the logcat for? If its the xposed app you should find it in the file i linked you a couple days back.

Never mind Heres a fresh logcat

pliind.dyndns.info/debug2.log

Sent from my GT-N7105 using Tapatalk HD
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,434
OK so my next question i'm finally making progress. Just need one clarification I know I need to (in smali) find method .method public constructor <init> and then change const/4 v1, 0x4 to const/4 v1, 0x5(just example) is that something that can be done with xposed.

You can't do it exactly like this. As mentioned in the tutorial, the smallest sensible unit for hooking is on method basis (including constructors). So you would need to get a reference to the constructor first. Here is one way to do it: http://xdaforums.com/showpost.php?p=36362771&postcount=301. You can also use XposedBridge.hookAllConstructors or the XposedHelpers.findConstructor* methods. The you can execute your own code either before or after the method. You cannot change the code inside the method (you can, however, avoid the call to the method completely, which I wouldn't recommend for a constructor). So you need to check why the value needs to be changed from 4 to 5. Is it stored in a variable? Then maybe you can change this variable to 5 after the constructor is finished. Is it the parameter to another method? Then you could hook that method instead and change the value of the paramter to 5 before the method is called. Something like this. It really depends on the target.


What app do you want the logcat for? If its the xposed app you should find it in the file i linked you a couple days back.

Never mind Heres a fresh logcat

pliind.dyndns.info/debug2.log

This is the debug.log. It's useful if some code inside Xposed or a module doesn't work (for example because it tries to hook a method which doesn't exist), but it doesn't contain errors that occur in code outside of Xposed. I'm pretty sure that there are some good tutorials how to obtain a logcat here on the forums, either via adb, shell or an app. When you create it, please make sure it includes the FC, so create the logcat right after the crash has happened.
 

Pliind

Senior Member
Jul 20, 2010
181
25
Göteborg
Re: Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

Oh and what do i do about the battery full notification not going away? Im guessing this has something to do with the dock aswell.

Sent from my GT-N7105 using Tapatalk HD
 

dannejanne

Senior Member
Mar 23, 2011
2,430
856
Norrköping, Sweden
I had to uninstall Xposed framework because for some reason it made Final Fantasy Dimensions to not work at all. It just closed without any message at all. Uninstalling Xposed fixed my issue.
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,434
I had to uninstall Xposed framework because for some reason it made Final Fantasy Dimensions to not work at all. It just closed without any message at all. Uninstalling Xposed fixed my issue.

Thanks for reporting this. The fact that there is no message makes it pretty hard to find out what the reason is as I don't have the game. So you (or somebody else experiencing this) would have to create a logcat of the crash, sometimes errors are mentioned only there.

--------------
As for docking crash: Pliind has sent me a logcat with this error:
Code:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate receiver com.android.systemui.DreamsDockLauncher$DockEventReceiver: java.lang.ClassNotFoundException: com.android.systemui.DreamsDockLauncher$DockEventReceiver
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2251)
at android.app.ActivityThread.access$1500(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:103)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.android.systemui.DreamsDockLauncher$DockEventReceiver
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2246)
... 11 more

I checked his SystemUI.apk and indeed the class doesn't exist. However, the following appears in the AndroidManifest.xml of the same APK:
Code:
      <receiver android:name=".DreamsDockLauncher$DockEventReceiver" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.DOCK_EVENT" />
            </intent-filter>
        </receiver>

So the ROM is inconsistent. Basically, this removal commit was only included partly.

Pliind then tested without Xposed and the same FC occured. So it's not Xposed's fault, this error just has to happen when a class is referenced but doesn't exist.

------------------
@daveid: Maybe you can check if your ROM has the same problem. The destroyed widgets are probably caused by the SystemUI crash. When mine crashes, it often resets the wallpaper on GoLauncher Ex.
 
  • Like
Reactions: Pliind and daveid

daveid

Senior Member
Jan 5, 2009
1,891
356
Samsung Galaxy S21 Ultra
Thanks for reporting this. The fact that there is no message makes it pretty hard to find out what the reason is as I don't have the game. So you (or somebody else experiencing this) would have to create a logcat of the crash, sometimes errors are mentioned only there.

--------------
As for docking crash: Pliind has sent me a logcat with this error:
Code:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate receiver com.android.systemui.DreamsDockLauncher$DockEventReceiver: java.lang.ClassNotFoundException: com.android.systemui.DreamsDockLauncher$DockEventReceiver
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2251)
at android.app.ActivityThread.access$1500(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:103)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.android.systemui.DreamsDockLauncher$DockEventReceiver
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2246)
... 11 more

I checked his SystemUI.apk and indeed the class doesn't exist. However, the following appears in the AndroidManifest.xml of the same APK:
Code:
      <receiver android:name=".DreamsDockLauncher$DockEventReceiver" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.DOCK_EVENT" />
            </intent-filter>
        </receiver>

So the ROM is inconsistent. Basically, this removal commit was only included partly.

Pliind then tested without Xposed and the same FC occured. So it's not Xposed's fault, this error just has to happen when a class is referenced but doesn't exist.

------------------
@daveid: Maybe you can check if your ROM has the same problem. The destroyed widgets are probably caused by the SystemUI crash. When mine crashes, it often resets the wallpaper on GoLauncher Ex.

Is there a way to check without crashing it and potentially blowing my widgets out? If so, I will today, if not... this weekend.
Either way, what are the chances of a fix?
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,434
Is there a way to check without crashing it and potentially blowing my widgets out? If so, I will today, if not... this weekend.
Either way, what are the chances of a fix?

You don't necessarily need to reproduce the problem. You could use apktool or something similar to decompile your /system/app/SystemUI.apk. Then look for DOCK_EVENT in AndroidManifest.xml. If the class for the receiver doesn't exist in the smali folder, you have the same problem.

The solution is to remove the whole <receiver> tag, then build the APK again and push it to the phone. I don't know if it needs to be signed, I prefered writing Xposed to avoid this trouble. ;) Pliind wanted to contact the author of his ROM as this should be fixed once for all users of the ROM.
 
  • Like
Reactions: daveid

daveid

Senior Member
Jan 5, 2009
1,891
356
Samsung Galaxy S21 Ultra
You don't necessarily need to reproduce the problem. You could use apktool or something similar to decompile your /system/app/SystemUI.apk. Then look for DOCK_EVENT in AndroidManifest.xml. If the class for the receiver doesn't exist in the smali folder, you have the same problem.

The solution is to remove the whole <receiver> tag, then build the APK again and push it to the phone. I don't know if it needs to be signed, I prefered writing Xposed to avoid this trouble. ;) Pliind wanted to contact the author of his ROM as this should be fixed once for all users of the ROM.

It is the same, I am pretty sure we are running the same base ROM. I will let the author of my version know about this, but what should I tell him? I will point to this thread.

I decompiled it and found the DOCK_EVENT in the manifest, and checked the smali folders for a corresponding smali file, but there were none.
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,434
I will let the author of my version know about this, but what should I tell him? I will point to this thread.

I explained the issue in my post above, so you can point him to that one. And well, as the class doesn't exist, there is no sense in keeping the <receiver>, so just remove it.
 
  • Like
Reactions: daveid

Pliind

Senior Member
Jul 20, 2010
181
25
Göteborg
Re: Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

My rom creater gave me a new systemui and all is good now with the dock.

Big props to Rovo89!

Sent from my GT-N7105 using Tapatalk HD
 
Re: Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

Works fine on 7105. Ive been using it since pulser first started the thread

Sent from my GT-N7105 using xda premium

Any idea it will work for N7102 (Dual SIM). Considering buying this phone if I eventually make my trip to China. It works wonders with N7100.

Sent from my GT-N7100 using Tapatalk HD
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,434
Any idea it will work for N7102 (Dual SIM). Considering buying this phone if I eventually make my trip to China. It works wonders with N7100.

Sent from my GT-N7100 using Tapatalk HD

Chances are very good that it will work. Actually, it will work for most phones with an ARM processor, an Android 4.0+ ROM and root access (at installation time). Exceptions might be ROMs which are very different from the original Android code in some very internal, central code parts. But this is related to the ROM, not the phone itself. Also many modules will only work for some ROMs as they usually target the higher level code, which is more likely to be changed between ROMs and versions.
 
  • Like
Reactions: Elle233
Re: Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

Chances are very good that it will work. Actually, it will work for most phones with an ARM processor, an Android 4.0+ ROM and root access (at installation time). Exceptions might be ROMs which are very different from the original Android code in some very internal, central code parts. But this is related to the ROM, not the phone itself. Also many modules will only work for some ROMs as they usually target the higher level code, which is more likely to be changed between ROMs and versions.

Thanks bro

Sent from my GT-N7100 using Tapatalk HD
 

Top Liked Posts

  • There are no posts matching your filters.
  • 286
    Making "Stock" Custom ROMs Defunct (XposedFramework) - Tweaks for any ROM Version

    Introduction


    Recently it has dismayed me how, across the Android Community, people seem to feel that it's necessary to run a "Custom ROM" in order to get improvements and changes to your ROM. Of course, some of you know it's possible to modify the APK files directly to change things, but these changes need to be done every time your base ROM is updated. Once Samsung starts leaking out updates to 4.2 like a sieve, you guys will be all over them, needing to update your patches and tweaks every time.

    Anyway, seeing this displeases me, as it encourages people to see "Custom ROMs" as a commodity, and something you consume. In essence, users were getting their "fix" of tweaks from their "chef", but not learning how to do it themselves, nor realising their beloved chef isn't doing anything magical. In fact, their chef is likely decompiling the applications, and using baksmali/apktool to take apart the app, hard-code in their changes, then rebuild it. This method has worked well for 3 years, but it's been in need of an update for some time.

    The Enlightenment

    Then I saw this thread by rovo89. That man deserves a beer for every Android user there is, for his work on the Xposed Framework! His and Tungstwenty's work on this has made it possible to modify the core Android system, without doing any actual modifying of applications.

    OK... Why are you telling me this?

    This invention seems to have pretty much gone unnoticed by the world. The reasons this is vastly superior to any other way of making modifications to apps and the system are:

    • Your modifications are not tied into a single version of the APK or app or framework. If the ROM is updated, the patch should still work perfectly on the new version of the app (this doesn't necessarily apply across major updates like 4.1 to 4.2, but should be fine across 4.1.0 to 4.1.2 style changes).
    • You are not actually modifying any files on the phone! If something goes wrong, you can just disable the support for the framework, and the tweaks will do nothing. As such, it's easier to get a working phone if something dies - in fact there is a ZIP placed on your SD for this very purpose. Just flash it in CWM and it will disable the framework.
    • As no actual files are being modified, it doesn't matter if your ROM is odexed, deodexed, or a bit of both (ie. certain apps deodexed, but frameworks odexed). With this, there is no reason to run a deodexed ROM, since you can change pretty much everything you want to without touching the raw files. So leave them as odex files and you'll not have any problems. Bear in mind we deodex to allow easier customisation, odexed is actually slightly faster, and removes the majority of the dexopt process on first boot.
    • No application signatures are modified, as the apps are not touched, so if you were to use this to modify an app like Maps or Gmail, you won't get issues when trying to update to a new version of the app via the market.

    The only way this can succeed is for you to try it. I usually run a "custom ROM" on my phone. For the first time ever, I've been using a stock ROM for a significant period of time. On the Note2 in particular, Samsung is really getting good at this. But they're not perfect. And as such, I started to look at using this to perfect their work.

    When you run a custom ROM, look at what you're getting, and ask yourself why it doesn't use this method. I've only made one little modification so far, but it's one that annoys me hugely! The blooming SMS -> MMS conversion when you try to write any form of prose in a text message. I cannot stand the limitation of SMS to 160 characters, so the ability to chain together messages is a godsend to me. Unfortunately though, Google and Samsung seem to like to restrict you to 3 SMS messages worth of text before converting to an MMS message. Which is wonderful, except when you have totally unlimited SMS, but pay for MMS. As such, I was finding my ability to communicate in my usual verbose way somewhat hindered by the messaging app.

    Alas that is no longer an issue. If you want to get started, here's how.

    OK... How do I use this?

    1. Download and install the APK file from this post - http://xdaforums.com/showthread.php?t=1574401. I have tested it on the N7100, it works fine. Run it, install the framework, grant it root (yes, this requires root!), and reboot. I have mirrored the APK below just in case of issues.
    2. Download and install the APK modification you want from http://www.villainrom.co.uk/forum/microdownloads/
    3. When you get a notification about enabling the modification (after the APK is installed), tap that notification, and enable the plugin by ticking the box.
    4. Reboot your phone
    5. Go test your modification

    If you have any issues with this, please paste the contents of /data/xposed/debug.log on a pastebin site or in
    Code:
     tags.
    
    [SIZE="5"][B]How can I make my own modifications like this?[/B][/SIZE]
    
    Will post this a bit later, along with the source of this plugin. 
    
    [SIZE="5"][B]References[/B][/SIZE]
    [url]http://xdaforums.com/showthread.php?t=1574401[/url]
    [url=http://xdaforums.com/member.php?u=4322181]Tungstwenty[/url]
    [url=http://xdaforums.com/member.php?u=4419114]Robo89[/url]
    
    [SIZE="5"][B]Sources[/B][/SIZE]
    You can find the sources for Xposed Framework at [url]https://github.com/rovo89[/url]
    You can find the sources for all Xposed modifications I have made so far on Github:
    
    [url=https://github.com/pulser/xposedSMStoMMS]Disable SMS -> MMS Conversion[/url]
    [url=https://github.com/pulser/xposedDisableBatteryFullAlert]Disable 100% Battery Notification[/url]
    [url=https://github.com/pulser/xposedEnableCallRecording]Enable Call Recording[/url]
    [url=https://github.com/pulser/xposedScrollingLauncherWallpaper]Enable scrolling wallpaper in stock launcher[/url]
    [url=https://github.com/pulser/xposedEmailTextColour]Make text in email app message list clearer to read (lighter) on the black background[/url]
    78
    Modifications

    OK so a few people suggested an addon repository... I have got one sorted :)
    Downloads

    http://www.villainrom.co.uk/forum/microdownloads/

    I've added some of mine so far, but I won't add other people's - they can add them themselves, and maintain them :)

    This system is vastly superior to a stickied forum thread, as you can update your own modification (as a developer), and as a user, receive notifications if a modification is updated.

    Developers

    Use a general title that describes what your modification does. Put in a version string too. I tend to use the format 1.0, 1.1, 1.2 etc, but this is up to you. You can add Alpha or Beta or other designations if you wish.

    For author, pop in your name or username. And enter a brief description of what the modification does (which will appear in the index)
    Click Categories/Agreements, and select which category the modification falls under. If you think there's a category which should be added, let me know.

    Under Full Description, you can enter a detailed description of your modification. Finally, under File Options, use File to Upload to select your APK file. You can optionally add an Image to Upload. The Use File URL should be set to no, and the File URL box left blank.

    Users
    • There is no need to register an account to download files from the repository. If you wish to receive notifications of updates, you can register an account - just hit the red "Log in or Sign up" button - you can use a Twitter or Google account if you want, or just make a plain account. It makes no difference.
    • Head across to http://www.villainrom.co.uk/forum/microdownloads/ and have a look at the modifications you want.
    • Click watch file (at the bottom right) if you want notifications about updates to a modification
    • Click Report to report a modification for being malicious or problematic.
    • Click "add comment" to discuss or comment on the modification, or leave a "review" or feedback
    • Click on the stars under (0 votes) to leave a star rating on the modification, which will help generate most popular lists on the main page.

    Click to see licence details of mine:


    Feel free to use these as you wish, for non-commercial purposes. You may share these for personal use. Note that distribution in any kind of "package" or "custom ROM" is not personal use. Sending a friend a copy is personal use, feel free to do that and share the love.

    Feel free to make changes to the source code of the modifications if you think you can improve them, provided you make your changes available in a similar manner. If you fix a bug or error, please send a pull request.

    If you wish to use these commercially, please contact me. This includes in any "distribution package", be it a ROM, app, store, marketplace or other package. That's not in the spirit of this project, so get in touch with me and we'll discuss it.

    Tl;dr:

    End users, have fun, use these, enjoy them, share them, tweak them, just be sure to share your source changes and/or send a pull request if you improve something!

    "Custom ROM" Developers, and anyone wanting to try to use these for commercial purposes: Don't. These are to encourage people to learn about these changes, so contact me if you want to do something else with them. Commercial use, including distribution in "Custom ROMs" is not permitted.
    68
    Install the Xposed Framework from this thread: http://xdaforums.com/showthread.php?t=1574401
    36
    How to make your own such modification

    This information is NOT complete. This example only uses 1 of about 10 different types of modification. I have spoken to rovo89 and he has said it would probably be possible to document this further. This example covers ONE usage case - I am going to override an entire method.

    1. Create a new empty Android project in Eclipse.
    2. Within the "application" section of your AndroidManifest.xml, add the following metadata:

    Code:
            <meta-data android:name="xposedmodule" android:value="true"/>
            <meta-data android:name="xposedminversion" android:value="2.0rc1.*" />

    3. Within the assets folder of the project, add a plain text file, "xposed_init". Within this, I have put

    Code:
    uk.co.villainrom.pulser.allowlongsms.AllowLongSMS

    uk.co.villainrom.pulser.allowlongsms is the PACKAGE name of my Java package. AllowLongSMS is my class name. The purpose of this is to tell the Xposed Framework what to run.

    4. Within AllowLongSMS.java (ie. the class name, with .java on the end), I put the following code:

    PHP:
    package uk.co.villainrom.pulser.allowlongsms; //this sets the package for our project, this is the first part of the value in xposed_init file in assets.
    
    import de.robv.android.xposed.IXposedHookLoadPackage;
    import de.robv.android.xposed.XC_MethodHook;
    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_LoadPackage.LoadPackageParam;
    
    //above includes all the required parts of the xposed framework that we need here
    
    public class AllowLongSMS implements IXposedHookLoadPackage {        //here we declare the class AllowLongSMS. We say it implements IXposedHookLoadPackage, as we want to make use of the hook-in on package load. Other options are available here for working with native libs etc, and resources, but I'm not using these right now.
    	public static final String MY_PACKAGE_NAME = AllowLongSMS.class.getPackage()
    			.getName();     //this doesn't do anything, I just left it here for if I needed to write logs and wanted to have the package name easily accessible.
    	public static final String TAG = "PulserMmsTweak";   //same here, this doesn't do anything.
    
    	@Override //we are going to override the method handleLoadPackage, if it exists further up the hierarchy
    	public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { 
    		//this method is called every time a package is loaded. We have a parameter that we're going to call lpparam, that is passed in, that relates to what package was loaded
    		if (lpparam.packageName.equals("com.android.mms")) { //if the package that has just been loaded is called "com.android.mms" then
    			ClassLoader classLoader = lpparam.classLoader; //create a classloader object that we can now use
    			XC_MethodReplacement methodreplacer = new XC_MethodReplacement() {  //create a method replacer object, as we are going to REPLACE an entire method within the mms app.
    				protected Object replaceHookedMethod( //we make an object here, that passes in the parameters of what to actually change
    						XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam)
    						throws Throwable {
    					return Integer.valueOf(255);  
    					/* THIS IS THE IMPORTANT LINE
    					 * This line returns the value 255. Why this happens won't make sense yet, but THIS is where you put your "new method" code.
    					 * 
    					*/
    					
    				}
    			};
    			XposedHelpers.findAndHookMethod("com.android.mms.MmsConfig",  //here we say that we want to find and hook into the method "getSMSToMmsTextThreshold" which is part of the class com.android.mms.MmsConfig. We then say that we're passing this to methodreplacer, which we defined earlier
    					classLoader, "getSmsToMmsTextThreshold", methodreplacer);
    		}
                    //if the package wasn't com.android.mms, do nothing.
    
    	}
    
    }
    28
    Mod: Per-app settings

    Here's a new mod for you to try.
    I tested it on my stock S2 4.0.3 and it's working, but you may very well expect problems. Just let me know which.
    I do know that on 4.1.x a few problems occur and this might even be unusable, but I'm still investigating. Feel free to try it out, though, as you can always disable it if any problems arise.

    Per-app Settings

    What it does
    Allows you to configure a number of settings which are app-agnostic, i.e. apply to all of them:
    • Screen size & DPI - fools the resource loader so you can have a layout meant for bigger screens and can control the size of fonts and graphics
    • Language - You can have particular apps in a language other than your system wide language (e.g. system lang in English, but Maps+Navigation in your local language for good voice reading)
    • Revoke permissions - Pick which app permissions you want to deny (and then hope that it will work without them, instead of FC'ing :))
    • Keep apps resident in memory - changes some settings to reduce the chances that memory used by the app is freed (on hold for now)
    By now you should know what to do to get this up and running :p

    Enjoy ;)


    EDIT:
    Replaced with version 0.0.3:
    - removed the need to reboot for the settings to have effect (the target app still needs to be restarted, but not the phone)
    - UI revision to be a bit more intuitive
    - Added setting for tablet mode, required by some apps/resources

    0.0.4 is up:
    - Added a button to list existing folders under /res, so you have some hints about what kind of screen settings you may try.

    To understand the kind of screen settings you need to set in order to have "large screen" layouts, you'll need to peek inside the APK with a zip app (e.g. 7-zip) and browse the "res" folder.
    Look for things like "layout-sw600dp" - this will mean there are resources that are loaded only when the smallest (reported) width is 600 or above, and that's something you can experiment in the settings.
    There is also a general size qualifier which can take the values "-small", "-normal", "-large" and "-xlarge". Checking the "Tablet" box activates xlarge.
    You can read more about how resources for different screen sizes are handled here.