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

Search This thread

Scalee

Senior Member
Aug 21, 2009
199
250
I am quite curious if this would affect the speed of your device.
Theoretically speaking, would it slow down everything or just the packages your modifying?

Maybe i should try creating a multi window mod, probably will take me a while :p
Even though it only looks like 2 small patches.
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,433
You'd create a resource of type dimension in your mod apk (or as many as you need later on), and then implement the IXposedHookInitPackageResources so you can replace the original value with your own:
Code:
resparam.res.setReplacement("_target_package_", "dimen", "target_res_name", modRes.fwd(R.your_mod_res_id));

If you were to do this programmatically, a Dimension resource is represented as a float. But I don't know what will be its value depending on whether the xml resource is in px, dp, ... I think it will take into account whatever DPI, etc. the device is using and normalize all different types to a single scale.

Yep, that's how you have to do it (the tutorial is still outdated btw, so please take Tungstwenty's code as an example). It looks rather complex, but the good thing is that you can use this also for other resource types like drawables.

For dimensions, I might add a way to code-only way later. I found the function which is responsible for the unit conversion, but I would have to test how well it works. And you cannot use the code-only replacements if you want to differentiate between different screen sizes for example (not sure how big this limitation really is).
 

Tassos_i

Senior Member
Feb 12, 2012
322
84
Athens
Here's my first mod contribution for the collection :)

It injects into the Android 4.2 keyboard an additional language resource of your choosing so you have dictionary and swipe support for it.
The available languages are the ones for which I found .dict files on the CM repo:
  • Bulgarian (bg)
  • Croatian (hr)
  • Czech (cs)
  • Danish (da)
  • Dutch (nl)
  • Finnish (fi)
  • Georgian (ka)
  • Greek (el)
  • Hebrew (iw)
  • Hungarian (hu)
  • Norwegian Bokmål (nb)
  • Portuguese (pt_PT)
  • Russian (ru)
  • Swedish (sv)

Tested for the Portuguese (pt_PT) language on ICS and 4.1 JB.
Please leave feedback if you try it out, especially for other languages.


I'm finishing some code cleanup and adding extensive comments, will push them to GitHub later today.

On GN7000, JB "stock" XXLSC odexed, this module installed easily, I chose greek language, but greek dictionary never came up while writing...
And I restarted both the framework and the Note several times.

Sent from my GT-N7000 using Tapatalk 2
 

Scalee

Senior Member
Aug 21, 2009
199
250
Tried to make a multiwindow mod but i think i have the wrong package name.

Class: com.android.server.am.MultiWindowManagerService
File: Services.jar

Code never enters

Code:
if (lpparam.packageName.equals("com.android.server"))

Any suggestions?
 
Tried to make a multiwindow mod but i think i have the wrong package name.

Class: com.android.server.am.MultiWindowManagerService
File: Services.jar

Code never enters

Code:
if (lpparam.packageName.equals("com.android.server"))

Any suggestions?

What about adding .am. ?
com.android.server.am

Send from my Omega ROM powered SGS3 :)
 

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,433
Most services are running in a special system process. I think the package name for it is simply "android".
 

Scalee

Senior Member
Aug 21, 2009
199
250
Most services are running in a special system process. I think the package name for it is simply "android".

You were right, it was named android. However the mod didn't work, but i figured it might just be the guide.
So i decompiled the flashbarservice and made my own mod, also saves me from messing in root processes.

I am so amazed by the xposed framework, it so bloody powerful.
I am really baffled that this hasn't become the standard, no more messing around in smali or having to have deodex roms.
 
Last edited:

pulser_g2

Admin Emeritus / Senior Recognized Developer
Nov 27, 2009
19,544
11,630
You were right, it was named android. However the mod didn't work, but i figured it might just be the guide.
So i decompiled the flashbarservice and made my own mod, also saves me from messing in root processes.

I am so amazed by the xposed framework, it so bloody powerful.
I am really baffled that this hasn't become the standard, no more messing around in smali or having to have deodex roms.

Yeah, I'm hoping that this does become the standard...
 

pulser_g2

Admin Emeritus / Senior Recognized Developer
Nov 27, 2009
19,544
11,630
Yep, that's how you have to do it (the tutorial is still outdated btw, so please take Tungstwenty's code as an example). It looks rather complex, but the good thing is that you can use this also for other resource types like drawables.

For dimensions, I might add a way to code-only way later. I found the function which is responsible for the unit conversion, but I would have to test how well it works. And you cannot use the code-only replacements if you want to differentiate between different screen sizes for example (not sure how big this limitation really is).

Got it working now with the resource added to the package :)

Thanks guys!

I'll stability test this one for a little bit first though, just to be sure it's all OK!
 

lpsi2000

Senior Member
Jan 16, 2004
2,479
156
TriState
Indeed, I want to try out my to-do list first too...

Firstly to look at Garyd9's modifications for touchwiz launcher, and try to get the various width and height adjustments possible. Maybe even within a settings UI :D

also I have a few others to look at like power menu mod, and stuff mentioned on the other pages

Can you add multidpi to your to do list:D

Edit: nevermind I should have read the entire thread, but it looks like we may have something in the works already
 
Last edited:

rovo89

Senior Recognized Developer
Jan 4, 2012
2,585
81,433
Some posts ago, I mentioned that this is already working in Tweakbox if you know how to configure it. Nevertheless, we are planning to move this to a separate app (then with a proper UI of course).

Btw, the concept requires that more people write their own mods using the framework and share them. There are many different ideas what could be done, but if only a few people implement them, they will soon be confronted with many requests which they cannot fulfill.
 
  • Like
Reactions: o_tiger

o_tiger

Senior Member
Mar 19, 2010
320
90
Zürich
Some posts ago, I mentioned that this is already working in Tweakbox if you know how to configure it. Nevertheless, we are planning to move this to a separate app (then with a proper UI of course).

Btw, the concept requires that more people write their own mods using the framework and share them. There are many different ideas what could be done, but if only a few people implement them, they will soon be confronted with many requests which they cannot fulfill.

This 'proper ui multi dpi per app' app will definitely be a winner & will push this framework to the sky. How can I / we support this idea? To make this 'paranoid' apk come true. :D
 

D3_

Senior Member
Mar 9, 2010
1,262
419
London
I believe DOC posted in the RedPill kernel thread saying that the upcoming hyperdroid (not hypernote) rom will support multi dpi.
I love the concept of this framework though, what are the basics I need to know to try writing things for it myself? Keep in mind I've currently got no coding knowledge :p

Sent from my GT-N7100 using xda app-developers app
 

Scalee

Senior Member
Aug 21, 2009
199
250
I believe DOC posted in the RedPill kernel thread saying that the upcoming hyperdroid (not hypernote) rom will support multi dpi.
I love the concept of this framework though, what are the basics I need to know to try writing things for it myself? Keep in mind I've currently got no coding knowledge :p

I was able to make my first mod (multi window mod) in about 8 hours, the first 3 hours were wasted on follow someones guide on how make this mod in smali which didn't work for my version. So i spend 5 hours figuring out how it works and how i wanted it to work (and probably become universal for all version).

But i have quite allot of programming experience (not so much in java though),
And eclipse isn't the most help full editor either.

I am afraid that if you have never coded anything, this will be a steep hill to climb.
But FAR more easy then patching things in smali.
You have to understand what your target app does so you know what to patch.

Long story short, what i think you need to know:

Data types
Loops
Casting
You have to understand what your target app does so you know what to patch. (previous things will help you here)

That should allow you to do simple patches i guess.
 
  • Like
Reactions: D3_

ruleonyourself

Senior Member
Oct 8, 2012
76
8
Delhi
Hey...the post was very useful for me and you are correct that no one is doing magic in creating costom rom....but from the thanks meter i can judge that u r very deep into the android stull so why cant u tell or create a thread from the starting that include explanation of each terms in android apk ....i mean let us assume there are three part in android .1 is any application that is .apk file.
2. Rom ...any custom rom
3. Kernal...custom kernal

now what i want to say you that u publish the details and step wise step procedure to make an app i.e .apk file ...how to initiate ,how to edit,what are the requirements (OS,software etc etc....) as u had explain in first page an example withh different lines of codes telling there meaning.


then when who are interested and idea of making something creative but do not have any idea how to do(me too includes in this category)
they will learn to make and create apps.

then after that you can add to make or customizes the stock or exposed rom........so that the one who gain the knowlege of making app can able to compile necessary and different app to create various custom rom


then the kernal .....



i hope i was quite clear....and also hope that it will produce lots of innovative and custom mods and app.......
 

MohJee

Senior Member
Nov 3, 2012
645
252
Would it be possible to make an xposed module that increases USB charge rate to something faster than 475mah? Or is that something outside the frameworks realm?
 

pulser_g2

Admin Emeritus / Senior Recognized Developer
Nov 27, 2009
19,544
11,630
Would it be possible to make an xposed module that increases USB charge rate to something faster than 475mah? Or is that something outside the frameworks realm?

Thar be kernel based change. Not xposed, unless some OEM had a really strange implementation of charge rates
 

pulser_g2

Admin Emeritus / Senior Recognized Developer
Nov 27, 2009
19,544
11,630
Hey...the post was very useful for me and you are correct that no one is doing magic in creating costom rom....but from the thanks meter i can judge that u r very deep into the android stull so why cant u tell or create a thread from the starting that include explanation of each terms in android apk ....i mean let us assume there are three part in android .1 is any application that is .apk file.
2. Rom ...any custom rom
3. Kernal...custom kernal

now what i want to say you that u publish the details and step wise step procedure to make an app i.e .apk file ...how to initiate ,how to edit,what are the requirements (OS,software etc etc....) as u had explain in first page an example withh different lines of codes telling there meaning.


then when who are interested and idea of making something creative but do not have any idea how to do(me too includes in this category)
they will learn to make and create apps.

then after that you can add to make or customizes the stock or exposed rom........so that the one who gain the knowlege of making app can able to compile necessary and different app to create various custom rom


then the kernal .....



i hope i was quite clear....and also hope that it will produce lots of innovative and custom mods and app.......

All the things you asked for are covered in other tutorials on how to make apps.

Check out YouTube or just do a Google search. I don't think it's justified to spend the time making tutorials that already exist tbh.

I am not an expert in making apps - I have never made any... But if I can do this, so can anyone!
 
S

sawdoctor

Guest
I know its probably a given but I can confirm that the xposed framework works perfectly on 4.1.2.
@pulser_g2 how did the testing go with the stock launcher mod? Hopefully we might see it soon?

Sent from my GT-N7105 using xda app-developers app
 

Tungstwenty

Senior Member
Nov 1, 2011
1,830
4,512
I know its probably a given but I can confirm that the xposed framework works perfectly on 4.1.2.
@pulser_g2 how did the testing go with the stock launcher mod? Hopefully we might see it soon?

Sent from my GT-N7105 using xda app-developers app
It works, just make sure to use the installer APK in the 2nd post, which detects ICS vs JB and installs the correct system file.
I have it running fine on a test Paranoid installation 2.22 (Android 4.1.2)
 

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.