Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[xposed - source] LG G2 KitKat (stock) Xposed mods

OP garyd9

6th March 2014, 06:28 AM   |  #1  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
I realize that xposed isn't quite released for the LG G2 kitkat stock firmware at the time of this post, but something being "not quite yet released" never slowed xda-developers down...

This thread is dedicated to various mods to the stock LG UI that can be done with xposed. It's only for SOURCE CODE and fragments. Please, don't upload or link any compiled projects here.

If you don't do your own development and/or don't work with xposed, this thread isn't for you.

Please don't ask for support in general xposed development here. Again, this is just a place for people to share code.
Last edited by garyd9; 6th March 2014 at 06:45 AM.
The Following 17 Users Say Thank You to garyd9 For This Useful Post: [ View ]
6th March 2014, 06:30 AM   |  #2  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
Battery icon
The xposed framework tutorials have samples for replacing the battery icon. However, you should use apktool to open up LGSystemUI.apk (priv-app) to see that there are many different versions of the battery on the G2. For example, the standard battery replacement code doesn't work on AT&T phones (D800.)

So, you might end up having to replace several resources:
Code:
		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery", modRes.fwd(R.drawable.stat_sys_battery));
		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery_atnt", modRes.fwd(R.drawable.stat_sys_battery));
		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery_charge", modRes.fwd(R.drawable.stat_sys_battery_charge));
The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ View ]
6th March 2014, 06:32 AM   |  #3  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
Getting rid of the carrier logo (on the left side of the status bar)

Fairly simple (and there are multiple ways) For example, in the handleLoadPackage() for com.android.systemui, the following works:
Code:
findAndHookMethod("com.lge.systemui.widget.OperatorTextView", 
		lpparam.classLoader, 
		"setTextOperator", CharSequence.class,
		new XC_MethodHook() {
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable {
				XposedHelpers.callMethod(param.thisObject,"setVisibility", 0x8);
			}			
		});
The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ View ]
6th March 2014, 06:40 AM   |  #4  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
Not happy with the fact that LG shoves that soft "menu" key in your face all the time? Want to replace it with a "recent app" type softkey (that's more android and less samsung)? This one is kind of involved in order to be complete...

All of these fragments take place in the handleLoadPackage() for com.android.systemui...

First, just change the "menu" button to always be a "recent apps" button:

Code:
findAndHookMethod("com.lge.systemui.navigationbar.NavigationBarManager", 
		lpparam.classLoader, 
		"updateButtonSet", /* no params */
		new XC_MethodHook() {
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable {
				String p = (String) XposedHelpers.getObjectField(param.thisObject, "mButtonSet");
				// replace "menu" with recent apps, and get rid of the recentappsdummy
				p = p.replace("Menu", "RecentApps").replace("RecentAppsDummy", "");
				XposedHelpers.setObjectField(param.thisObject, "mButtonSet", p);
			}					
		});
That's pretty easy. However, you've just lost the "menu" button which is really needed for several LG stock apps (as they don't use an overflow button.) To handle that, here's a fragment (in the same handler) that will capture any long presses of the "recents" button and send a MENU command instead. While we're at it, go ahead and disable the old-fashioned "long press home -> recents"
Code:
findAndHookMethod("com.android.systemui.statusbar.policy.KeyButtonView", 
		lpparam.classLoader, 
		"sendEvent", int.class, int.class,
		new XC_MethodReplacement() {
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
				// get the mcode of the button
				final int sDUMMYKEYCODE = 0x1bb;
						
				Integer mcode = XposedHelpers.getIntField(param.thisObject, "mCode");
						
				// deal with long press events
				if ((Integer)param.args[1] == KeyEvent.FLAG_LONG_PRESS) {
							
					if (mcode == KeyEvent.KEYCODE_HOME) {
						// swallow the home long press - it should do nothing
					} else if (mcode == KeyEvent.KEYCODE_APP_SWITCH) {
						// long press of recents gives the menu
						// set this key to have the menu code..
						XposedHelpers.setIntField(param.thisObject, "mCode", KeyEvent.KEYCODE_MENU);
						// send an 'action down'
						XposedHelpers.callMethod(param.thisObject, "sendEvent", KeyEvent.ACTION_DOWN, 0, SystemClock.uptimeMillis());
						// set the mcode to a known "fake" so the action_up is handled properly
						XposedHelpers.setIntField(param.thisObject, "mCode",  sDUMMYKEYCODE); 
					} 
				} else if (mcode == sDUMMYKEYCODE) {
					// the recents key has its code set to DUMMYKEYCODE when it sends
					// an action_down to flag that this was a long press.  Now that the
					// dummykeycode has been sent again, simulate a menu action_up
					XposedHelpers.setIntField(param.thisObject, "mCode",  KeyEvent.KEYCODE_MENU);
					XposedHelpers.callMethod(param.thisObject, "sendEvent", KeyEvent.ACTION_UP, 0, SystemClock.uptimeMillis());
					XposedHelpers.setIntField(param.thisObject, "mCode",  KeyEvent.KEYCODE_APP_SWITCH);
				} else {
					// no special processing, so just pass the sendEvent along normally.
					XposedHelpers.callMethod(param.thisObject, "sendEvent", param.args[0],param.args[1], SystemClock.uptimeMillis());
				}		
				return null;
			}			
		});
The Following 2 Users Say Thank You to garyd9 For This Useful Post: [ View ]
6th March 2014, 06:44 AM   |  #5  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
Here's a couple of fragments that just change some resource bools to alter the UI. The first one turns off the volume slider on the notification dropdown and the second turns off the option for "quick voice" when you press/hold the home softkey. Both are in the handleInitPackageResources() for com.android.systemui:
Code:
resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_volumeslider", 
		false);

resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_qvoice", 
		false);
The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ View ]
7th March 2014, 08:14 PM   |  #6  
G-Bus's Avatar
Senior Member
Flag Montreal
Thanks Meter: 120
 
472 posts
Join Date:Joined: Jan 2011
More
Quote:
Originally Posted by garyd9

Getting rid of the carrier logo (on the left side of the status bar)

Fairly simple (and there are multiple ways) For example, in the handleLoadPackage() for com.android.systemui, the following works:

Code:
findAndHookMethod("com.lge.systemui.widget.OperatorTextView", 
lpparam.classLoader, 
"setTextOperator", CharSequence.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.callMethod(param.thisObject,"setVisibility", 0x8);
}
});

Where do I find that file? I cant stand the the carrier name in the status bar.
7th March 2014, 08:17 PM   |  #7  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
Quote:
Originally Posted by G-Bus

Where do I find that file? I cant stand the the carrier name in the status bar.

Where do you find which file? These are source code fragments that a dev can use to do certain things with the xposed framework.



Sent from my LG-D800
The Following 2 Users Say Thank You to garyd9 For This Useful Post: [ View ]
10th March 2014, 02:45 AM   |  #8  
Tinchoska's Avatar
Senior Member
Flag Hudson, Buenos Aires
Thanks Meter: 702
 
2,630 posts
Join Date:Joined: Jul 2011
More
Dude this will work on art?

Enviado desde mi LG-D806 mediante Tapatalk
10th March 2014, 04:13 AM   |  #9  
Senior Member
Thanks Meter: 19
 
117 posts
Join Date:Joined: Oct 2011
Quote:
Originally Posted by garyd9

Here's a couple of fragments that just change some resource bools to alter the UI. The first one turns off the volume slider on the notification dropdown and the second turns off the option for "quick voice" when you press/hold the home softkey. Both are in the handleInitPackageResources() for com.android.systemui:

Code:
resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_volumeslider", 
		false);

resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_qvoice", 
		false);

Why do you hate the volume slider? It's very convenient to adjust volume without grabbing the phone up to fumble with volume keys on the rear side. Well actually my complaint is none of the Xposed modules for G2 has an option to ENABLE it for Verizon VS980...
10th March 2014, 05:25 AM   |  #10  
garyd9's Avatar
OP Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,167
 
2,087 posts
Join Date:Joined: Sep 2006
Quote:
Originally Posted by Tinchoska

Dude this will work on art?

Dude, like what do think, man? Like, does xposed work with ART, dude?

Sent from my LG-D800

The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes