Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,814,105 Members 44,675 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
garyd9
Old
(Last edited by garyd9; 6th March 2014 at 05:45 AM.)
#1  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
Default [xposed - source] LG G2 KitKat (stock) Xposed mods

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.

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following 17 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
garyd9
Old
#2  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
Default 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));

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
garyd9
Old
#3  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
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);
			}			
		});

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
garyd9
Old
#4  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
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;
			}			
		});

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following 2 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
garyd9
Old
#5  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
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);

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
G-Bus
Old
#6  
G-Bus's Avatar
Senior Member
Thanks Meter 115
Posts: 452
Join Date: Jan 2011
Location: Montreal
Quote:
Originally Posted by garyd9 View Post
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.
 
garyd9
Old
#7  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
Quote:
Originally Posted by G-Bus View Post
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

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following 2 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
Tinchoska
Old
#8  
Tinchoska's Avatar
Senior Member
Thanks Meter 456
Posts: 2,182
Join Date: Jul 2011
Location: Hudson, Buenos Aires
Dude this will work on art?

Enviado desde mi LG-D806 mediante Tapatalk
SKA RULES


Mobile Phone: LG G2 D-806 Argentina Tierra Del Fuego
ROM: Stock argentinean firmware
Kernel: Default
Radio: Default
Recovery: ------
 
zeroxia
Old
#9  
Senior Member
Thanks Meter 18
Posts: 114
Join Date: Oct 2011
Quote:
Originally Posted by garyd9 View Post
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...
 
garyd9
Old
#10  
garyd9's Avatar
Recognized Developer - OP
Thanks Meter 1,983
Posts: 1,951
Join Date: Sep 2006
Location: Pittsburgh, PA
Quote:
Originally Posted by Tinchoska View Post
Dude this will work on art?
Dude, like what do think, man? Like, does xposed work with ART, dude?

Sent from my LG-D800

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.

The Following 4 Users Say Thank You to garyd9 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes